Wind turbine charge controller prototype/shield

Me and my friend have been building a wind turbine over the past couple of weeks. He is in charge of the structural side and me the electronics. I researched a few DIY charge controllers for wind turbines and found that a lot of them work by detecting battery voltage (and therefore charge) and depending on the value cause the turbine to charge the batteries or dissipate the power to a dummy load. For this i thought i could use the Arduino and if the circuit works correctly and safely, produce a shield.

I have attached my proposed circuit diagram (you may have to be logged in to see it?) and was wondering if some people on the forums could give me some advice. My background is in programming, not electronics. I would like to know if the circuit i've suggested would harm the Arduino in any way e.g voltage spikes or overheating. I would also like to know if the way i've set about building the circuit is the most efficient way i could do so. If anybody has experience here with generating electricity by using a wind turbine and has any advice on that front, that would be most welcome too!

The system shows battery voltage and whether or not the battery is charging on the LCD screen. If the battery voltage is greater than 14.0v - the relays sends power to the dummy load instead of charging.

Here is my source code for the sketch for a greater insight if you're interested (i hope you are!):

/*    Turbine charge controller written by Alex Young.
 *    Date: 15/05/2012
 *
 *    The purpose of this program is too monitor the voltage of a battery and depending on the voltage
 *    of the battery either charge it or don't. The charge voltage and current will come from a wind turbine
 *    generator. The controller needs to handle a wide voltage range and a wide current range if connected to a turbine
 *    of varying speed. The speed can vary greatly and therefore the out will have to be carefully monitored.
 *
 *    The controller will have the following states:
 *        - Battery voltage below 14.0v       :    charge the battery
 *        - Battery voltage 14.0v or above    :    dump the turbine generator power to a dummy load
 *
 */
 
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 7, 8, 9, 10);

// Voltage divider constants (ohms)
const int    VD_R3                    =    10000;
const int    VD_R4                    =    1000;

// Manual buttons
const int    CHARGE_BUTTON            =    2; // DIN
const int    DUMP_BUTTON              =    3; // DIN

// LED displays
const int    STATUS_LED               =    13; // DOUT

// Battery charging
const int    BATTERY_MONITOR_PIN      =    0; // AIN
const int    INSTRUCTION_PIN          =    6; // DOUT
const float  BAT_VMIN                 =    11.9;
const float  BAT_VMAX                 =    14.0;

// Turbine RPM monitoring
const int    RPM_MONITOR_PIN          =    1; // AIN

// Other
const int    DELAY_TIME               =    32; // 32 default

// Program variables
bool manual = false;
bool charging = false;

void setup()
{
    pinMode(STATUS_LED, OUTPUT);
    pinMode(CHARGE_BUTTON, INPUT);
    pinMode(DUMP_BUTTON, INPUT);
    pinMode(INSTRUCTION_PIN, OUTPUT);
    
    digitalWrite(STATUS_LED, HIGH);
    
    lcd.begin(16, 2);
    Serial.begin(115200);
}

void loop()
{
    int vin = analogRead(BATTERY_MONITOR_PIN);
    float voltage = calculateBatteryVoltage(vin);
    
    int rin = analogRead(RPM_MONITOR_PIN);
    int rpm = calculateRPM(rin);
    
    if (chargeButtonDown())
    {
        manual = true;
        charge();
    }
    else if (dumpButtonDown())
    {
        manual = true;
        dump();
    }
    
    if (!manual)
    {
        if (voltage < BAT_VMAX)
            charge();
        else
            dump();
    }   
    
    writeLCDData(voltage, rpm);
    
    manual = false;
    
    delay(DELAY_TIME);
}

float calculateBatteryVoltage(int vin)
{
    float resconst;
    
    if (VD_R3 == 0 || VD_R4 == 0)
        resconst = 1.0;
    else
        resconst = ((VD_R3 + VD_R4) / VD_R4);
    
    return (5.0 / 1023.0) * resconst * vin;
}

int calculateRPM(int rin)
{
    // this function will determine the rpm from an analog value
    // for now just return value passed
    return rin;
}

inline bool chargeButtonDown() { return (digitalRead(CHARGE_BUTTON) == HIGH) ? true : false; }

