Help understanding a Zener diode as a voltage regulator

Thread Starter

ba58smith

Joined Nov 18, 2018
60
I am working with some small Arduino-like microcontrollers on my boat, which is mostly 12V DC. I want to detect when a bilge pump is on, by detecting the voltage on the wire to the pump. I want to do it with a resistor, a Zener diode, and a capacitor, as shown below. The wire on the right will go to an input pin on the Arduino, and the pin will read "HIGH" if the voltage is 3 to 5V. I have read all kinds of explanations of how this works, but none of them are in simple enough terms for this electronics newbie. So I would like to describe what I *think* happens in this circuit, and maybe someone here can either confirm it, or correct it. The current draw of the input pin of the Arduino clone I'm using is about 20mA, and should be very consistent.

BTW, I know there are lots of ways to regulate voltage, but that's not my question.

Here goes:
- Approx 12V comes in from the pump's wire, but it can be lower than 12V if the battery is low (should never be lower than 11V), or higher than 12V when the pump starts and stops (and probably some other reasons).

- The resistor drops the current to a safe level for the Zener. (I think 1k may be bigger than I need, though. Maybe a 330 would be enough?)

- The voltage reaches the Zener, and if it were only 4V, for example, it would just keep on going, because the Zener would block it from going to ground. But because it's higher than the 5.1 Zener voltage, any voltage in excess of 5.1 "forces its way" through the Zener to ground, because electricity always wants to go to ground, and the Zener allows some of it to do that. Only 5.1 keeps going towards the right (to my Arduino's input pin). This is the part that I'm really asking about with this question - is my layman's explanation correct, or at least close?

- The capacitor smoothes out the voltage that reaches it, before it continues on to the right. (That's about all I know about the capacitor in this circuit - I was advised to have it, but it wasn't explained very well why. I will research that some more.)

- The pull-down resistor doesn't do anything when there is voltage coming in from the pump. It makes the input pin read negative only when there is no voltage from the pump.

Thanks for any clarification, edification, etc. you may have to offer.

Zener diode circuit.png
 

MaxHeadRoom

Joined Jul 18, 2013
20,725
R1 is usually designed around the drop that will occur when the load is at maximum in order that the volt drop across the resistor will not exceed 6v in this case where the min supply is 11v.
IOW, when the supply is 11v you do not want the zener voltage to drop below 5.1v due to the load current causing too high a voltage drop across R1
So maximum load has to be known and allowed for with a slight margin.
Max.
 

wayneh

Joined Sep 9, 2010
16,390
I think you’ve got the gist of it. The R2 is there to discharge the capacitor when the voltage from the pump is removed. Otherwise, the Arduino would see it as still “on” until it discharged throughout the Arduino itself. The Arduino likely has a very high input impedance and that would take too long without R2 to speed it along.
 

Thread Starter

ba58smith

Joined Nov 18, 2018
60
R1 is usually designed around the drop that will occur when the load is at maximum in order that the volt drop across the resistor will not exceed 6v in this case where the min supply is 11v.
IOW, when the supply is 11v you do not want the zener voltage to drop below 5.1v due to the load current causing too high a voltage drop across R1
So maximum load has to be known and allowed for with a slight margin.
Max.
If I understand what I'm reading about the Arduino, the maximum load from the input pin is 40mA, and is always in the range of 10mA to 40mA. But honestly, as I think about it, I don't know how an input pin would draw any load at all. Maybe it's the current needed to activate the switch from LOW to HIGH?
 

MrChips

Joined Oct 2, 2009
21,161
Welcome to AAC!

You are on the right track.
Here is how you would calculate the value of the series resistance R1.

You take the maximum battery voltage and subtract the zener voltage.
Then you choose the maximum current required on the load side.
Let's use these numbers for simplicity:

max battery voltage = 15V
zener voltage = 5V
max load current = 10mA

R1 = (max battery voltage - zener voltage) / max load current = (15V - 5V) / 10mA = 10V /10mA = 1kΩ

Hence R1 = 1kΩ is good for a load of 10mA.

Now here is what happens. There will always be 10mA flowing through R1 when the battery voltage is 15V.
If the load takes 10mA, the zener will conduct 0mA.
If the load takes 0mA, the zener will conduct 10mA.

Hence the zener and the load together will share a total of 10mA.

Next, you need to calculate the power dissipated by R1 and the zener.
Power through R1 = 10mA x (15V - 5V) = 10mA x 10V = 100mW = 0.1W

Power through zener = 10mA x 5V = 50mW = 0.05W

