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!!
I have a new problem for you to add to the mix. Just comparing the battery voltages to switch to the higher voltage battery isn't going to work. If your battery currently in use (A) drops to, say 11-Volts, and the other source (B) shows 13-Volts, then you would switch. That won't work because the battery currently in-use is under load, and the second battery is not. As soon as you switch batteries, (A) will be unloaded and probably read higher voltage than battery (B) because (B) is now under load, so a simple voting circuit would switch back. Altogether it would oscillate between the sources.
The solution would be to only measure the voltage of the battery not in use. Then switch batteries and measure the other battery now not under a load. Then make a decision on which battery really has the higher voltage and switch to that one. Then wait a minute and do it again.
Do you want me to include this in the code for the Arduino? or use the current circuit i already built to do this? Note that i have tried out the circuit i spoke of in the lab under load and when the two sources were the same it acted different. One of the reasons i think it acted different in terms of switching was because the cut-off voltage (zener diode's voltage ) was very close to the secondary batteries voltage. For example, the Zeners
cut-off =11.5V and the secondary battery was charged to 12.6V. The circuit never gets the chance to get down to 11.5 cut-off voltage. It alternates between the two sources
It's your assignment - you figure it out. I was just pointing out a design flaw of comparing battery-1 under load with battery-2 under no load.
When the batteries are similar, the battery under load will always read a lower voltage than the one not loaded. So the simple circuit will be constantly switching batteries.
Stephen brings up a very good point. You could account for the voltage drop in your code but the voltage drop varies according to the current being drawn meaning that you could possibly include a current sensor and do a few tests with your batteries, calculating the voltage drop at different current draws. Then implement that into your code.
Well, sorry by me agressive worlds.
The problem is ... almost everything i read here (DIYdrones forum) is very basic and superficial.
So .. when i see a person working in a SENIOR project asking this SIMPLE kind of question i stay dizzy ... and i think ..
Where the world is going ?
Probably this is not your case ..,.then .. when you ask something ... do this correctly.
Describe your problem with more detail so i can understand what you need to do.
well ... i need more anxiolytic
Good Grief! Most could tell the OP changed his tune several times over. Let's hope the OP got what they wanted.
I am in the process of updating the circuit that Craig uploaded. I will use two relays instead of one. Once the first battery is below its predetermined point say 11.5v, the Arduino will use the first relay to open the circuit and at the same time close the circuit using the second relay for the second battery.Hopefully this does the trick. Like this only one battery is connected at a time.
As long as the Arduino is not powered by those batteries. Any momentary loss of power will cause it to reset.
Do you think it will be a bad idea to have the Arduino on an independent lipo battery. That is independent of the primary and secondary power source