Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Re: Simple battery charging circuit on: June 19, 2012, 05:29:36 pm
I understand i have a lot to learn about charging batteries, thanks for your advice smiley Is there a way to read the battery voltage while a higher voltage from the generator is being applied so i know to stop charging the the battery when it reaches the fully charged voltage? Also is there a way to detect generator voltage so if it reads below 17v, to stop charging the battery because the voltage isn't high enough?
2  Using Arduino / Project Guidance / Re: Simple battery charging circuit on: June 19, 2012, 04:20:59 pm
The generator can produce more than 17v easy so it's no problem for the regulator. Its rated at like 200W and can easy handle a few amps. But my question is, is it possible to read the voltage of both the generator and batteries simultaneously while charging? When i've tried before, both readings are the battery voltage, which only increases slightly as the generator spins faster and faster...
3  Using Arduino / Project Guidance / Simple battery charging circuit on: June 19, 2012, 06:52:09 am


Above is a simple charging circuit for charging batteries with a DC generator. I don't know much about the theory of charging batteries but i believe this is one very basic method. The batteries are charged with 15v DC using a regulator attached to the generator.

I would like to use two analog inputs to read the battery voltage and generator voltage using a couple of voltage dividers. The arduino will work out when to charge the battery and when not. The readings are fine and independent of each other when not charging but when the relay is turned on and the current is flowing to the battery both readings are the same for battery and generator voltage.

Is there a way to read both battery and generator voltage separately when charging is enabled?
4  Using Arduino / Networking, Protocols, and Devices / Re: UDP packets fail to be sent. UDP collisions? on: June 15, 2012, 11:03:08 am
It can even send UDP data for about 10 minutes and then the 'L' LED comes on again and it will stop sending and vice versa. I wish i had a solution. It's very random when it works and i can't seem to change it. I wonder if its a problem with the shield?

It seems to be fine always receiving UDP packets.
5  Using Arduino / Networking, Protocols, and Devices / Re: UDP packets fail to be sent. UDP collisions? on: June 15, 2012, 10:29:35 am
I used the command prompt and typed ping 192.168.1.126 and i got the following:

Pinging 192.168.1.126 with 32 bytes of data:
Reply from 192.168.1.126: bytes=32 time=11ms TTL=128
Reply from 192.168.1.126: bytes=32 time=7ms TTL=128
Request timed out.
Reply from 192.168.1.126: bytes=32 time=3ms TTL=128

Ping statistics for 192.168.1.126:
    Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
    Minimum = 3ms, Maximum = 11ms, Average = 7ms

Then the green LED went dim and it started working :S I got this ping response:

Pinging 192.168.1.126 with 32 bytes of data:
Reply from 192.168.1.126: bytes=32 time=3ms TTL=128
Reply from 192.168.1.126: bytes=32 time=4ms TTL=128
Reply from 192.168.1.126: bytes=32 time=4ms TTL=128
Reply from 192.168.1.126: bytes=32 time=6ms TTL=128

Ping statistics for 192.168.1.126:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 3ms, Maximum = 6ms, Average = 4ms
6  Using Arduino / Networking, Protocols, and Devices / Re: UDP packets fail to be sent. UDP collisions? on: June 15, 2012, 10:08:21 am
I tried removing the SD card and changing the code to the following, but i still do not get UDP packets sent. Is there something else I'm missing?

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 1, 126);
unsigned int port = 12668;
EthernetUDP Udp;

IPAddress client(192, 168, 1, 9);

int i = 0;

void setup()
{
    pinMode(4, OUTPUT);
    digitalWrite(4, HIGH);
    
    Ethernet.begin(mac, ip);
    Udp.begin(port);
    delay(1000);
}

void loop()
{
    char holder[8];
    memset(holder, 0, sizeof(holder));
    itoa(i, holder, 10);
    
    Udp.beginPacket(client, port);
    Udp.write(holder);
    Udp.endPacket();
    
    delay(100);
    
    i++;
}

