I have a setup with a relay that disconnects mains voltage for a project.the problem i have is that the relay works fine when i connect it to the arduino and power it from a laptop but i changed the source to a mobile charger with sufficient current rating it just keep turning on and off .i think that after turning on it keeps shorting as the arduino resets too i have also tried it directly by removing arduino and just powering it through the charger same thing happens. i have changed the charger once too . one thing to be noted is that i tried another cell phone charger with output:5v and current :1A it worked with it .
(x)
** EDIT:** turns out it was my own mistake ,the input wiring for powering the charger were mixed with the relay . fixed now thank you all for the help !
Best Answer
but i changed the source to a mobile charger
Aha! Many mobile chargers (power banks) switch off when the load only draws a small current. This is likely the reason why the power is switched off. The Arduino + relay simply doesn't draw enough current to keep the power bank switched on.
The power bank "thinks" there's nothing connected so it switches off.
Your alternative is to use a power bank that is doesn't switch off at a low current.
You could also increase the load (for example by connecting a 27 ohm, 1 Watt resistor between 5V and GND) to keep the power bank awake but that will very likely drain your power bank much more quickly.