Hi,
I have a solar panel which voltage output I'd like to measure. It is capable of producing 18.50 V at maximum.
I know that the my Aardu can only have 5 volts as an analog input.
I have created a resistor circuit to make the voltage drop below 5 volts. Image is attached.
I measured the voltage with a multimeter just to make sure and it gives voltage below 5 volts. Cool.
By the way, the Arduino is powered via USB.
I'd like to print the read voltage to a serial port so I wrote the following code:
void setup()
{
Serial.begin(9600);
}
void loop()
{
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.0);
Serial.println(voltage);
delay(1000);
}
When I wire the ardu and the resistor circuit together, which is connected to the solar panel, the analog pin does not seem to read values for it always prints 0.00.
Can you advise me what am I doing wrong?
Thanks