This question already has an answer here:

OK. So I am developing a simple stand alone device. It has a sensor module that takes in 12V and another PCB that takes in anywhere from 5V to 12V.

Now, I am running this entire device using Mains supply. My Question is, is there a way, wherein, the device will automatically Switch to a battery supply when the Mains supply fails?

I have read on this topic a little bit and have come across devices called Power Path Controllers.

Will a simple Relay also do? I attach the Common terminal to the Input of my circuit. Like the diagram shown below.

Might that work? Any advises?enter image description here

I need this switching to happen automatically. Without any human interference. Also, it would be an additional positive if my microprocessor could tell which supply is giving power.


marked as duplicate by dim, Daniel Grillo, uint128_t, Voltage Spike, Dave Tweed Dec 8 '16 at 23:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ @winny Its not a duplicate. The Question you mentioned, the user will himself switch between supplies. I want this system with an automatic switch....its different \$\endgroup\$ – shantanu Dec 8 '16 at 9:19

You can use possibly something like this enter image description here This is from the "Arduino Programmable Constant Current Power Resistance Dummy Load" by wigman27 on Instructables.

The relay RL1 is normally closed to allow VCC to be supplied from VUSB. If something is plugged in at VIN, the relay switches over to power the board from VIN.

  • \$\begingroup\$ I think that is exactly what my diagram in my Q is doing. When mains power is applied, the Common terminal (Vin to circuit) is connected to NO terminal (12V). And when mains in OFF, the Common terminal is connected to the NC terminal (Battery) \$\endgroup\$ – shantanu Dec 8 '16 at 9:45
  • \$\begingroup\$ Yes it is. I wanted to show, that your idea is possible and already used in designs. So you can go on with your own design :) \$\endgroup\$ – electricar Dec 8 '16 at 9:50
  • \$\begingroup\$ is there any way that I can make the Processor know who is supplying power? \$\endgroup\$ – shantanu Dec 8 '16 at 10:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.