Hi all -
I'd like to use my Arduino as a basic voltmeter. I'm building a blimp and need to monitor the battery. I am using The MathWorks' ArduinoIO API, which essentially gives me the same functions as is naively available on the Arduino if I wrote in embedded C.
I have a 12V battery and using three 2kOhm resistors to build a voltage divider. I tied analog pin 5 of my Duemilanove to the last resistor in the circuit; a voltmeter verifies that the voltage across the last resistor is 4.14V.
I expected an analogRead() against that pin would give a reading of about 847, but this value is constantly jumping inside a range of 350 to 500.
Connecting the pin to AREF and trying an analogRead() gives me 1023, and connecting it to GND gives me 0, as expected.
So I'm not sure what's wrong with my circuit - am I missing something here? I thought this should be a pretty simple task..
Thanks for the help!