inline bool dumpButtonDown() { return (digitalRead(DUMP_BUTTON) == HIGH) ? true : false; }

inline void charge() { digitalWrite(INSTRUCTION_PIN, HIGH); charging = true; }

inline void dump() { digitalWrite(INSTRUCTION_PIN, LOW); charging = false; }

inline bool getState() { return (charging) ? true : false; }

void writeLCDData(float voltage, int rpm)
{
    lcd.clear();
    lcd.print("Voltage: ");
    lcd.print(voltage);
    lcd.print("V");
    lcd.setCursor(0, 1);
    lcd.print("RPM: ");
    lcd.print(rpm);
    // TO DO: show whether charging or not
}

I'm not an electrical engineer, so I don't want to make an official statement, but recharging batteries is kind of complicated and dangerous. While I assume you are charging Lead Acid batteries connected in series to some other power producing device, don't ever charge LiPo or other unstable batteries. Lead acids are safer, but even those can be dangerous if not taken care of properly.

Idk exactly what you are looking to power with your wind generator, but you aren't going to get a whole lot of power with a 12V motor.

Interesting project btw

If the current is low (a couple amps) and the battery is big (a car battery?) then there's not much to worry about with respect to recharging. If you were going full scale then you'd start looking at your charge rate but that's next level stuff.

Your circuit looks OK to me.

I'm not an electrical engineer, so I don't want to make an official statement, but recharging batteries is kind of complicated and dangerous.

I've read about storing rechargeable batteries in a ventilated area because they can produce hydrogen which is flammable. I also understand that they can be overcharged which can be dangerous or seriously affect battery life. Both of this issues are being addressed with the room they're contained in and by using the charge controller. Yes they will be lead-acid sealed batteries. We will connect a few in parallel to increase capacity.

you aren't going to get a whole lot of power with a 12V motor

We are not looking to generate anything more than about 150W. Even that would be nice for now. The motor will be charging the batteries and the load taken from them. We have a small 150W inverter which will be connected to the batteries and we'll probably use the DC current with a voltage regulator to make some sort of regulated DC power supply which would be nice.

--

If the current is low (a couple amps) and the battery is big (a car battery?) then there's not much to worry about

I'm not 100% on the physics behind recharging batteries. Does anybody know what current the batteries will be charging at if the motor is spinning at a speed that produces 15V? I know this isn't a very arduino-related question but i am quite interested in finding out if anybody can point me in the right direction.

alexyoung91:

I'm not an electrical engineer, so I don't want to make an official statement, but recharging batteries is kind of complicated and dangerous.

I've read about storing rechargeable batteries in a ventilated area because they can produce hydrogen which is flammable. I also understand that they can be overcharged which can be dangerous or seriously affect battery life. Both of this issues are being addressed with the room they're contained in and by using the charge controller. Yes they will be lead-acid sealed batteries. We will connect a few in parallel to increase capacity.

yeah, storing them somewhere away from other things is a good idea. lead acid batteries will probably just leak acid (which is of course a health and safety risk in itself) or not store a charge if there is something wrong. LiPo's on the other hand, will catch on fire, a very intense fire. i don't recall lead acids catching on fire much, but you should be aware of potential risks.

alexyoung91:

If the current is low (a couple amps) and the battery is big (a car battery?) then there's not much to worry about

I'm not 100% on the physics behind recharging batteries. Does anybody know what current the batteries will be charging at if the motor is spinning at a speed that produces 15V? I know this isn't a very arduino-related question but i am quite interested in finding out if anybody can point me in the right direction.

Power = current * voltage

assuming your inverter is operating at maximum power and 100% efficiency:
150 watts/15volts = 10 amps.

I'd have to know the charge rate and capacity on your batteries to know if that's a safe charge rate for sure, but i imagine it would be. Although, according to this guy's website, a 45Amp hour battery (a regular car battery) should only charge at 5 amps. http://www.chem.hawaii.edu/uham/bat.html

that looks to me like more of a rule of thumb though. Like i said, manufacturer label will tell you more.

Battery charging is a bit of a black art that I am only slightly privy to, but this is what I understand about it.

