Could some one explain how one could use the arduino to switch between two voltage sources?

I am trying to prolong the flight time of a plane am designing for my senior project. I thought that i could use an arduino and program it to switch between two voltage sources. When one voltage drops below a certain level, the arduino will switch to the other battery. Please help!!

Views: 5925

Reply to This

Replies to This Discussion

Why do you need a switch? If you have both in parallel, you will have the same voltage, but double power.

Since you always carry both source, then consuming one lipo and then the second one is similar to have 2 in parallel or a bigger battery.

After me switching between 2 Lipo is not an advantage, except if you can drop the payload of the consumed Lipo with a parachute.

This is a requirement that i have to fulfill for my senior project before i graduate. I have to switching between to

power sources using an arduino. The primary voltage source is a solar panel and the secondary voltage source is a

battery which will be used as a backup if there is a loss of sunlight. They understand that i will not be able to

purchase the solar panel so they told me to use another battery in the place of the solar panel.   

You could use a MOSFET as a switch,

or more simply a mechanical relay see as an example. Just make sure you can actuate it with 5V and its rated at least 20A for the max current, more if needed.

OK, a voting method, then.  Reading the voltage on the Arduino through an analog input and a voltage divider should be pretty easy.  Then as Bill suggests, use a MOSFET to select the better power source.  But, build a bit of hysteresis into it so that it doesn't constantly flip flop.  But you can't just throw a switch between sources because the APM will momentarily loose power causing a reset of the Arduino.  could mess up the program...  You could put a giant capacitor on the Arduino to keep it's +5V up during the switchover.

That's a good point, I obviously, and without thinking ;-), assumed the switched source was not powering the Arduino as well. You could use a design that the Arduino is powered by the second battery always, and the switch just connects the main output to the Arduino supplying battery

Thanks for the advice,but does any one have any sources they could point me to so that i could start working on this. I will need to know the type of Arduino that i have to use, and also how i will have to connect the MOSFET together with the Arduino. I already built a circuit that i could use to detect the voltage on battery and when it goes beyond a certain voltage point it acts like an open circuit.I used a zener diode and a couple of npn transistors. it works but its not precised. My professor then gave me the idea to use an Arduino to do the switching, but i dont know were to start.


If you want to avoid an arduino to do this, check out the BatShare. I use it all the time and it does exactly what you are talking about for 5v and 6v sources off 2 batteries. link here . You can put any battery type of size on each outlet and it will intelligently manage drain equally from both, automatically switch to the one thats best if the other drains too much and I use these not only in my APM but on my over $10k GiantScale aircraft. They work perfectly and very cost effective!

Thanks for the reply, the drone i am designing has to have an input voltage of about 12.6 volts, so thus am using an 11.1v lipo battery. I plan on using two 11.1v lipo batteries.The peak or max current output is somewhere around 36A. With the BAT SHARE you mentioned could i modify it or are there other ones that can handle this peak currents. I know the voltage is not a problem because i can step it up .

Rather than modify the BatShare, use it to monitor the battery voltages, and connect the outputs to drive the MOSFETs.

Where is 12.6V a hard spec?  If you are looking at powering brushless motors, the difference from 11V to 13V is negligible if the battery can provide the current the motors want.  Watts is Watts - lower voltage+higher current = same wattage, A.K.A. power.  Using a switching supply to bump the voltage will yield a net negative.  A pretty big one actually because the current required would dictate pretty beefy switching supply which would add considerable weight to the aircraft so you would need bigger batteries which makes the aircraft heavier - see where this is going?

Yes Stephen has a great idea. I will check on whether ones exist for 12.6v not sure. To be frank the easiest way to prolong flight with Lipos are the source is to join 2 or more in parallel and increase the MAH. I am not sure adding additional weight of a switcher will be of benefit efficiency wise. Just a thought. I get 48 minutes on 2 - 4S - 5000 MAH batteries on my Arducopter. I get almost 2 hrs on 2 - 3S 3500mah flight packs on my Arduplane. How long are you looking to fly ? Wayne Garris gets 3.4hrs on the TechPod with 10000mah 6S for thought!

see the tutorial on blinking and LED on based on the volatge from a pot on the analog in looks like a good example. Its close to what you are doing. ie. change a state output based on voltage in

You just need to use a standard arduino

Google 'Arduino FET switch'. e.g gives There are lots more resources, too many too list.

hope that helps

Guys, I'm pretty sure that BatShare is nothing more than couple of high capacity Schottky diodes.  Something like this:

Those are only $2.79 each, and you'd need two.  They are rated at 15V and 20A.  Simple as that.  You'd probably want to bolt a heat sink to them.  That's it, done.

You could use a heat sink like this:

Thought that might not actually handle the heat.  At 0.5V drop at 20A, the diode will be burning 10W of power, which needs to be dissipated.  I think you could bolt both diodes to this thing and it would work:

You could go much smaller if you had forced air.

They might also be using an ideal diode like this:

But that's only rated at 4A.  You can also go with something like this, which is an ideal diode controller, it basically is an automatic switch for some large MOSFETs, this could handle... a LOT of amps.

There's pros and cons here.

If you're always going to be pumping a lot of current through it, and you don't care so much about voltage drop, and you don't need any intelligence, then the Schottky diode might make more sense.  The thing to know about this, is it will always be sharing the load to some degree, between the two sources.  If you have two batteries hooked up, it will initially draw from the one with the highest voltage, until they are equal, and then they will share the load from then on.  The battery with the higher charge CANNOT back feed and charge the second battery, which is good.

If you want super low resistance, and some intelligence, the Ideal Diode controller is the way to go. The LTC4416 is a nice system.  In particular, you'll notice that you can designate one of the sources as the primary source.  It will always draw ONLY from this source, as long as the input voltage is in range.  It will only draw from the secondary source if the primary falls below a setpoint.  Then it switches over.  My only concern with this is that in some cases, I think you could have it switching back and forth rapidly.  This is what would happen if the power supply couldn't handle the load. Say the primary source can't handle it, so the voltage drops, it would switch over to the secondary.  Now that the primary isn't being drawn on, the voltage would recover, and the 4416 would switch back over to the primary...

In a situation like this, I think just dumb diodes would be better.

Reply to Discussion


DIY Drones Monthly


Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2016   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service