I am working through an existing system that uses an Arduino Nano to collect analog voltages from load cells. There are no comments in the code and two conflicting schematics but four working systems. My limited electronics skills have gotten me pretty far but I am stumped as to what the two diodes and resistor are doing here. (I have removed other connections from schematic for clarity) Nothing else is connected to
GND, D3, A7 and VIN but ARD 5V in one schematic is connected to a regulated 5V pin on a WIFI board.
(12V and 5V supplied simultaneously seems incorrect to me)
I agree. That schematic is a mess.
Depending on what else is powered from 5V, 12V to the Arduino might destroy it. If the 5V supply is good then Vin should not be used.
It may be an attempt to measure the 12V battery voltage or use that as a digital signal input. What does the code do with those pins?
Well, not to state the obvious but did you look up the datasheets for the diodes using google ?
Why do you suppose they have voltages listed for each of them ?
What could that possibly mean ?
I could tell you but I really think you should have at least googled their part numbers before posting.
Lack of experience is no excuse for lack of initiative to use Google.
You don't need an international forum to tell you what google could tell you in a second.
They are zener diodes but there is no reason why they should be required.
They have similar polarity but are separated by a 10k resistor between the 4.7v zener cathode
and the 9.1V anode. This might result in 4V across the resistor.
I have no idea why the resistor is installed from the digital pin to the analog pin.
The output voltage of a digital pin is normally
5V not 4.7V so it may be they wanted to
limit it to 4.7V and the 9V Zener may be intended
to limit the Vin to 9V to reduce the thermal
overhead caused by running the regulator on12V.
Not sure if that would work because the CL resistor
if the 9.1V zener is at 4.7V not GND and there's no
CL resistor for the 4.7Vzener.
The 10k should limit the current anyway since
it is in the current path from GND to Vin.
The problem with the circuit is a zener diode
is not going reduce a 12V battery
to 9V because the cathode is on the battery pos terminal so it looks like a simple case
of a newbie attempt at designing.
The resistor has to be between the pos terminal
and the cathode. My guess is there is 4.7V on the cathode
of the 4.7V diode but 12V on the cathode of the
9.1V diode.
Did you measure the battery
voltage ?
Add to the list of faults on the schematic: "Wrong symbols used for Zener diodes."
I agree, This can be useful. Thanks and appreciate.
There is a 12V battery connected to a series circuit of
a 9.1V zener, a 10K current limiting resistor, a 4.7V
zener and return ground. The zeners are 1.5 watt units.
The nominal zener voltage totals 13.8V. What bias current
will flow?
There is a 12V battery connected to a series circuit of
a 9.1V zener, a 10K current limiting resistor, a 4.7V
zener and return ground. The zeners are 1.5 watt units.
The nominal zener voltage totals 13.8V. What bias current
will flow?
You can't have 9.1V on the cathode of the 9.1V zener because there is no current limiting resistor
BETWEEN the 12V battery and the CATHODE of the diode.
Do you think that puny little diode is going to change the 12V battery voltage to 9.1V through
a 10k resistor ?
Look at this example circuit
What do you see ?
Is the cathode connected DIRECTLY to the power source or is there a resistor between them ?
Conversely , there IS a resistor BETWEEN the 4.7V zener CATHODE and the 12V power source so
(12V - 4.7V)/10000 ohms = 730uA
Its far better to measure that 12V rail with a resistor divider, say 22k:10k divider, 12V maps to 3.75V.
The zeners are inaccurate, and dangerous (if the 12V goes upto 18V, your Arduino is fried, the 22k in the resistive divider would protect the pin nicely.
Its far better to measure that 12V rail with a resistor divider, say 22k:10k divider, 12V maps to 3.75V.
I think you have shed some light on what the designer of this circuit was trying to do, although
I don't see how the 9.1V zener could have 9.1V on the ANODE. And then there is the problem
of no resistor between the cathode and the 12V battery, which prevents the diode from working
properly. I suspect there will still be 12V on the battery input to Vin. The problem is that the
analog input is connected to the ANODE of the 9.1V zener and the 4.7V zener cathode is on the
other side of the resistor so I believe the A0 pin will have 12V on it.
I've never tried swapping the zener and the current limiting resistor so while the current through
the zener path is 12V/10000 ohms = 1.2mA , I don't think a zener can have the zener voltage
on the anode. It's a case I never studied in school and never encountered at work.
The diode is a 2 terminal device. It does not care if there is 1000V on both pins.
The only thing that matters is the difference between the two terminals.
The diode is a 2 terminal device. It does not care if there is 1000V on both pins.
The only thing that matters is the difference between the two terminals.
And this means what ?
Does that mean there will be 9.1V on the ANODE ,
or, as I suspect, there will be 12V-9.1V = 2.9V
on the ANODE. It has to be one or the other.
?
With a perfect Zener, A7 (not A0) would be 9.1V below the voltage at Vin. 2.9V. Of course it's not perfect and it's being operated outside of its Zener range. There will be micro-amps or nano-amps flowing through the two diodes because 4.7+9.1 is greater than 12. The voltage across each diode will be something less than the nominal Zener voltage.
Even if D1 is a "better" Zener than D2 and develops its full voltage at that low current, the A7 pin can't get to 12V. It would be 4.7V maximum, since the current is so low that the voltage across R4 would be near zero.
Assuming that "12V" is an automotive system that gets to 14.2V in normal operation, then the two Zeners would be operating closer to their nominal Zener voltage. 14.2-9.1-4.7 = 0.4 volts across the resistor. That would mean there is a current of 40uA through the series string. Much lower than the nominal current required to reach the Zener voltage on any practical Zener diode. So the voltage drop across each Zener will be lower than the nominal voltage and the current through the resistor will be a bit higher.
I am guessing but it appears: D1 prevents a reverse voltage (about -0.7 or lower) from entering the arduino input. D2 appears to prevent A7 from going above the 12 volt supply by more then (0.7 Volts) and has a pull down resistor R4. I would expect there is another resistor feeding both D2 and D1. Both diodes limit the max voltage applied to the appropriate pin. R4 I would guess should be connected to ground in stead of D2 but it could also be set up to monitor the analog and digital state of the pin. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil
Do you it's a coincidence that 4.7+9.1=13.8 ?
What kind of "12V" battery has a fully charged voltage o 13.8V ?
You were close, except the cutoff boltage is 13.8V, not 12V, although that may be the intent ,
no zener diode is going to prevent a car battery from charging. Almost only counts with hand-grenades and H-bombs. People post here to get their problem "solved" , which, in my opinion is what Mark,
Larry, myself and a whole bunch of others strive to do. I don't think any newbies would have a
clue what you just said so I hardly think that is going to be much of a start. If you can't or won't solve any problems what is the point of responding ? You might as well retire completely instead of
half way. Throwing a bunch of mumbo jumbo at newbies is a waste of everyone's time and
it's frustrating for the newbies. If you're going to do something , do it right or don't do it at all.
I don't do all the work but I try to do all the heavy lifting. Sometimes I succeed , sometimes I
don't. Sometimes I have to wait for Mark or Wawa or Crossroads to save the day but sooner
or later the problem will get 'solved' and not just 'started'. What would a boss say if you told him you were
just there "to get him started" ?
Thank you all for the discussion. Yes, I'm a newbie to these forums and my PhD training is in
insect flight physiology not specifically in electronics. I've been asked to help build a new version
of the unit that the Arduino controls - a weigh scale for penguins at a breeding colony using four
load cells on the corners of a platform that they walk across. I'm volunteering because it is
interesting and the principle investigator is an old friend with no electronics skills. These units
were built by a grad student who is long gone to greener pastures designing drones...
I will re-read (for the fourth time) your posts and do appropriate testing where I can. The only
unit accessible to me is dead, the rest are in Argentina, many thousands of miles from here. I
have conflicting schematics, a dead unit, piles of undocumented software and the files that were
created when it was recording weights properly.
I started this thread because the sub-circuit in question looked suspect to my untrained eye. I see
from your posts that it isn't completely obvious what it is meant to do. I will add that the unit is
powered from a 12V, 10Ah sealed lead-acid battery, and that the Arduino, an RFID receiver, a Wifi
card and an SD card reader all share a common 12V input. However, the 5V pin on the Arduino
is also connected to the 5V input on the Wifi card - mystery. There is some surgery on the WiFi
card that I haven't really searched out yet but it may decouple the 12V and 5V inputs.
Again, thank you for your time. I will report back with results/progress.
I'm getting a handle on this based on your input and checking the code:
pinMode(BATTERY_MONITOR_CONTROL_PIN, OUTPUT);
delayMicroseconds(SENSOR_POWERUP_TIME_US);
battery = analogRead(A7);
battery = (analogRead(A7)+analogRead(A7)+analogRead(A7)+analogRead(A7)+2)>>2;
pinMode(BATTERY_MONITOR_CONTROL_PIN, INPUT);
currentFile.write(battery>>2);
This circuit is for measuring and recording the battery voltage on VIN.
Pin D3 gets set to HIGH (5V), some current at 0.3V gets through Diode 1 to GND,
no positive voltage gets through R4 to Pin 7. (V on the Pin 7 side of R4 should be 0)
Battery voltage over 9.1V on VIN gets through Diode 2 to Pin 7 (zero to 4.3V for
battery voltages from 9.1 to 13.4)
The measurement (battery) is the average of four analog reads plus 2 (why 2? this
gets erased by the right shift in the write statement and we aren't ever dividing...)
What gets written to the file is the 8 most significant bits of the 10 bit value.
Why is it important to have the "reference" of pin D3 set HIGH
when no voltage can get through the resistor to Pin 7?
I do like the idea presented by Mark T of a resistor divider...
The circuit in OP is quite clever but it can be made better.
To measure battery voltage you write pin D3 OUTPUT, LOW (not HIGH). Current flows through diode D2 and R1, generating Zener voltage on D2 and so pin A7 "sees" V_bat - 9.1V (nominal). When you return the pin to INPUT, nearly no current will flow through the circuit (maybe 1uA but probably less).
I don't know why D1 is used. Probably it is meant as a "protection". It can provide very little protection here. If you want real protection of the Arduino inputs place a resistor (about 1k) between A7 and D2 anode and a Schottky diode between A7 and Arduino's 5V (Shottky anode to A7).
Ofc the Zener voltage is temperature dependent and there is some part-to-part deviation so this is not for any precise measurements. But I think it is precise more than enough for battery measuring. Compared to a resistor divider it is slightly more complicated but uses less current (probably not important for you but may be for others) and uses higher range of the ADC so it has better resolution (probably not important as well).
The +2 is for rounding. The simple integer division by 4 (written as right-shift by 2) will simply cut off any fractional part of the number.
Consider 3 different sets of readings below, what is the average of each set of 4 readings?
Example 1:
1 0 0 0
Example 2:
1 1 0 0
Example 3:
1 1 1 0
In floating-point the averages are 0.25, 0.5 and 0.75.
You want the 0.5 and 0.75 to round up to 1. Add 0.5 to each average and then truncate the decimal part. Or, add 2 before dividing by 4.
Thank you both.
MorganS:
The +2 is for rounding.
While mathematically pure there is no real word reason to do the rounding.
