So I have a project in which I test the voltage of AAA batteries. Basically its a product line scenario where batteries are tested for their correct voltage before being packed. I am new to electronics and was not sure hot to read the voltage, through some research I learnt that I might be able to do this by using an ADC and monitoring the resolution. The Arduino Mega supplies 5v and the batteries are 1.5V so I read that I must apply a Voltage divider. The schematic I found is the following. (see attchment - voltagedivider)
So I hooked up the setup onto a breadboard (see attachment - sensor)
and used the following code to check the resolution
int sensePin =0;
void setup ()
void loop ()
On the breadboard view, there are two black leads which the battery is connected across, when i touch them together a resolution of 308 is given, which would equal 1.5V, however when I put a battery in between I get all kinds of resolution. cant help but think I have not grasped the concept because clearly something is wrong.