Arduino Mini , problem with Voltage read

Hi,

I am using a voltage divider so I can monitor the voltage a 3cell lipo.

The problem is that the SerialRead gives 1023 (max) even when the voltage is at 2.19V across Arduino Gnd and Arduino A0

So I am dropping the voltage from ~10 to 2.19 but the arduino reads 5V (ie 1023)

I have attached a schematic of my setup.

I suppose the problem might be that I need a reference voltage, as maybe one from the board the 5V? In that case how would I need to wire it to correct the serialRead.

Here is my code as well:

const int analogPin=A0;
int val=0.0;
void setup(){
Serial.begin(9600);
}

void loop(){
val=analogRead(analogPin);
Serial.println(val);
}

What I am trying to do is use the mini to monitor voltage of a lipo and then will hook up a relay to switch off the circuit if the voltage drops below a certain value. I am using the mini so I can save as much weight as possible. Not sure if there is another board that could do the same thing with less weight maybe?

Thanks, and I think this is my first post in this forum too :slight_smile:

  1. Please use code tags when posting code.

  2. Try changing the first 2 lines to:

const int analogPin=0;
int val=0;

A0 is what you call analog pin 0 when you are using it as a digital pin. It's just 0 when you are using it in an analogRead call. I don't know whether calling A0 will work in that context.

  1. If your voltage divider is 4K to +10V and 4.7K to ground as indicated in your diagram, then the voltage at the centre won't be below 5V. Check your calculations.