Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

measure battery voltage with microcontroller

Status
Not open for further replies.

joskem

Junior Member level 3
Joined
Feb 28, 2010
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,497
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 output 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?
 

I have set up the reference voltage to be AVcc / AVss. I measured these voltages using a voltmeter as 2.91V and 0V respectively.
 

No, all I have done is to measure the voltages on the pins. I was expecting ADC4 to read 0V, however the voltmeter does not indicate any value, meaning that it is not dc, but rather a fluctuating waveform.. I was wondering why this is happening.
 

may be you have a problem with your power supply, or you are in a terrible EMF "soupy" environment. try the pull down resistor.
what kind of mcu are you using in this project?
 

It is an MSP430F1611.. Since I am all new to microcontrollers, how should I use the pull down resisotr? And would it be the same if I used a regular 10K resistor?
 

Thanks! So, I will just connect a 10K resistor between the ADC and the ground.. Should I do something similar when I try to measure the voltage of the battery? (i.e. ADC4 - battery - 10K - ground)?
 

you have to drop the voltage across a resistance to measure it. that is what i meant with the pull down resistance. ADC4 - battery - 10K - ground is the thing. If you remove the battery, the adc will get 0v and then a 0 v reading will be given. reference voltage is also another criteria, connect it with a capacitor i.e. like a .01 uf (if you still have the fluctuations) : adc ref pin <---> cap <-----> ground. and then give the reference voltage.
 
  • Like
Reactions: joskem

    joskem

    Points: 2
    Helpful Answer Positive Rating
thank you very much!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top