Author Topic: Robust Microcontroller Input Protection  (Read 76247 times)

0 Members and 1 Guest are viewing this topic.

Offline Baliszoft

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: hu
Re: Robust Microcontroller Input Protection
« Reply #100 on: July 15, 2012, 08:54:58 am »
Quote
and of course "managing a fake engine".
well done on "first" stage of testing. now to the second. do it again on "real" engine, on the "real" road for a "real" one year or more. add some extra abuses during that space and time (maybe KV spike) to be more fun.
It is already in some cars (including my own one) for testing. The engine simulator is used on the bench mainly for software development.
 

Online SeanB

  • Super Contributor
  • ***
  • Posts: 16283
  • Country: za
Re: Robust Microcontroller Input Protection
« Reply #101 on: July 15, 2012, 09:06:38 am »
Don't forget to high pressure clean the engine with it running as well, this makes for some interesting stray voltage inputs.
 

Offline Baliszoft

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: hu
Re: Robust Microcontroller Input Protection
« Reply #102 on: July 15, 2012, 09:08:14 am »
Don't forget to high pressure clean the engine with it running as well, this makes for some interesting stray voltage inputs.
Ok, thanks! Will do.
 

Online SeanB

  • Super Contributor
  • ***
  • Posts: 16283
  • Country: za
Re: Robust Microcontroller Input Protection
« Reply #103 on: July 15, 2012, 09:10:42 am »
Hope it survives, many do not.
 

Offline Baliszoft

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: hu
Re: Robust Microcontroller Input Protection
« Reply #104 on: July 15, 2012, 09:23:42 am »
We'll find out soon, though i gotta get a pressure cleaner first :-). Would not do such a test at the petrol station (where engine wash is prohibited here).

Btw: i got a distributorless ignition system, so no hv is directly exposed. This ecu cant fire other systems either.
« Last Edit: July 15, 2012, 09:27:47 am by Baliszoft »
 

Online SeanB

  • Super Contributor
  • ***
  • Posts: 16283
  • Country: za
Re: Robust Microcontroller Input Protection
« Reply #105 on: July 15, 2012, 09:36:07 am »
They are cheap enough now.
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: Robust Microcontroller Input Protection
« Reply #106 on: July 15, 2012, 02:39:01 pm »
Okay, did some tests which i believe are quite unbelievable.

Yes impressively robust, but, remember dsPIC30s are old clunkers. 100mA @5v to run a simple 16 bit processor at 30 MIPs is far from bleeding edge.
 

Offline Baliszoft

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: hu
Re: Robust Microcontroller Input Protection
« Reply #107 on: July 15, 2012, 07:52:23 pm »
Okay, did some tests which i believe are quite unbelievable.

Yes impressively robust, but, remember dsPIC30s are old clunkers. 100mA @5v to run a simple 16 bit processor at 30 MIPs is far from bleeding edge.

No doubt. I have actually measured about 120mA 5V @ 20mips with the peripherials i needed. Not that impressive, but in this case this "chunkiness" comes handy. I was about to use the dspic33f (now AEC qualified) but i did not want to go 3.3V.
 

Offline Baliszoft

  • Frequent Contributor
  • **
  • Posts: 277
  • Country: hu
Re: Robust Microcontroller Input Protection
« Reply #108 on: July 17, 2012, 10:38:58 am »
By the way, what is your opinion about using spark gaps?
Or spark gaps combined with capacitors?
 

Offline Niklas

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: se
Re: Robust Microcontroller Input Protection
« Reply #109 on: July 31, 2012, 10:18:40 pm »
Earlier it was  common with capacitors 100 pF, 1000V with dielectrica NP0 or C0G connected between each connector pin and GND. If possible, add a small series resistor or inductor after the capacitor.

For CAN bus filtering I have borrowed a solution from an old transmission ECU. A common mode filter 22 pF ceramic capacitors to GND both before and after the filter. The over voltage protection on the CAN bus side was a BAV99 with both diodes connected antiparallel followed by a 18 V varistor to GND. One BAV99 and varistor each for CANH and CANL. The diodes lowered the capacitive load from the varistor. Now there are low capacitance TVS diodes available, at least for USB, HDMI etc.

Also be careful with the GND reference for all I/Os. When the engine is cranking there can be large differences in GND potential between the engine and the rest of the chassie. I had an uninsulated type K thermocouple inside a manual transmission for tests connected to a converter box on the OBDII connector. The thermocouple interface was killed every time the engine was cranking.
 

Offline rocky79

  • Contributor
  • Posts: 27
  • Country: us
Re: Robust Microcontroller Input Protection
« Reply #110 on: September 03, 2014, 12:01:09 am »
Search on the forum. I posted a whole page on this subject.
All you need is two resistors and a double-diode per pin connected to a hard reference made with a properly biased power zener.
Make sure to use long body resistors, create a moat under them, provide a shield ground that is only coupled with a ferrite bead to system ground and you will be good.
If you cpu does not have schmittrigger inputs you can add a schmittriger inbetween and feed that of as separate rail.
High energy , short pulses are best shunted using small caps to ground...

