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
}