Go Down

Topic: My findings on my first quasi serious Due project (Read 1 time) previous topic - next topic

TheRevva

I'll start with a quick synposis of what went wrong.  There's WAY more detail below!
1: The 'strength' of the on-chip pullup resistors was insufficient to achieve a truly solid '1' on my input pins
2: With the proto shield in place, the Due would refuse to correctly reset on power up
---
Now for the gory details

I completely bypassed all the Arduino IDE and wrote the requisite code to totally control all aspects of the SAM.
(That, in itself is rather a long story best left for some other time... LOL)

1:
I'm using the Due in an automotive environment with 4 * on/off switch inputs, 1 * analog (simple pot) input and 5 * digital outputs.  In order to avoid 'letting out the smoke' if some idiot (that'd be ME) accidentally connected an input to the car battery, I included some voltage clamps on the input pins.  While I've seen designs where inputs are clamped to the CPU supply rail, I tend to dislike this method since it CAN easily cause the supply rail to overshoot to abs max value on the datasheet.  Therefore, I individually clamped each input pin to ground with a separate 3v3 zener (and series resistor) on each input pin.
The pot input is a simple voltage divider.  One side to ground, the other side to supply and the wiper is the analog input.  Being a paranoid person, I zener clamped both the wiper input and the supply output to the pot.  I can connect the car battery to ANY of the input(s) without letting out the magic smoke!
The inputs switches simply switch to ground, so there is a need for a pull up resistor and I had thought that the internal (100k nominal) pull up resistors would do the job, but they couldn't quite make it.  (It seems that the 'reverse leakage' through the zener diode input voltage clamps was enough to pull down the signal so much that it was, at best, unreliable).  Put simply, the zener leakage was pulling the voltage at the CPU pin down to a point very near the minimum on the 0.7*Vcc minimum on the datasheet.  Simply adding a separate 10k pull up resistor to each input gave me a nice strong signal.
2:
The second issue was that the Due simply refused to power up properly.  It worked fine as a standalone Due, but as soon as I connected the shield, it would stubbornly refuse to reset much of the time.  (However, the reset button would ALWAYS work to get things running).
I took a quick look at the reset components on the Due schematics in conjunction with the datasheet...  The MASTER-RESET signal (which is connected directly to NRSTB on the SAM) is tied to 3v3 via C20 which is a 10nF cap and is switched to ground by the reset switch.  Within the SAM there's a pull-up resistor (nominal 15k) on the NRSTB pin.  The SAM processor is asynchronously reset whenever it detects a '0' on NRSTB, so I went through the logic of a truly 'cold' power up.
Prior to applying power, C20 would be fully discharged..  As soon as the 3v3 rail was powered, both plates of C20 would jump to 3v3.  One plate is directly tied to the 3v3 rail, and the other to the NRSTB pin with its 15k pull up.  In real terms, it doesn't DO too much at all.  (OK, that's not 100% accurate, but I trust y'all get my point).
In order to get a solid RESET into the chip, I threw a 10uF capacitor with 1k resistor in series from the MASTER-RESET signal to ground.  This HUGE capacitance (compared to C20) serves to hold the MASTER-RESET signal low until the 10uF cap charges up via the pull up resistor associated with the NRSTB pin.  (The 1k resistor is simply to limit current to an 'acceptable' level when the 3v3 supply rail falls to zero at switch off).

The outputs are all quite 'safe' and didn't require the same protection.
One is simply a local output to an LED and, since it's confined into the same box, I don't see much chance of the village idiot (aka ME) hitting it with the car battery.
The other four outputs are also terminated within the box to opto-couplers that are used to 'drive' relays, so I'm pretty confident.  If the optocoupler dies _AND_ the relay somehow 'arcs over' from the outputs to the coil, I suspect it'll be caused by a BIGGER idiot than me incorrectly hooking up the ignition coil secondaries and that would require some SERIOUSLY long spark plug leads! LOL

I must say that I _REALLY LIKE_ the Arduino Due platform - especially the ARM processor it contains!  With my next 'project', I hope to tie in to the CAN bus on the (aftermarket) ECU in the car.  That should be fun!!!  (If I have any hair left by the time I'm done with that one I'll be surprised!)

promacjoe

by using zeners in this manner, you're setting yourself up to have reliability problems.

to start with, a 3V3 zener is way too close to the operating voltage. In this case, it is probably pulling the voltage down too close to the threshold voltage. That is way too much leakage. You would be better off using a Optical coupler. You can get them for both digital and analog signals. The input of a optical coupler has a wider voltage range, that it can work with. As long as you keep the current down below the maximum. And if one should go out, there's no way you can harm your processor. even a MOSFET should give better reliability and Still give good protection. all you need to do is properly bias the input.

I recommend you rethink your design.

I cannot recommend using zeners in this manner.



MorganS

Remember to design for the maximum peak voltage and not just the battery voltage. I had a problem a long time ago that resulted in blowing every single lamp in the car, including the headlights, from overvoltage.

I think most "automotive grade" chips are rated for 20V, most even take surges up to 40V without damage. Don't forget to allow a big safety factor on your capacitors too. A 16V capacitor is not suitable for automotive use.

Yes a "3.3V" zener actually starts to conduct below 3.3V. That voltage is measured with a specified current like 200mA. Pick a higher voltage or other surge suppressors like polyfuses may be more appropriate.
"The problem is in the code you didn't post."

TheRevva

#3
Oct 29, 2015, 09:00 am Last Edit: Oct 29, 2015, 09:01 am by TheRevva
by using zeners in this manner, you're setting yourself up to have reliability problems.