A good rule of thumb is to charge no more than 10% of the AH rating. So with your 10A you are OK with a 100AH battery or more.

If the battery voltage is greater than 14.0v - the relays sends power to the dummy load instead of charging.

It depends on the battery of course but up to 15v should be OK, according to where you are in the charging cycle.

they will be lead-acid sealed batteries.

If that means AGMs then you don't have to worry much about gassing, but with wet cells you do.

Does anybody know what current the batteries will be charging at if the motor is spinning at a speed that produces 15V?

That depends on the voltage of the battery, there will be a lot of current if they are flat and bugger all as it charges and the voltages get closer.

Normally you use a three-stage charging algorithm.

BULK - Dumping as much as you can into the battery.
ABSORPTION - Let it sit at about 15v for a while, even a couple of hours.
FLOAT - Drop back to about 13.3v to keep it happy.

The actual voltages vary, the last batteries I bought had them printed on the label but that's the first time I've seen that. Get the info from the maker or use the above to start with.

Also your dummy load resistor had better be a big one, people often use heater elements.


Rob

Lead/acid batteries do release flammable gases when charging and especially if they are charged too fast or over charged. It is very important to have good ventilation and keep them well away from any possible sources of ignition. The batteries themselves won't burst into flames in the way that LiPos will, but the gases given off by lead/acid batteries can be very dangerous in an enclosed space.

Cheers for your help guys.

@Graynomad - i know what you mean about the mystery surrounding charging batteries. I think using an arduino will be a good way to implement any algorithms and easily change how the batteries are charged. Do you have experience charging from a generator? Im still trying to get my head around whats actually going on. My understanding is that the greater the turbine RPM the greater voltage produced and as a load is applied to the turbine a current will be drawn according to the resistance of that load, making it harder for the hub turbine to spin. The motor we're thinking of is rated at 200W and 24v and we have no idea what kind of speeds it'll be doing, will there be a voltage to start charging the batteries at aswell?

@PeterH - how can i limit the current going to the batteries? If this motor is spinning fast enough to achieve a charging voltage of say 15v again, surely a fixed current will be produced thats charging them? Do you know the maximum voltage you can charge lead-acids at? Also is it possible to charge them at lower voltages, i assume that because its still electrons flowing into the battery, what difference does the charging voltage make?

O_o

alexyoung91:
Cheers for your help guys.

@Graynomad - i know what you mean about the mystery surrounding charging batteries. I think using an arduino will be a good way to implement any algorithms and easily change how the batteries are charged. Do you have experience charging from a generator? Im still trying to get my head around whats actually going on. My understanding is that the greater the turbine RPM the greater voltage produced and as a load is applied to the turbine a current will be drawn according to the resistance of that load, making it harder for the hub turbine to spin. The motor we're thinking of is rated at 200W and 24v and we have no idea what kind of speeds it'll be doing, will there be a voltage to start charging the batteries at aswell?

I imagine you are going to run into problems using a motor that is rated at a higher Voltage/power than your inverter. I figured since you said a 15V inverter @ 150 watts, you were using a 12V motor that was rated equal to or ideally less than 150 watts. Using a motor higher then that you are risking damaging your inverter in high winds, unless you are 100% sure you will never produce more than 12V and 150 watts, but I'm not sure you can ever be 100% certain of that. If part of your circuit gets damaged, and the load get's 'removed' when it's windy out, it's possible you could blow your inverter in a couple seconds.

alexyoung91:
@PeterH - how can i limit the current going to the batteries? If this motor is spinning fast enough to achieve a charging voltage of say 15v again, surely a fixed current will be produced thats charging them? Do you know the maximum voltage you can charge lead-acids at? Also is it possible to charge them at lower voltages, i assume that because its still electrons flowing into the battery, what difference does the charging voltage make?

O_o

I'm not totally sure, but it's been my experience your inverter will try to output a constant voltage, and the amount of current you produce from the inverter will vary.

If your current gets too high, the safest and easiest thing is probably to just discharge it over the resistor, but there are more advanced techniques to restricting it. I am pretty sure PWM is used for that. Your inverter probably has an output current limit as well. I'd look at that. And If all else fails, you could fuse the circuit.

