Hi,
I have setup a simple Voltage divider. I worked on 24Vin(max) and 5 Vout(max) with a current of 100uA. I worked out R1 = 47 kohm and R2 = 220 kohm. I measures the resistance of the resistors so the actual values are R1 = 45 kohm and R2 = 193 kohm.
The Vin is supplied by a solar panel, currently the voltage is 14.3V, Vout is 2.53, so the voltage divider is working fine.
I connect the Duemilanove, I have connect pin 0 to Vout. My sketch is as follows:
int SensorPin = 5;
int LEDPin = 13;
int reading = 0;
void setup ()
{
Serial.begin(9600);
pinMode(LEDPin, OUTPUT);
delay(500);
}
void loop ()
{
digitalWrite(LEDPin, HIGH);
reading = analogRead(SensorPin);
float voltage = (reading * 0.0048828125);
float SolarVoltage = (voltage * 4.8);
Serial.print ("Reading = ");
Serial.println (reading);
Serial.print ("Voltage = ");
Serial.println (voltage);
Serial.print ("Solar Voltage = ");
Serial.println (SolarVoltage);
delay (100);
Serial.println ("");
digitalWrite(LEDPin, LOW);
delay (5000);
}
The readings I get vary drastically, yet the voltage as displayed by the voltage meter does not, it remains constant. So I am rather perplexed how the Duemilanove is reading such extreme readings. Example of the reading are, the voltage meter is displaying 14.31 to 14.36 :
Reading = 1023
Voltage = 5.00
Solar Voltage = 23.98
Reading = 69
Voltage = 0.34
Solar Voltage = 1.62
Reading = 893
Voltage = 4.36
Solar Voltage = 20.93
Reading = 687
Voltage = 3.35
Solar Voltage = 16.10
Reading = 524
Voltage = 2.56
Solar Voltage = 12.28
Reading = 873
Voltage = 4.26
Solar Voltage = 20.46
Reading = 0
Voltage = 0.00
Solar Voltage = 0.00
Reading = 861
Voltage = 4.20
Solar Voltage = 20.18
Reading = 394
Voltage = 1.92
Solar Voltage = 9.23
Reading = 702
Voltage = 3.43
Solar Voltage = 16.45
Can someone please point me in the correct direction ?
Regards
Gregg