ASK AN EDUCATOR – “How can I use a microcontroller to monitor a VAWT?”

Matthew asks:

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

Alternatively you can use a calculator like this one to do the math for you 🙂 (note: there are more sophisticated calculators that take the effect of current load into account)

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!

Click here!

“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.

Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here:

Join Adafruit on Mastodon

Adafruit is on Mastodon, join in!

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7pm ET! To join, head over to YouTube and check out the show’s live chat – we’ll post the link there.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 36,000+ makers on Adafruit’s Discord channels and be part of the community!

CircuitPython – The easiest way to program microcontrollers –

Maker Business — “Packaging” chips in the US

Wearables — Enclosures help fight body humidity in costumes

Electronics — Transformers: More than meets the eye!

Python for Microcontrollers — Python on Microcontrollers Newsletter: Silicon Labs introduces CircuitPython support, and more! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

Adafruit IoT Monthly — Guardian Robot, Weather-wise Umbrella Stand, and more!

Microsoft MakeCode — MakeCode Thank You!

EYE on NPI — Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — #NewProds 7/19/23 Feat. Adafruit Matrix Portal S3 CircuitPython Powered Internet Display!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at !


  1. Dude! A voltage divider? Seriously? You’re putting a resistor straight between each battery and the ground. Guess what goes through it? Current!

    You know that the impedence of an ADC port is infinite, right? So if you really want to use a voltage divider, you could use way higher resistors, say 150k and 300k.

    But the smart answer to this solution is not a voltage divider at all. You know that the voltage of the batteries is 12V, but you also know that it won’t vary from 0 to 12V. So you can also use a voltage substractor to substract a reference voltage, say 8V. So you end up with a nice voltage range that you can measure with your microcontroller, AND you are always in infinite impedence.

    What about that?

  2. “You know that the impedence of an ADC port is infinite, right?”

    No it’s not. The impedance of _any_ input is never infinite, it’s simply relatively large. For some types of ADCs (SARs, for example), the effective input Z can be a lot lower than you think it is.

    Let’s assume Z_input = 1Meg. For your suggested ‘tail’ resistance of 150k, the combined parallel resistance of 150k || 1Meg = ~130k, which throws off expected values by 15%.

    An SAR type ADC (as found on the Arduino) uses a sample-and-hold capacitor which needs to be adequately charged in order to yield a good reading. It’s optimized for feed values of around 10k – 50k, so the resistances Adam suggested would draw more current (though still ~1mA), but also yield more accurate data.

  3. It was helpful, I’m going to start playing with this tonight. Thanks 😀

Sorry, the comment form is closed at this time.