My friends and I are working on a VAWT, and we will need a battery bank to go along with it. We would like to be able to use a micro controller to keep track of voltage and amperage over the entire bank (or preferably each individual battery). My question is how can I use a micro controller to do this?
Fantastic! My students just finished installing our 400W vertical axis wind turbine (VAWT) and monitor similarly to how you would like. For this post I am going to assume that you are going to be using 12V car-style lead acid batteries as your bank for the following explanations and math.
In order to monitor the voltage off of your batteries, presumably somewhere between ~11.7V & 14.4V for the car battery depending on its state of charge, you will need to convert the high voltage to a voltage that your microcontroller can handle, typically 5V. One method to accomplish this is through the use of a voltage-divider, which uses a pair of resistors to “scale” the voltage down.
Using the following formula: Vout = (R2/(R1+R2)) * Vin and say a standard resistance for R1 of 10,000Ohms.
So 5V = 14.4V * 10000Ohms / (10000Ohms + R2)
Solve for R2 = R1 / ((Vin / Vout) – 1) or R2 = 10000Ohms / ((14.4V / 5V) – 1)
R2 = 5319.15Ohms
I use this reference for finding the closest standard resistor value. In this case the closes resistance equivalent to 5319.14Ohms is 5100Ohms giving you a ~0V to 4.864V (You want to pick the value that is slightly lower then your calculated so as to not go over your 5V ADC limit. i.e. 5600Ohms would result in a max voltage of 5.169V and would potentially damage your microcontroller)
You can also use two resistors in series for R2 in order to more closely match your calculation. i.e. R2 = 5100Ohm + 220Ohm = 5320Ohm which would result in a range of ~0V to 5.001V rather then ~0V to 4.864V.
Your ADC conversion is as follows:
Volts/Bit = 5V / 1024 (10bit) = 0.00489V / Bit
So 14.4V from your ADC would look like 4.864V / 0.00489V/Bit = 995
If your bank consists of more then one battery….say 4 in series, all you have to do is add more dividers. There are two methods of doing this. The first would be to use just one divider on all 4 batteries. This method gives you the most resolution on your max voltage.
The second method is to attach a voltage divider to each battery and use a common ground. This method allows for the monitoring of each battery, although the V/Bit resolution decreases for each successive battery, as shown below.
Now, on to measuring current. A common way for a microcontroller to measure current is with a shunt (a really low resistance high-precision resistor) and a differential microcontroller. If you apply Ohm’s law to the circuit and measure the voltage drop over the resistor you can deduce the current flowing through the bank. Adafruit has a nice little breakout for the INA219 I2C current sensor that can measure up to 26V @ +-3.2A. This might be a bit low power for your application but could act as a good test board. Alternatively, Trossen Robotics has a 30A version that might be a bit more in your range.
I have also had luck with Microchip’s MCP3424’s in the past for such an application, as you can measure the voltage of 3 batteries and the current over the entire bank with one device. You just need to calculate the needed shunt and cooresponding dividers and you are good to go…as shown below:
I hope this has helped to answer your question and good luck with your turbine!
Don’t forget, everyone is invited to ask a question!
“Ask an Educator” questions are answered by Adam Kemp, a high school teacher who has been teaching courses in Energy Systems, Systems Engineering, Robotics and Prototyping since 2005.
Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.
Join us every Wednesday night at 8pm ET for Ask an Engineer!
Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground” – Adafruit’s Apps!
Maker Business — Happy CyberMonday ya’ll it’s #MakerBusiness
Wearables — Let it rain
Electronics — Autoscale is cheating!
Biohacking — CRISPR is Currently in Patent Court
Sorry, the comment form is closed at this time.