Someone needs to make an article about this stuff. This comes up ever so often and many people have no clue how to do this kind of basic thing..

If i have time i will whip one up... It's usefull since i'm preparing to write a book on practical PCB layout where this kind of stuff will be covered...

free_electron,
 I realized it's an old post but I got question regarding the zener diode 5v protection clamping circuit. My application  require very low power concumption (in low uA's) so a zener diode won't work as it consumes in the mA range to keep it properly biased. Do you have an alternate solution for low power application?

Thank you!
 

Offline DutchGert

  • Frequent Contributor
  • **
  • Posts: 257
  • Country: nl
Re: Robust Microcontroller Input Protection
« Reply #111 on: September 03, 2014, 12:32:33 pm »
Search on the forum. I posted a whole page on this subject.
All you need is two resistors and a double-diode per pin connected to a hard reference made with a properly biased power zener.
Make sure to use long body resistors, create a moat under them, provide a shield ground that is only coupled with a ferrite bead to system ground and you will be good.
If you cpu does not have schmittrigger inputs you can add a schmittriger inbetween and feed that of as separate rail.
High energy , short pulses are best shunted using small caps to ground...

Someone needs to make an article about this stuff. This comes up ever so often and many people have no clue how to do this kind of basic thing..

If i have time i will whip one up... It's usefull since i'm preparing to write a book on practical PCB layout where this kind of stuff will be covered...

free_electron,
 I realized it's an old post but I got question regarding the zener diode 5v protection clamping circuit. My application  require very low power concumption (in low uA's) so a zener diode won't work as it consumes in the mA range to keep it properly biased. Do you have an alternate solution for low power application?

Thank you!

Perhaps a TVS or MOV?

So: (input signal)>---(MOV (=low leakage) to SGND)>---(optional: high voltage cap to SGND)>---(fusable series resistor)----(MCU input)>

free_electron what is your opinion about that?
« Last Edit: September 03, 2014, 12:42:59 pm by DutchGert »
 

Offline JDW

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Robust Microcontroller Input Protection
« Reply #112 on: March 31, 2017, 06:11:37 am »
...if you need a pull down or pull up it should be pace BEFORE the 4k7 ( where the transil sits )

WHY?  What is the difference between putting the pull-down resistor BEFORE the current-limiting 4k7 in that circuit versus putting the pull-down resistor AFTER it?

The circuit in question is posted here: https://www.eevblog.com/forum/microcontrollers/robust-microcontroller-input-protection/msg125866/#msg125866

Also...

Why not just use a transistor instead?  It would invert the signal, but handling that in the MCU's code is easy.  It would offer reasonably good protection too.  Here's an example circuit showing a +12V input and a GND input to an MCU (automotive environment):



You'll note the 1K resistor is AFTER the 10K because, quite honestly, I don't see why that 1K pull-down needs to be placed BEFORE the 10K.  Again, if you could explain why, I would love to hear it.

Also, in terms of the resistance value of the pull-down, it doesn't seem to matter too much.  Here are circuit simulations for a 1K pull-down versus a 100K:





The smaller resistance value of 1K would probably have better noise immunity, but I don't see a significant difference in terms of that resistor being used to pull down the base in cases where the +12V input is floating.  The purpose of that pull-down is in my linked PNG file above is to prevent unintentional switching of the transistor.
« Last Edit: April 03, 2017, 12:25:15 am by JDW »
 

Offline boffin

  • Supporter
  • ****
  • Posts: 1027
  • Country: ca
Re: Robust Microcontroller Input Protection
« Reply #113 on: March 31, 2017, 06:31:24 am »
Two simple words: OPTO ISOLATOR

they're cheap, require minimal external components.

So (for 12v) 5-10k series resistor, a diode across the opto's LED for reverse voltage protection.
On the far side just wire it straight into the micro (potentially with a pullup resistor, but in the example below the AT processors have an input_pullup option)



 

Offline JDW

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Robust Microcontroller Input Protection
« Reply #114 on: March 31, 2017, 06:53:49 am »
OPTO isolators in a car environment?  No!  Good concept.  Bad in reality.

  • Too expensive
  • Draw too much power
  • Spikes will nail them at some point

Not just my opinion either: http://www.avrfreaks.net/comment/491166#comment-491166

I still seek specific answers to the questions I posed in my previous post.
« Last Edit: March 31, 2017, 06:57:00 am by JDW »
 

Offline jesuscf

  • Frequent Contributor
  • **
  • Posts: 499
  • Country: ca
Re: Robust Microcontroller Input Protection
« Reply #115 on: April 01, 2017, 05:48:26 pm »
Two simple words: OPTO ISOLATOR

they're cheap, require minimal external components.