Hence R1 = 1kΩ ¼W resistor (½W wouldn't hurt)

1N4733A 5.1V 1W zener is ok. (500mW would also do)
(Note that 1N4732A is 4.7V zener. Zener voltages are not sharply defined. At low currents the zener voltage will be lower than the nominal value.)
 

MrChips

Joined Oct 2, 2009
21,161
If I understand what I'm reading about the Arduino, the maximum load from the input pin is 40mA, and is always in the range of 10mA to 40mA. But honestly, as I think about it, I don't know how an input pin would draw any load at all. Maybe it's the current needed to activate the switch from LOW to HIGH?
Arduino input pin does not take 10mA to 40mA. Arduino pin takes virtually 0mA. You have to look at the specific Arduino board to see what signal conditioning is placed before the input pin, for example, any opto-isolators. This is what will require 10mA or more to be registered as an active input.
 

MaxHeadRoom

Joined Jul 18, 2013
20,725
Personally I would use the minimum voltage of the supply to calculate R1, otherwise you may get low voltage if the the resistor is calculated for the highest voltage.
Max.
 

MrChips

Joined Oct 2, 2009
21,161
Personally I would use the minimum voltage of the supply to calculate R1, otherwise you may get low voltage if the the resistor is calculated for the highest voltage.
Max.
You are right. (my brain freeze).
Use min voltage to calculate R1.
Use max voltage to calculate power dissipation.
 

Thread Starter

ba58smith

Joined Nov 18, 2018
60
Next, you need to calculate the power dissipated by R1 and the zener.
Power through R1 = 10mA x (15V - 5V) = 10mA x 10V = 100mW = 0.1W

Power through zener = 10mA x 5V = 50mW = 0.05W

Hence R1 = 1kΩ ¼W resistor (½W wouldn't hurt)

1N4733A 5.1V 1W zener is ok. (500mW would also do)
Watts? Now I have to calculate watts in this, too? Seriously - this is the first I've heard of a wattage rating on either resistors or zeners. (I don't get out much...) I'm sure I can find the ratings on mine (gotta be a datasheet somewhere), but what if all of my 1k resistors and my 4.7 and 5.1 Zeners are 1.0 watts? How might that impact what I'm trying to do?
 

MrChips

Joined Oct 2, 2009
21,161
Wattage dissipation is something that most of us tend to ignore.

Your situation is rather benign because you are drawing less than 0.15W . Hence 1W resistor and zener diode will give you plenty of head room. (A 1W resistor is a big sucker and much larger than what you need).

However, one of these days when your components keep burning up you will look back and remember this lesson, hopefully.
 

MaxHeadRoom

Joined Jul 18, 2013
20,725
The wattage of the resistor is calculated from the maximum volt drop occurring across the resistor and the resistor value to obtain wattage = VxI.
Max.
 

ebp

Joined Feb 8, 2018
2,332
Some background info on zeners that explains why what you may measure isn't quite what you were expecting:

What we routinely call zener diodes actually fall into two categories - "true" zeners (up to about 6 volts) and avalanche diodes (greater than about 6 V). The difference is in the actual physical mechanism of the "reverse breakdown" and doesn't really matter much in most uses, but ...

All of these voltage regulator diodes start to conduct some current below their nominal voltage and the "knee" of the curve that shows the relationship between the breakdown voltage and the current through the diode is rounded. Ideally, the curve would be a 90 degree angle - zero conduction below the nominal voltage and completely constant voltage above the nominal voltage. True zener diodes are worse than avalanche diodes in this regard. A 5.1 V zener might actually conduct tens of microamperes at 4 V and the voltage might not reach the nominal unless the current is several milliamps. This is quite distinct from the "tolerance" of the nominal voltage (e.g. ±5%) which is specified at a particular current. Diodes designed to handle low power will behave sort of proportionately better at low currents than diodes designed to handle higher power. A diode rated for 500 mW is going to be "better" than one rated for 1 W in this application.

For your circuit, a 5.1 V zener is a good choice. Just be aware that if R1 is selected for low current, the zener might allow the voltage to get to something a few hundred millivolts less than 5.1 V. That is prefectly OK in this case because the minimum voltage for HIGH for an input will be around 2/3 of the supply voltage for the Arduino (I'd have to check the datasheet for the actual specification). Knowing about this non-ideal behavior in the diodes will save you from trying to figure out why voltages you measure aren't what you thought they should be. R1 can be made really high because of that problem with conduction starting at a voltage well be low the nominal voltage of the diode.

Here's a datasheet for some small surface-mount zeners. I'm linking to it because it has much better graphs showing the relationship between voltage and current than most datasheets. The datasheets I can find for 1/2 and 1 watt common though-hole zeners are awful.
https://assets.nexperia.com/documents/data-sheet/BZX84_SER.pdf
 

Thread Starter

ba58smith

Joined Nov 18, 2018
60
Wattage dissipation is something that most of us tend to ignore.

Your situation is rather benign because you are drawing less than 0.15W . Hence 1W resistor and zener diode will give you plenty of head room. (A 1W resistor is a big sucker and much larger than what you need).

However, one of these days when your components keep burning up you will look back and remember this lesson, hopefully.
My components will keep burning up because I haven't used components with a high enough wattage rating, or because I've used too high a wattage rating? In this particular case - a 1W resister is OK because the draw on the circuit is less than 0.15W, but a 0.50W resistor would be OK, too, and it would be physically smaller? I want to understand what lesson I'm learning.
 

MrChips

Joined Oct 2, 2009
21,161
Yes, it is like trying to lift a 1000kg load with a cable rated for 500kg.

You need to derate your components. Use 0.5W component when it needs to dissipate 0.25W or less.
Similarly, use a capacitor rated to handle 25V if it is going to experience only 12V.
 

ian field

Joined Oct 27, 2012
6,539
I am working with some small Arduino-like microcontrollers on my boat, which is mostly 12V DC. I want to detect when a bilge pump is on, by detecting the voltage on the wire to the pump. I want to do it with a resistor, a Zener diode, and a capacitor, as shown below. The wire on the right will go to an input pin on the Arduino, and the pin will read "HIGH" if the voltage is 3 to 5V. I have read all kinds of explanations of how this works, but none of them are in simple enough terms for this electronics newbie. So I would like to describe what I *think* happens in this circuit, and maybe someone here can either confirm it, or correct it. The current draw of the input pin of the Arduino clone I'm using is about 20mA, and should be very consistent.

BTW, I know there are lots of ways to regulate voltage, but that's not my question.

Here goes:
- Approx 12V comes in from the pump's wire, but it can be lower than 12V if the battery is low (should never be lower than 11V), or higher than 12V when the pump starts and stops (and probably some other reasons).

- The resistor drops the current to a safe level for the Zener. (I think 1k may be bigger than I need, though. Maybe a 330 would be enough?)

- The voltage reaches the Zener, and if it were only 4V, for example, it would just keep on going, because the Zener would block it from going to ground. But because it's higher than the 5.1 Zener voltage, any voltage in excess of 5.1 "forces its way" through the Zener to ground, because electricity always wants to go to ground, and the Zener allows some of it to do that. Only 5.1 keeps going towards the right (to my Arduino's input pin). This is the part that I'm really asking about with this question - is my layman's explanation correct, or at least close?

- The capacitor smoothes out the voltage that reaches it, before it continues on to the right. (That's about all I know about the capacitor in this circuit - I was advised to have it, but it wasn't explained very well why. I will research that some more.)

- The pull-down resistor doesn't do anything when there is voltage coming in from the pump. It makes the input pin read negative only when there is no voltage from the pump.

Thanks for any clarification, edification, etc. you may have to offer.

View attachment 163998
This is probably worth a read for a bit more background on the subject:- http://people.seas.harvard.edu/~jones/es154/lectures/lecture_2/breakdown/breakdown.html
 

Thread Starter

ba58smith

Joined Nov 18, 2018
60
This is probably worth a read for a bit more background on the subject:- http://people.seas.harvard.edu/~jones/es154/lectures/lecture_2/breakdown/breakdown.html
Thanks, Ian Field... but reading articles like that one (of which I've read at least a dozen now) is what prompted me to post my question here, asking for a layman's description. I know I need to understand SOMETHING about electronics to work with them even at the hobbyist level, but when they start talking about "impact ionization of electron-hole pairs", my eyes glaze over.
 

Thread Starter

ba58smith

Joined Nov 18, 2018
60
Some background info on zeners that explains why what you may measure isn't quite what you were expecting:
Thanks, ebp - while that's mostly over my head, the graph that shows forward current and forward voltage makes sense.
 

ian field

Joined Oct 27, 2012
6,539
Thanks, ebp - while that's mostly over my head, the graph that shows forward current and forward voltage makes sense.
Its essentially a diode with lots of reverse leakage - which (hopefully) always has a stable repeatable voltage point.

They drop more voltage backwards, so it doesn't take much current to exceed its dissipation rating.

With the 15V 100W Zener used on old British motorcycles - you could do someone quite a mischief by throwing one at them.
 
Top