alexyoung91:
@PeterH - how can i limit the current going to the batteries? If this motor is spinning fast enough to achieve a charging voltage of say 15v again, surely a fixed current will be produced thats charging them? Do you know the maximum voltage you can charge lead-acids at? Also is it possible to charge them at lower voltages, i assume that because its still electrons flowing into the battery, what difference does the charging voltage make?

O_o

If it's a 12V lead acid battery battery it'll be happy for you to hold it indefinitely at 13-14V. The amount of current needed to achieve that will vary depending on the state of charge. I suggest you also control the discharge to prevent the battery from being fully discharged below around 11V to prevent damaging the plates, this will also avoid it taking a massive current when you connect the charger. It will still take a high current, though, easily 100A for a single battery and correspondingly more if it's in a bank, so in practical terms the current will probably be limited by your generator being dragged down by the load of the battery.

I think using an arduino will be a good way to implement any algorithms and easily change how the batteries are charged.

True.

Do you have experience charging from a generator?

Sort of, we use one often when there isn't enough sun. But we run it into an inverter/charger and that does all the work.

A 12v inverter should be good up to at least 15v as it's designed to be connected to batteries and that's what they get. If your turbine produces ~24v I imagine that will be an issue, check the inverter specs.

The current going into the batteries is determined by the voltage difference between them and the source, when you start they are at say 12v and your source is 18v there is a lot of current flowing. Later the batteries are at 15v there's not so much.

I think you have to limit this by using PWM to modulate the voltage while measuring the current.

As your turbine appears to be a bit mis matched with the batteries using MPPT techniques may be better, but I don't know how they do that.

One place to ask about this stuff is this forum

A lot of these guys use use turbines and have made their own regulators etc.


Rob

I've just been reading about PWM charging, does anybody know how i could implement this using an arduino? Would it be something like, read the voltage from the turbine and depending on how high or low it is, write a PWM value to a transistor to maintain a constant charge voltage, or have i got it completely wrong?

Hi, hope there is someone still watching this thread. I have been cracking on a more complex version of this issue for some time. I am an EE as well as a software engineer, and I would really be pleased if I could get some help from anyone building a charge controller like this. I have done most of the homework conceptually and just need to work out details. First of all, looking at this schematic, I see some weaknesses. For example, a blocking diode is only necessary if the panel remains connected to the batteries continually rather than just when the voltage is high enough to charge. This may or may not be necessary for a wind generator. That blocking diode is going to eat around 4% of your power on a 12 volt system. If you measure current in stead and switch off as soon as it isn't positive, then the problem is solved. Second of all, we need a current flow measurement on the battery to really see what is going on. You are basically only using a single analog in to measure the voltage on the battery. This won't work well to tell you the charge state because the voltage on the battery will change depending on how much current you are driving into it. (a major issue for a wind power system) You don't really want to overcharge the battery as this can be destructive. Breakers are of course preferred over fuses.

The battery moves between charged and discharged with as little as half a volt of change, so you need to have equations that govern this to get good control of it. There is a pdf out there that says a ton about the behavior of 12 volt batteries charge state. I have a copy of it.

Now, here is the big reason why you don't want to turn this into a circuit design for a shield. This system is not flexible/modular. To make a charge controller shield that has value, it needs to be prepared to deal with a lot of variations, including adding in stuff like mppt charge control. PWM charge control .. next thing it needs is an exhaustive document explaining how to design and plug in modules into the system, configure it, etc. By the time we get that done, you will discover that the board may not have enough I/O.

Also, these cheesy little lcd screens are really weak. Charge controllers can be pretty complex, lots of settings, etc. The thing really needs a tft and a keypad. That sucks up more I/O. There is a very interesting way to solve this problem so that you can have/use a tft or not. It's called use the vt100 terminal emulation standard. If you set up an additional arduino that acts as a vt100 terminal emulator, several things will happen. First of all, you will have the option to run a cool display with an additional arduino in communication with the original one. Second of all, you won't have to use that if you don't want because there are terminal emulator programs that run on computers, so if you want to save the $50, you can run a terminal emulator on a computer to configure the unit in stead. Next, If we design such a terminal emulator arduino, we will have created a marketable product in and of itself. All it takes is an arduino mega/tft combination (cheap in some places) that uses multiple communication options to allow multiple types of communications links.

