• AVR Freaks

Helpful ReplyHot!Zener Diode for Reference ADC Voltage

Author
yta170030
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/06/19 22:41:11
  • Location: 0
  • Status: offline
2019/06/24 14:43:43 (permalink)
0

Zener Diode for Reference ADC Voltage

Hello,
I am powering a pic16f777 with ~3 volts (2 1.5V AAA batteries) and looking to generate a reference voltage for my 10 bit ADC with a single zener diode and a resistor.
Would it be correct to connect a zener diode such that: VDD->resistor->diode->VREF+ and VSS->diode->VREF- and then divide my ADC reading by the  zener voltage and multiply by 1024?
 
I have attached a schematic to describe the connections better.
 
Thank you for your help.

Attached Image(s)

#1
ric
Super Member
  • Total Posts : 22758
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Zener Diode for Reference ADC Voltage 2019/06/24 15:20:36 (permalink)
0
Is this design too cost critical to use a real voltage reference IC rather than just a zener?
e.g. LM336
https://www.digikey.com.au/product-detail/en/on-semiconductor/LM336Z25/LM336Z25-ND/1050101
 
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#2
Bob White
Super Member
  • Total Posts : 256
  • Reward points : 0
  • Joined: 2010/11/06 19:52:38
  • Location: Denver, Colorado
  • Status: offline
Re: Zener Diode for Reference ADC Voltage 2019/06/24 19:09:04 (permalink)
0
This depends a lot on what kind of error you can accept, which translates into what tolerance in the Zener voltage can you accept?
 
One issue with low voltage Zener diodes is that the voltage-versus-current curve is very "soft".  That is the voltage does know limit sharply at the Zener diode's rated voltage.  Also, check the current at which the voltage is rated.  If you are operating from a batter can you afford 5 or 10 or 20 mA of current to bias the Zener diode properly?

Although the cost is higher, an IC voltage reference (as suggested in the previous post) is a much better solution.  There are lots choices with ranges of voltages and the minimum current needed for biasing.  The previous poster mentioned the LM336, a very similar and very common IC is the TL431.  Both require 1 mA to meet the specified voltage tolerance.
#3
ric
Super Member
  • Total Posts : 22758
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Zener Diode for Reference ADC Voltage 2019/06/24 19:14:52 (permalink)
0
Indeed, the TL431 is exactly the same price as the LM336.
https://www.digikey.com.a...Z/497-13128-ND/1039982
They have almost identical specs, and may well be the same part internally.
post edited by ric - 2019/06/24 19:19:57

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#4
yta170030
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/06/19 22:41:11
  • Location: 0
  • Status: offline
Re: Zener Diode for Reference ADC Voltage 2019/06/24 20:14:53 (permalink)
0
Thanks for the suggestions everyone, they are all much appreciated. I think I'll use an IC--the TL431 looks promising.

A quick question:

On looking at the TL431 datasheet, there are ratings for Minimum cathode current for regulation (0.5mA),
and Reference input current (1.8ua).
What is the difference between these two categories? If I connected the IC as shown in the attached schematic, would I consider the resistor value to limit current to 0.5mA or 1.8 microamps?
post edited by yta170030 - 2019/06/24 20:18:31

Attached Image(s)

#5
Bob White
Super Member
  • Total Posts : 256
  • Reward points : 0
  • Joined: 2010/11/06 19:52:38
  • Location: Denver, Colorado
  • Status: offline
Re: Zener Diode for Reference ADC Voltage 2019/06/24 20:19:56 (permalink) ☄ Helpfulby yta170030 2019/06/24 21:05:04
+1 (1)
Note that with either the TL431 or LM336 you must connect the ADJUST/REFERENCE pin to the CATHODE.
You don't need 5 mA.  Save your battery life and only bias the IC with 1 mA.  Set the resistor to supply 1 MA plus whatever current is needed by the load attached to the cathode (which it is the reference for A/D converter should not be much).
 
Also take note of the permitted bypass capacitance on the TL431.  I can either be small or large but there is middle ground where the device becomes unstable.
#6
ric
Super Member
  • Total Posts : 22758
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Zener Diode for Reference ADC Voltage 2019/06/24 20:21:36 (permalink) ☄ Helpfulby yta170030 2019/06/24 20:47:52
+1 (1)
The amount of current the battery can produce is irrelevant to the reference, it's the maximum voltage that matters.
A fully charged alkaline battery will be about 1.6V per cell, so you may have 3.2V total.
If the reference is 2.5V, then you will have 3.2 - 2.5 = 0.7V across the series resistor, so the minimum value of the resistor is 0.7V / 10 mA = 70 ohms
At 50% charge, the batteries will be down to 1.3V, so there will only be about 2.6 - 2.5 = 0.1V across the resistor, so to maintain at least 1mA your max value is 0.1V / 1mA = 100 ohms
 
You can recalculate yourself if your end voltage is different to what I guessed.
 
Edit: I see the question in post#5 changed after I answered it, so you realised the battery current didn't matter.
post edited by ric - 2019/06/24 20:33:36

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#7
yta170030
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/06/19 22:41:11
  • Location: 0
  • Status: offline