The 'L' LED is still lit up bright green. I understand what you mean by it glowing dim because on the occasion that the packets are sent out, i get the same.
7  Using Arduino / Networking, Protocols, and Devices / Re: UDP packets fail to be sent. UDP collisions? on: June 15, 2012, 09:54:49 am
@SurferTim

I do have an microSD in the slot, if i remove that will that stop the problem? I'll give it a try.

@pylon

'L' is not link on this board, thats at the other side of the RJ45 socket and that lights up fine. The problem even persists when theres no cable plugged in. I noticed on this board there is no collision LED and wondered if that's what the LED represented?
8  Using Arduino / Networking, Protocols, and Devices / UDP packets fail to be sent. UDP collisions? on: June 15, 2012, 09:26:47 am
I have recent bought an Ethernet Shield for the arduino for use in a renewable energy project. I have written a small test sketch which every 200 milliseconds sends a number which is incremented at the end of each loop. The problem I'm having is that sometimes (seeemly completely random) the packets will not send. I dont just mean missing a few i mean after one reset each one will send fine but then another time the USB cable is plugged in they wont send at all. I was wondering if some collisions or something is taking place. When theyre not sending a green LED marked 'L' on the shield comes on, but this can even happen when the ethernet cable is not plugged in. Is it a code error or a hardware error?

http://i.ebayimg.com/00/s/NjAwWDYwMA==/$(KGrHqN,!qsE88gcHj3HBPTfK+uBcQ~~60_12.JPG

The above link is a photo of the shield I bought its the top LED in the row of four marked 'L' that lights up when the loops fail to send UDP packets

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 1, 126);
unsigned int port = 12668;
EthernetUDP Udp;

IPAddress client(192, 168, 1, 9);

int i = 0;

void setup()
{
    pinMode(10, OUTPUT);
   
    Ethernet.begin(mac, ip);
    Udp.begin(port);
    delay(1000);
}

void loop()
{
    char holder[8];
    memset(holder, 0, sizeof(holder));
    itoa(i, holder, 10);
   
    Udp.beginPacket(client, port);
    Udp.write(holder);
    Udp.endPacket();
   
    delay(200);
   
    i++;
}
9  Using Arduino / Project Guidance / Re: Wind turbine charge controller prototype/shield on: May 19, 2012, 07:24:19 am
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?
10  Using Arduino / Project Guidance / Re: Wind turbine charge controller prototype/shield on: May 18, 2012, 12:44:35 pm
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
11  Using Arduino / Project Guidance / Re: Wind turbine charge controller prototype/shield on: May 17, 2012, 11:30:11 am
Quote
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.

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

--

Quote
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.
12  Using Arduino / Project Guidance / Wind turbine charge controller prototype/shield on: May 15, 2012, 02:52:09 pm
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!):


Code:
/*    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
}
13  Using Arduino / Networking, Protocols, and Devices / Re: Speed of any arduino wifi shield on: March 12, 2012, 03:00:18 pm
Quote
Not quite so fast, but fast enough, if you are not sending novels.

So if i'm sending say a few bytes ( < 8 ) 3 or 4 times a second, will the arduino be able to process them fast enough to make the control appear instantaneous?
14  Using Arduino / Networking, Protocols, and Devices / Speed of any arduino wifi shield on: March 12, 2012, 02:51:09 pm
I have not got alot of network programming knowledge but enough to program basic TCP clients/servers on windows and TCP clients on android. I am interesting in modifying an RC car to use an arduino with a wifi shield for control. Basic idea and alot of people have done it. I was wondering about the responsiveness and speed of a wifi shield with an arduino, when i send data using a program written on my android or pc, will the data be received virtually instantly, like i can accomplish between pc and pc or pc and android.

I'm sorry if there is a topic on this already, i have searched the forums and googgle but with little luck.

Thanks, Alex.
Pages: [1]