When we have wrapped this stuff up, then we have a charge controller shield that you/we can sell on the market. We also have an arduino vt100 terminal emulator system that we can sell on the market as well as use for other automation efforts. And the system kicks ass because it was done aggressively and properly. I already have a vt100 client library that I wrote for another controller/project that could be ported to Arduino. That library can be used to set up a settings management system lickety split.

So, the next issue is .... 12 volts sucks. I'm shooting for a dual-pole 24/48 volt system that balances the batteries, has options for mppt, and options for multiple pv arrays. There is a ton of value available by doing dual pole 24/48 volts.

1: you can power stuff that wants 2 poles directly like class d audio amplifier boards
2: you can power 24 or 48 volt items
3: the system is more efficient because you will run at higher voltages.

costs: requires more breakers and relays to protect and secure the system.

Lastly, if you are planning on using a wind generator, mppt control will be critical. because wind generators have a very ficle and complex behavior.

Next issue for a wind generator is that if you have a generator that produces ac, then a hybrid two-pole/bridge rectifier will seriously help manage your charge current without needing an mppt controller.

:slight_smile: anyone who wants to help me build this cool item can be in on it. Then we can just sell the kick-ass shields, and people can have kick-ass dc power distribution at open systems prices. This could go a long way towards making home power and independence cheap.

BTW I already have partial parts lists, some code, some arduino megas, tfts etc.

BTW, there is some stuff bouncing around here that is not making proper sense.

First of all.... a 24 volt motor rating? Don't we understand what all of the related dynamics are here guys? Motors that act as generators output voltage according to their speed. The 24 volts will pop up if you run the unit at its rated speed, and you have some control over its speed by means of gear ratios and wind mill protection schemes. Next thing is that whatever the battery is at, it will draw the motors output down to the battery voltage. So if it is trying to output 20 volts, but your battery is at 15, the thing will pump a lot of current into the battery at 14-15 and risk burning out. It will not pop your inverter because the battery will hold the voltage down. The real problem here is that your battery will draw nothing from the unit until it goes over 12.5 volts, then at 14-15 volts output from the motor, it will be drawing like mad, so the power flow curve will not respect the power available curve, and you could call this an impedence mismatch. The impedence mismatch is handled by doing something like the above mentioned hybrid 2-pole/bridge rectifier for an ac output generator or an mppt controller which carefully watches the current flow and draws current optimally while it converts extra voltage down. So, there is another solution to this and its called using a rotor current scheme for voltage regulation like is done with automobile alternators, but having to supply rotor current for a wind generator could really suck. Automobile alternators do not make good wind generators excepting in very carefully designed circumstances. Basically the only circumstance that works well for this I have ever heard of is if you use a large wind mill that uses a serpentine belt that spins several automobile alternators. Then you have a controller that turns on the rotor coils one at a time with the proper voltage to make it output the voltage you are after. So the alternators turn on something like an audio level meter, and as they spin faster, the controller diminishes the rotor coil voltages... or, as another option to diminishing the rotor coil voltage, the hybrid rectifier strategy could be used.

so anyone who wants to get involved in this project and help me to do it right, please feel free to let me know :slight_smile:

Sounds as if you have already put a lot of thought into this. If you're looking for people to team up with you, you might find it's worthwhile posting under Gigs and Collaborations.

Oh, I forgot ... there is another issue ... lead acid batteries differ in their allowable charge current. Gel cell batteries have current limits. High currents can cause bubbles that damage the gel. Flooded batteries generally don't have any meaningful charge current limits. Gel cells have become rather rare, but keep your eyes open. Sealed, no maintenence batteries are also less tolerant of high currents than flooded ones. I have an extensive dc power distribution writeup (that is growing) here:
http://egrouphub.com/wiki/index.php/DC_Power_Distribution we will be doing a lot of open source projects, including arduino projects on that site.

arduino has a gigs/collaboration forum section? I'll check it out.

sorry, I am kinda lost, could you post a link to "gigs/collaborations"

It's in the Community section of the forum. Just go to Arduino Forum and scroll down until you see it.