Re: Zener Diode for Reference ADC Voltage 2019/06/24 20:37:03 (permalink)
0
Bob, thanks for the quick reply.
From what I understand (I have attached a schematic): The reference pin of the TL431 should connect to the cathode of my battery pack ( (-) terminal ), the anode of the TL431 should be connected to a resistor to my A/D reference pin and the cathode of the TL431 should be connected to the anode (+ terminal) of my battery pack?
 
For the resistor: 1mA for the TL431, and 15mA for the ADC Ref pin=16mA, which would be a 200 ohm resistor at 3 volts?

Attached Image(s)

#8
ric
Super Member
  • Total Posts : 22758
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Zener Diode for Reference ADC Voltage 2019/06/24 20:43:29 (permalink) ☄ Helpfulby yta170030 2019/06/24 21:05:18
+2 (2)
yta170030
...
From what I understand (I have attached a schematic): The reference pin of the TL431 should connect to the cathode of my battery pack ( (-) terminal ), the anode of the TL431 should be connected to a resistor to my A/D reference pin and the cathode of the TL431 should be connected to the anode (+ terminal) of my battery pack?

No, that's all backwards.
Look at "Figure 7. Test circuit for VKA = Vref" in the datasheet.
There is a single resistor, from Batt+ to cathode and reference pins, which are connected together and to the ADC ref input. The Anode is connected to Batt- which is ground.
 
It is VERY similar to the Zener diode connection with the extra pin connected to the cathode.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#9
yta170030
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/06/19 22:41:11
  • Location: 0
  • Status: offline
Re: Zener Diode for Reference ADC Voltage 2019/06/24 20:48:29 (permalink)
0
Thanks for the example-that was very helpful.
My batteries are a little old and are 2.8V now as a pack. 2.8V source-2.5V reference for the IC=0.305V.
1mA for the TL431, and 15mA for the ADC Ref pin=16mA, so 0.305V/0.016=a 19 ohm resistor?
#10
PStechPaul
Super Member
  • Total Posts : 2303
  • Reward points : 0
  • Joined: 2006/06/27 16:11:32
  • Location: Cockeysville, MD, USA
  • Status: offline
Re: Zener Diode for Reference ADC Voltage 2019/06/24 20:49:19 (permalink)
0
A reference IC is probably best, but another option is to use a white LED, which has a fairly stable forward drop of 2.5-2.8 volts or so with current of 100 uA to several mA, and it also doubles as a visual power on indicator.

 
#11
ric
Super Member
  • Total Posts : 22758
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Zener Diode for Reference ADC Voltage 2019/06/24 20:51:29 (permalink)
0
yta170030
 15mA for the ADC Ref pin=16mA, so 0.305V/0.016=a 19 ohm resistor?

Where do you get 15mA for the REF pin from? That would be impossible to work with.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#12
yta170030
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/06/19 22:41:11
  • Location: 0
  • Status: offline
Re: Zener Diode for Reference ADC Voltage 2019/06/24 20:57:33 (permalink)
0
ric
yta170030
...
From what I understand (I have attached a schematic): The reference pin of the TL431 should connect to the cathode of my battery pack ( (-) terminal ), the anode of the TL431 should be connected to a resistor to my A/D reference pin and the cathode of the TL431 should be connected to the anode (+ terminal) of my battery pack?

No, that's all backwards.
Look at "Figure 7. Test circuit for VKA = Vref" in the datasheet.
There is a single resistor, from Batt+ to cathode and reference pins, which are connected together and to the ADC ref input. The Anode is connected to Batt- which is ground.
 
It is VERY similar to the Zener diode connection with the extra pin connected to the cathode.


Again, thank you very much for the help--it really is appreciated (I'm fairly new to electronic components so thanks for putting up with my questions!).
The correct connections would thus be: Battery +-->a resistor-->both the reference and cathode of the IC
battery (-)->IC anode?
#13
ric
Super Member
  • Total Posts : 22758
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Zener Diode for Reference ADC Voltage 2019/06/24 21:03:17 (permalink)
0
Yes, that is what I said in my third sentence.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#14
yta170030
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/06/19 22:41:11
  • Location: 0
  • Status: offline
Re: Zener Diode for Reference ADC Voltage 2019/06/24 21:03:25 (permalink)
0
ric
yta170030
 15mA for the ADC Ref pin=16mA, so 0.305V/0.016=a 19 ohm resistor?

Where do you get 15mA for the REF pin from? That would be impossible to work with.


The pic16f777 data sheet states that the Maximum output current sunk by any I/O pin is 25mA. Are my numbers wrong because the reference pin does not count as an IO pin, or because I could be using anywhere from 1 to 15mA for the reference pin in that calculation?
#15
ric
Super Member
  • Total Posts : 22758
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: Zener Diode for Reference ADC Voltage 2019/06/24 21:07:13 (permalink)
0
The maximum of 25mA is telling you what level you should not exceed when using the pin as an output.
It has nothing to do with how much current is required to drive the pin as an input, which will be minuscule.
 
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#16
Jump to:
© 2019 APG vNext Commercial Version 4.5