Main power switch

Hi all, I made my garage into a home cinema room aka mancave. The whole thing is fully automated by Arduino (Air control, heating, lights, receiver, projector, RGB lights, ect…). For safety reasons I have one high power main relay, when turned off the whole garage is powered down.

The main relay can be turned on by a momentary push button. When the button is pushed a 9v battery will switch on the main power relay and the Arduino is powered. The Arduino is connected to the relay as well. When the push button is released the battery power is broken, but the Arduino is powering the relay so the main power stays on. This whole thing is accomplished by some diodes and a capacitor but is kind of buggy. Because of the voltage drop of the diodes there is barely enough power to switch the relay and when the button is pressed and the Arduino is on, current is flowing from two sources which doesn’t feel right.

Does anyone have a pointer towards a better solution?

It's a five volt relay, isn't it?

What is the supply to the Arduino? If that is 9V or more, then supply the relay with two diodes from the battery and the supply to the Arduino, with a (NPN) transistor in the negative of the relay to switch it - the transistor will have minimal voltage drop and you put the pushbutton across the same transistor (or arrange a second base resistor to switch it on form the battery through the pushbutton). Feeding the relay from 9V each way will give it plenty of hold.

The Arduino is powered by a 9v voltage regulator which in its turn is powered by a 12v power supply. For the relay I’m actually using a relay board which use 5v power and signal. I guess I over simplified my previous schematic so I attached a new one.

Thanks for the suggestion, I tried to project your idea to the actual situation. Is this what you have in mind? When pressing the power button while the Arduino is powered, both Arduino as the battery are supplying power to the relay. Isn’t that a problem?

HanSoloMane:
The Arduino is powered by a 9v voltage regulator which in its turn is powered by a 12v power supply. For the relay I’m actually using a relay board which use 5v power and signal. I guess I over simplified my previous schematic so I attached a new one.

Now you have me confused! Your new diagrams do not even show the relay, so that is no help, but you have evidently missed the point. Perhaps you had better show a link to the relay board so that I can explain how to connect it appropriately.

I'm sorry for the confusion I’ve caused, and I appreciate your patience! The relay used is one like these. The ground, signal and power labels in the diagram refer to the ground, signal and power connections on the relay.

HanSoloMane:
Thanks for the suggestion, I tried to project your idea to the actual situation. Is this what you have in mind? When pressing the power button while the Arduino is powered, both Arduino as the battery are supplying power to the relay. Isn’t that a problem?

As long you have all the grounds connected it won’t be a problem with the same voltages.

Ah, OK, now that makes sense.

While my original suggestion was slightly different, either of your descriptions (but the diode version should be quite sufficient) actually correspond to the alternative suggestion I had in mind, so would be perfectly adequate.

With the diodes to supply power to the relay (plus the 10 ohm resistor after the diodes to drop the relay voltage to 5V), it does not matter which of the supplies, 9V regulator or 9V battery, supplies the relay. Since the relay draws 180 mA (at 5V) however I do hope you do not expect a "PP3" battery to operate it - you will need a holder of six AA cells. Actually, four would do to provide 6V, with the resistor not in the battery side, but in the 9V supply side.

Considering that current draw, you most certainly do not want to attempt to power this relay (module) from the 5V regulated Vcc from the regulator in the Arduino, let alone attempt to power the relay itself from a port pin. Driving the control transistor from the Arduino pin - with of course the two diodes to separate this from the battery - is however quite fine.

Great! Thanks for your input it is appreciated. I will go for the 6v alternative and drive the relay from a non-Arduino regulator.