What about using the PC814 instead (or the LTV-814, etc. )?  They come with two diodes already, so the extra diode (D9) in the circuit wouldn't be needed.
Homer: Kids, there's three ways to do things; the right way, the wrong way and the Max Power way!
Bart: Isn't that the wrong way?
Homer: Yeah, but faster!
 

Offline JDW

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Robust Microcontroller Input Protection
« Reply #116 on: April 02, 2017, 03:41:07 am »
 

Offline boffin

  • Supporter
  • ****
  • Posts: 1027
  • Country: ca
Re: Robust Microcontroller Input Protection
« Reply #117 on: April 02, 2017, 08:22:46 pm »
See Table 1 on page 2 of the following PDF for the types of car noise your opto will need to survive.

http://m.littelfuse.com/~/media/electronics_technical/application_notes/varistors/littelfuse_suppression_of_transients_in_an_automotive_environment_application_note.pdf

120V load dump according to that spec sheet.  So, if you use a 5k resistor as I suggested that's a whopping (wait for it)..... 24mA through the Opto (or just under 50% of the 50mA max). 

OK a 1N4148 doesn't have a high enough reverse voltage for 120V, so instead just use a 1N4004, and slap a cap in parallel to trim out some of the spike if you're really excited by that. 

The (cheap cheap cheap) PC817 opto is easy to implement, and much more resilient than resistor ladders, and/or fiddling w/ zeners; and has the benefit of being able to have a input source which isn't ground referenced and/or coupled to your processor at all.

As for the person that asked about the 814, it's generally quite a lot more money, but you're right, it does cut down on parts count
digikey, C$ prices 100 lot (4pin DIP - because I'm old-school);
PC817 C$0.27/ea
PC814 C$0.40/ea

I <heart> the 817.  Such a nice simple jellybean part.

 

Offline JDW

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Robust Microcontroller Input Protection
« Reply #118 on: April 03, 2017, 12:21:37 am »
Such a nice simple jellybean part.
No question.  You prefer optocouplers and have good reasoning behind your feelings.  But have you ever designed a device that was mass produced and used in a 12-volt car?

I personally have seen a lot of automotive schematics, and I've not seen optocouplers used.  And even at $0.20 each, that is more cost than resistors, transistors and caps, which is what most automotive schematics I've seen use for MCU input voltage drops and protection.  When you have a lot of inputs, those teensy tiny costs add up. 

Putting optocoupler solutions aside for the moment, would anyone kindly care to offer specific answers to the questions I put forth in my previous post here?  (Especially with regard to the schematics I posted.):

https://www.eevblog.com/forum/microcontrollers/robust-microcontroller-input-protection/msg1174838/#msg1174838

Thank you.
« Last Edit: April 03, 2017, 12:26:39 am by JDW »
 

Offline boffin

  • Supporter
  • ****
  • Posts: 1027
  • Country: ca
Re: Robust Microcontroller Input Protection
« Reply #119 on: April 03, 2017, 01:35:44 am »
Such a nice simple jellybean part.
No question.  You prefer optocouplers and have good reasoning behind your feelings.  But have you ever designed a device that was mass produced and used in a 12-volt car?

I personally have seen a lot of automotive schematics, and I've not seen optocouplers used.  And even at $0.20 each, that is more cost than resistors, transistors and caps, which is what most automotive schematics I've seen use for MCU input voltage drops and protection.  When you have a lot of inputs, those teensy tiny costs add up. 


The OP was asking for something robust, I don't remember his original post saying  "something I can make 100,000 lots at the lowest possible price". 

Sure, I wouldn't probably use an opto if it was entirely about keeping the price down, but the optos are silly dirt cheap in volume too (under 0.10 in 10,000 lots), and I can get them off Aliexpress for my own tinkering for few cents each in small qtys.
 

Offline JDW

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: jp
Re: Robust Microcontroller Input Protection
« Reply #120 on: April 03, 2017, 01:44:19 am »
The OP was asking...

I am divergent.  The Opening Post is old.  I have somewhat altered it (extended it, expanded it, improved it, etc.)

Agreed about buying parts on Aliexpress.  I too do that a lot.

But again, with regard to OPTOs:

Have you personally ever designed a device that was mass produced and used in a 12-volt car?  I don't seek to undermine your good advice.  I simply have never seen OPTOs used in automotive designs.  Surely there must be a reason above and beyond "cost."  But perhaps that is for another thread.

FORGETTING OPTOS FOR NOW...

I would sincerely appreciate hearing specific thoughts on questions and schematics I put in my previous post here:

https://www.eevblog.com/forum/microcontrollers/robust-microcontroller-input-protection/msg1174838/#msg1174838

Thank you.
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Robust Microcontroller Input Protection
« Reply #121 on: April 03, 2017, 02:12:44 am »
There is a  firm selling a ruggedized version of the Arduino 328P. They show all the added protection (and why) used in their design. Interesting reading.

https://www.rugged-circuits.com/ruggeduino/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf