Test Results On AD Using Supply Rail Reference

mrburnette

Senior Member
Analog to Digital is one of the microcontroller's strengths: Inexpensive, flexible, and rather accurate 10-bit resolution. This blog is simply a telling of what happened when I documented testing using a PICAXE08M2+ using the Vdd voltage as the analog reference voltage.

Consider two 10K resistors in series between Vdd and Vss (+5 and Gnd.) Ohm's Law tells us that the junction of the two resistors will be one-half the supply voltage and if we feed that into the PICAXE AD input and request a ReadADC10, we should get approximately half of the full-scale 1024 bits from the converter.

Hardware notes:
Circuit constructed on solderless breadboard
Bulk capacitor on breadboard = 100uF
Bypass capacitors on breadboard = 100nF x 2

The program:
Code:
; 22 bytes
; by M. Ray Burnette 20120731
;
#Picaxe 08M2				; PICAXE 08M2+ used in prototype
#Terminal 4800
;#no_data

Symbol ADval = w0				; b1:b0
Symbol Channel = 4			; 08M2 Physical PIN#3, Port C.4

Do
  Pause 1000
  ReadAdc10 Channel, ADval	; AD value
  sertxd("AD =",#ADval, CR, LF)
Loop
What I found surprising was the stability of the digital results as the lab power supply and my Fluke multimeter showed the voltage being lowered until the PICAXE stopped working.

INPUT VDD / ReadADC10 Value
5.10 / 513
5.00 / 513
4.90 / 513
4.80 / 513
4.70 / 513
4.60 / 513
4.50 / 513
4.40 / 513
4.30 / 513
4.20 / 513
4.10 / 513
4.00 / 513
3.90 / 513
3.80 / 513
3.70 / 513
3.60 / 513
3.50 / 513
3.40 / 513
3.30 / 513
3.20 / 513
3.10 / 513
3.00 / 513
2.90 / 513
2.80 / 513
2.70 / 513
2.60 / 513
2.50 / 513
2.40 --- PICAXE Stopped Functioning ---
Jitter note: The 513 reading was very stable but an occasional 512 would show, but only for one display; that is, never two in sequence before returning to 513.

I had to remove one of the resistors midway through my test just to be certain that the AD was actually performing! It was.

But I performed the same test on an ATmel ATtiny85. The results were run twice, once with the Brown Out Protection set to 4.3V and once with the BOD disabled. The results are:

BOD AT 4.3V
5.10 / 512
5.00 / 512
4.90 / 512
4.80 / 512
4.70 / 512
4.60 / 512
4.50 / 512
4.40 / 512
4.30 / 512
4.20 / 512
4.10 ATtiny85 Stopped Functioning
And I ran the sketch again with BOD disabled:
5.00 / 512
4.50 / 512
4.00 / 512
3.75 / 513
3.50 / 514
3.25 / 514
3.00 / 514
2.75 / 514
2.50 / 515
2.25 / 516
2.00 ATtiny85 Stopped Functioning
So, the take-away from the testing reveals that for battery powered circuits, if you have a simple use for AD such that you are using a voltage-divider network (LDR, Thermistor, Resistor-Resistor) and the voltage divider is rail-to-rail on the power bus, then you can expect fairly good stability as the external supply voltage decreases as the battery depletes. Additionally, you may be able to save precious battery current by eliminating the normal voltage regulator and using one or two silicon diodes to drop the voltage within the PICAXE operating range (assuming 4-cell AA/AAA packs.)

- Ray

notes: just FYI... comments are not being accepted on this blog entry... Sorry.:(
 
Top