View previous topic :: View next topic |
Author |
Message |
zonemikel
Joined: 13 Oct 2007 Posts: 53 Location: Texas
|
ADC accuracy degrades quickly with battery |
Posted: Wed Oct 31, 2007 8:54 am |
|
|
Hello ppl,
Thanks again for your previous help. I have a nice module that reads a analogue value and transmits it via serial and displays it on a screen.
I wanted to test to see how long it would last on a 9v battery, the 9v goes to a 5v regulator and to the pic/7 seg/ leds/ etc. I bought the cheepest batteries they were 2 9v for $1. I got the cheep ones because i was just going to run them till they ran out.
Anyway it reads the ADC conversion fine for about a hour then the adc conversion starts climbing. It will just slowly continue to go up. The reading should be about .80v and it gets up to like 1.19v. At this point if i plug in a good battery it works fine. If you guys need the code ill post it.
What im thinking is since the conversion goes from 10 bit adc it assumes that 5v = 1023 so when this value decreases the value of whatever your reading gets inflated. I believe the vref is the power that goes into the pic.
One more thing, the module stayed on for a good 12hours then i turned it off. So it will continue to function for a very long time, but the ADC reading is off.
tia
-zonemikel |
|
|
bwhiten
Joined: 26 Nov 2003 Posts: 151 Location: Grayson, GA
|
Regulator output? |
Posted: Wed Oct 31, 2007 10:12 am |
|
|
What PIC are you using?
Did you monitor the output of the regulator? If that is still a constant 5 volts you shouldn't have a problem. Using a 3.3V PIC and LDO style regulator with the 9V input would allow for much longer operating time IMO. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Wed Oct 31, 2007 11:15 am |
|
|
There's a way to compensate for the falling supply rail. Create a zener diode voltage reference circuit (say approx 2.5V or something like that) and monitor this voltage with a spare A/D input on your PIC.
Just before you take an A/D reading (of whatever you are reading), read the voltage from the zener reference. When that reading starts to rise, the Vdd supply rail is falling. Based on the full power zener reading and the amount it has risen from that value, you can calculate what the actual supply rail is. You can use this value to compensate your other reading.
You can also put a FET in the zener reference circuit and use the PIC to turn the FET on/off to conserve battery power. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
zonemikel
Joined: 13 Oct 2007 Posts: 53 Location: Texas
|
Re: Regulator output? |
Posted: Thu Nov 01, 2007 8:29 am |
|
|
Quote: | There's a way to compensate for the falling supply rail. Create a zener diode voltage reference circuit (say approx 2.5V or something like that) and monitor this voltage with a spare A/D input on your PIC.
Just before you take an A/D reading (of whatever you are reading), read the voltage from the zener reference. When that reading starts to rise, the Vdd supply rail is falling. Based on the full power zener reading and the amount it has risen from that value, you can calculate what the actual supply rail is. You can use this value to compensate your other reading.
You can also put a FET in the zener reference circuit and use the PIC to turn the FET on/off to conserve battery power. |
I really like this idea I dont know why i didnt think of it. If i have a known voltage and put that to a pin then i can use it to get the difference. For instance if i set up a known 1v circuit to RA1 then i would know that this should always be 1v so before i take my reading i would read RA1 and if it isnt 1v i would take the difference between 1v and whatever reading I get then subtract/add that to whatever I'm reading on RA0.
I'm not to worried about conserving battery power. I left the thing running for a good 12 hours on a .50c battery and it ran but did not accurately display the right ADC conversion. All i was trying to do is get it to be accurate for more of its life, if it stays on for 12hrs+ i want it to work correctly for at least part of that.
With y'alls tips I'm sure I'll be able to work something out, thanks.
bwhiten wrote: | What PIC are you using?
Did you monitor the output of the regulator? If that is still a constant 5 volts you shouldn't have a problem. Using a 3.3V PIC and LDO style regulator with the 9V input would allow for much longer operating time IMO. |
Its a 877- 04 in 44pin plcc socket. I have to take a real close look at the regulator, it might be failing and/or it might be pulling a lot of current.[/quote] |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Thu Nov 01, 2007 9:05 am |
|
|
Quote: | I really like this idea I dont know why i didnt think of it. If i have a known voltage and put that to a pin then i can use it to get the difference. For instance if i set up a known 1v circuit to RA1 then i would know that this should always be 1v so before i take my reading i would read RA1 and if it isnt 1v i would take the difference between 1v and whatever reading I get then subtract/add that to whatever I'm reading on RA0. | Nice idea, but why do it in software if you can do it in hardware? By default the A/D converter of the PIC16F877 uses Vdd as the reference voltage. You can also choose to supply your own (zener generated) reference voltage to pin A3 and than the hardware will do the calculations for you. |
|
|
bwhiten
Joined: 26 Nov 2003 Posts: 151 Location: Grayson, GA
|
Regulator output |
Posted: Thu Nov 01, 2007 9:23 am |
|
|
Most importantly to me is you don't want the output from the regulator to be dropping below it's rated output. If it is that means you are no longer operating the device within it's specifications. At that point, most of the rest of it's specs are also out the window, such as ripple, load regulation, operating temperature, power dissipation, etc. An LDO regulator will let your input voltage drop much closer to the rated output before failing. I don't know what else is running on the regulator output but an unstable (drooping) output will have a negative impact on most circuitry. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Thu Nov 01, 2007 9:55 am |
|
|
Be careful with the calculation. It's not an add or subtract issue, it's a scaling issue (multiply/divide). |
|
|
|