How to wire up a relay for switching between two DC sources(solar and battery) to power a ardu. proj

Thread Starter

Msean123

Joined Oct 12, 2018
4
I'm a student so I don't really have a solid background on electronics.
I'm wondering how to use a relay to switch between 2 DC sources, particularly a solar panel and battery to power our group's arduino project.
I've read lots of threads online saying to use an 'SPDT' relay, but I'm really unsure of how to wire them up.
 

ericgibbs

Joined Jan 29, 2010
18,849
hi M123,
Welcome to AAC.
You could switch manually between the two DC voltage sources using a SPDT Switch.
Or auto switch over to battery when the solar panel has no voltage output.?

Post a simple sketch and description of the project.
E
 

Thread Starter

Msean123

Joined Oct 12, 2018
4
Thanks for replying.

The concept is to switch the power to the battery as soon as the solar panel has no voltage output.
The led is a stand in for the arduino uno that we'll use, the batteries might be either '2x 18650 Li-Ion' or '4x 1.5V AA Alkaline' batteries.
 

Attachments

Thread Starter

Msean123

Joined Oct 12, 2018
4
hi M123,
Welcome to AAC.
You could switch manually between the two DC voltage sources using a SPDT Switch.
Or auto switch over to battery when the solar panel has no voltage output.?

Post a simple sketch and description of the project.
E
As you can see from the schem. I did I'm a total newbie
 

ericgibbs

Joined Jan 29, 2010
18,849
hi,
Your scheme is OK, I initially thought you might want also to charge the battery from the solar panel, that would be more complicated.
We will check it out.
E
 

ericgibbs

Joined Jan 29, 2010
18,849
hi M.
Lets assume a 4*1.5V AA cells , a 5v relay and a nominal 6V solar panel.
A problem is that in low sunlight levels the relay may energise below the 5V rating, say 4V and the loading of the relay current operating may pull the 4Vsolar down, the relay would then de-energise and so the Vsolar would rise/fall and the relay would 'chatter' On/Off.

You need some method of checking the Vsolar voltage, so that the relay only operates on 'bright' sunlight.
Do you follow that so far.?

E

EDIT:
Is the UNO set for 5V operation.?
I guess you know there is on board voltage regulator, requires 8Vdc thru 12Vdc input to work.
 

Thread Starter

Msean123

Joined Oct 12, 2018
4
Simply said, the low solar voltage could cause the relay to be dysfunctional. Am i getting this right?
And yeah charging the battery through solar would be more expensive and complicated for me and the other members so if we were to use rechargeable batteries I'd opt to just charge it using micro usb(TP4056) or use an external charger.


All I know about the UNO is that it has a voltage regulator to output 5VDC to the board by connecting an external battery through the power jack.
 

ericgibbs

Joined Jan 29, 2010
18,849
hi,
This on one option, as you are the guy programming the UNO have you considered a short subroutine that monitors an Analog pin to which the Solar panel is connected [ via a suitable resistive divider].
If the Analog voltage is over the 5V level, a UNO output pin via transistor operates the relay and if the solar drops below say 4.5V it de-energises the relay.?
Have you checked the lowest input voltage the UNO onboard 5Vreg will work down too.?

E
 

Djtechtron

Joined Oct 13, 2018
1
Hey brother..hope this will help..what i did before is i used capacitor banking and i made a ckt out from the net and a little bit of modification and what i did was i convert dc to ac then ac to dc to make my ps more stable even i got only 4volts out and i used a relay with only required a small current coz some industrial or lower type needs enough current to trigger it e.i pcb mount type relay..tnx
 

ScottWang

Joined Aug 23, 2012
7,400
If you trying to use L7805ABV then its input voltage range is 7.5V~18V, so the better is to use 18650*2(7.4V~8.4V), or you want to use LM1117-5.0V(Vin=6.5V~15V, 1V Vdrop type), if the voltage of Solar panel is 6V then you can use a schottky diode in series with an 1N4001~4007.
 

ebp

Joined Feb 8, 2018
2,332
A relay without some extra circuitry won't work very well.

If you look at the datasheet for a small relay intended to operate at 5 volts you will see that the "dropout" voltage can be very low. The reason for this is that the electromagnetic coil has to attract the "armature" that has the moving contact on it from some distance away, but once the relay has "pulled in" the armature is either very near or actually touching the centre pole of the coil, so a much smaller magnetic force can keep it in that position. This would very likely mean that the relay would still be connecting the Arduino to the solar panel when the panel voltage was too low to keep the Arduino running.

Here's a datasheet for a relay I've designed into a number of products. Have a look at the table at the top of page 2. It will help you understand my point above and Eric's point at #6 about pulling in at below 5 V
omronfs.omron.com/en_US/ecb/products/pdf/en-g6a.pdf
 

ebp

Joined Feb 8, 2018
2,332
The simplest way to achieve the objective is to "diode-OR" the two power supplies together. You simply connect the cathodes of two diodes together and that goes to the load. The anode of one diode goes to the positive of one power supply and the anode of the other diode to the positive of the other power supply. The negative sides of everything connect together. Solar panels very often have a built in series diode, so only the battery would need a diode, as marcf suggested.

This very simple circuit assures there is no time delay in switching between the sources so there is no risk of the Arduino resetting because it loses power briefly. The drawback to it is that the forward voltage of the diode effectively means you can't run for quite as long on the battery. If Schottky diodes chosen for low forward voltage at the required current are used, the voltage drop problem is lessened. If you use 2 lithium ion cells in series, the diode drop becomes much less of an issue than with 4 alkaline cells.

There are controllers that use MOSFETs to emulate "ideal diodes" specifically for this application. Unfortunately, they may be available in surface mount packages only. The LM5050 from Texas Instruments controls just one FET as an ideal diode, but you can use two of them for ORing (again, may not be necessary for the solar panel). It is a bit expensive. There are simple circuits using P-channel MOSFETs for protection against reverse polarity but they aren't suitable because they can allow one source to feed the other.
search start at DigiKey:
https://www.digikey.com/products/en.../pmic-or-controllers-ideal-diodes/758?k=oring
 
Top