to start with, a 3V3 zener is way too close to the operating voltage. In this case, it is probably pulling the voltage down too close to the threshold voltage. That is way too much leakage. You would be better off using a Optical coupler. You can get them for both digital and analog signals. The input of a optical coupler has a wider voltage range, that it can work with. As long as you keep the current down below the maximum. And if one should go out, there's no way you can harm your processor. even a MOSFET should give better reliability and Still give good protection. all you need to do is properly bias the input.

I recommend you rethink your design.

I cannot recommend using zeners in this manner.
Edit:  I forgot the most IMPORTANT aspect of this post... Thanks for the feedback!!!

If (when?) it gets revamped, it's HIGHLY likely that I will switch from zeners to opto couplers on the four digital inputs using an LTV847 or similar.  However, there's VERY little chance that I'll do the same on the sole analog input (albeit with an analog opto of course).  The reality is that the analog input is a simple resistive voltage divider - very similar to the 5k pot that's used in almost ANY modern car as a throttle position sensor (TPS).  The actual range through which this pot rotates is FAR less than the available (roughly) 270 degrees.  In my existing setup, I get a voltage that swings between 0.67 and 2.40 Volts at the two extreme ends that the pot can rotate through.  The existing zener + series resistor on the analog input is MORE than adequate to protect that pin from 'the idiot' (me) zapping it on to the battery.  Almost every time I've seen an opto coupler used to isolate an analog signal, I've seen nightmares!  The sole exception was an HP / Agilent / Keysight E36xx lab power supply.
Lastly... Here's one you might find 'interesting'...  Of the four ECUs that I have taken quite a close look at, three of them 'protect' their digital inputs with...  You guessed it!  A resistor and a zener...  (Admittedly, they use a 4.7V Zener since they all use 5V logic, but in theory, that makes it WORSE for them)

TheRevva

Remember to design for the maximum peak voltage and not just the battery voltage. I had a problem a long time ago that resulted in blowing every single lamp in the car, including the headlights, from overvoltage.

I think most "automotive grade" chips are rated for 20V, most even take surges up to 40V without damage. Don't forget to allow a big safety factor on your capacitors too. A 16V capacitor is not suitable for automotive use.

Yes a "3.3V" zener actually starts to conduct below 3.3V. That voltage is measured with a specified current like 200mA. Pick a higher voltage or other surge suppressors like polyfuses may be more appropriate.
Rather than only 'designing' for a peak voltage, I also tested it (prior to hooking it to the actual CPU pin of course).  When I hit it with over 60V for a prolonged period, I managed to destroy the series input resistor, but the output voltage never exceeded the allowable CPU pin limits.  I got the same 'pass' from short bursts at 120V.
As for capacitors, I think I goofed there by only using 35VW, but that's an EASY fix as there's enough space to fit physically larger caps.  Thanx for the 'heads up'.

MrAl

Hi,

I have to agree with some of the other posts about the possible ill fate from using 3.3v zeners as a pin over voltage protection device.  I might try this idea, but before i actually implemented it on the board i would test it completely by running the external voltage from 0 to +15 volts just to see what the 'zener' side actually does.  If it drew too much current at say 3.2v, i might reject it, or if the zener did not clamp properly to maybe 3.5v i would reject it.  Remember zeners have an equivalent series resistance too, so they dont have a perfectly flat response.  With a small value resistance and a +12v supply they could easily go over 3.5v i bet.
A few tests would clear all that up though.  Test for the worst possible case, unless of course you dont mind purchasing a new board :-)

It is possible to use Schottky diodes (not regular Si diodes) to clamp to the 3.3v supply line, but only if the impedance of that line is low enough to handle any and all fault currents.  An added load resistor would help here, such as 100 ohms or maybe even lower.  That keeps the supply line from getting boosted up in case of one or more fault lines going over voltage.
Alternately, set up a separate supply around 3.2v with enough load to handle any over voltage currents, then clamp all the inputs to that with Schottky diodes.  Then test, test, and test again to make sure it can handle any and all fault currents that could be possible due to any kind of fault you can think of.
In fact, a shunt regulator set for 3.2v would be really good here.  Everything clamped to that with Schottky's.  That will keep the clamp voltage line at 3.2 pretty solid for whatever current you design it to handle, even a full ampere if you think it is necessary.  It must be a shunt type regulator though, not a series pass type linear.  There are various IC's that will do that possibly with the addition of a single bipolar transistor.

jappiemike

Hello, I am also looking at using a Due in an automotive environment and have been thinking of using a high side switching chip (UDN2982) as an input buffer. I did ask on the forum if this was a good idea but received no answer so I'll throw it in here as a suggestion and maybe spark some debate so I can get an answer.

Cheers
Mike

CrossRoads

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

promacjoe

#8
Nov 01, 2015, 12:35 am Last Edit: Nov 01, 2015, 01:28 am by promacjoe
That is an output driver chip, which will supply a high current output of 500mA. the due only needs about 10mA as an input, So no it would not.

quote: from UDN2982 datasheet.

" Recommended for high-side switching applications that benefit
from separate logic and load grounds, these devices encompass
load supply voltages to 50 V and output currents to -500 mA.
These 8-channel source drivers are useful for interfacing
between low-level logic and high-current loads. Typical loads
include relays, solenoids, lamps, stepper and/or servo motors,
print hammers, and LEDs. "

If you're driving something that needs a high voltage Up to 50V, That needs a current of up to 500mA, this chip would be useful as an output buffer only. Not an input buffer.

Go Up