Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

Possible Duplicate:
Arduino has an input value in disconnected pin

I wish to measure the voltage of a 1.5V battery using a microcontroller (supply voltage of 3V).

I thought of connecting the battery on the ADC4 input of the microcontroller, and wrote a program which reads the ADC4.

Initially, I programmed the microcontroller without connecting the battery to ADC4. I was expecting to get a value of 0V (nothing connected to ADC4), but I didn't. Instead, I am getting a higher value which is also fluctuating. I tried to measure the voltage on ADC4 with a voltmeter, but I can't get a reading since it is obviously fluctuating. Why is that happening?

share|improve this question
1  
See also this question. – stevenvh Aug 9 '12 at 17:45

marked as duplicate by W5VO Aug 9 '12 at 15:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

You are picking up noise, pretty much like a radio receiver does, but on a lower frequency. If you closely look at the values you measure, you will recognize the 60 or 50Hz mains in it.

Easiest way to get rid of it is to attach a resistor to ground, you want a slight load when measuring the battery anyway. 10k\$\Omega\$ will probably get rid of the noise. Depending on the battery you might want to change it to a lower value to give it some load.

share|improve this answer
That sounds interesting! I wouldn't have guessed it. So, how should my set-up look like? ADC4 - battery - 10K - ground? Is that right? And how could I measure 0V on ADC4 (without the battery)? – user11395 Aug 9 '12 at 15:45
10k\$\Omega\$ from ADC4 to ground, parallel to where you want to measure your battery. – jippie Aug 9 '12 at 17:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.