Digital/discrete inputs - Sudo

Hardware inside and outside of the ECU
Post Reply
Sudo
Posts: 92
Joined: Mon Mar 17, 2014 12:53 am

Digital/discrete inputs - Sudo

Post by Sudo »

Here is my suggestion for input:

A simple NFET like 2N7002K is perfect for general purpose discrete inputs. Vgs can handle +/-20V. ESD protected gate. It is dirt cheap too. You can add debounce low pass filter if needed.
http://www.onsemi.com/pub_link/Collateral/2N7002K-D.PDF
This is what I will be using for the stimulator board inputs.
Attachments
fet input.JPG
fet input.JPG (32.68 KiB) Viewed 11759 times
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: Digital/discrete inputs

Post by puff »

what happens in case this 2n700 blows up? will it ruin the inputs of µc?
Sudo
Posts: 92
Joined: Mon Mar 17, 2014 12:53 am

Re: Digital/discrete inputs

Post by Sudo »

That's a trick question because it depends on how it blows up. :D But the odds are that the FET drain to source will stay open, which means the MCU input will stay pulled up. 8-) At least, that's based on my experience with them.
puff
contributor
contributor
Posts: 2961
Joined: Mon Nov 11, 2013 11:28 am
Location: Moskau

Re: Digital/discrete inputs

Post by puff »

any chance of gate to drain short circuit?
Sudo
Posts: 92
Joined: Mon Mar 17, 2014 12:53 am

Re: Digital/discrete inputs

Post by Sudo »

I suppose it can. :(
Sudo
Posts: 92
Joined: Mon Mar 17, 2014 12:53 am

Re: Digital/discrete inputs

Post by Sudo »

@ did pointed out a problem that may occur. Nonetheless, the circuit can be remedied further by adding a resistor and clamping diode to the gate, since the gate is already protected with ESD diodes but not over voltage protected. But that somewhat defeats my goal, which was simplicity. However, simplicity is good for something like the stimulator, but I realize now that it is not good on an ECU. There are definitely better ways to achieve bullet proof inputs. So, I've taken the liberty to redesign it with focus on both robustness and simplicity.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Digital/discrete inputs - Sudo

Post by kb1gtt »

Couldn't you do something like this to use a more common transistor? If you use a 3V zener and 1k, I think it would limit the gate voltage. That's supposed to be a resistor connected to the gate.
Attachments
fet input.JPG
fet input.JPG (38.09 KiB) Viewed 11717 times
Welcome to the friendlier side of internet crazy :)
Sudo
Posts: 92
Joined: Mon Mar 17, 2014 12:53 am

Re: Digital/discrete inputs - Sudo

Post by Sudo »

From my experience, the 2N7002 (non K) version is pretty easy to get ESD damage. That's why I choose the 2N7002K with gate-source ESD protection. Your method of adding the resistor and diode is what I would normally use. But in this case, I would use a 16V zener since Vgs can be +/-20V. That way I can pull up to 12V without biasing the zener. To be honest, I never had a 2N7002K failed, yet. In a way, I am not even sure why I am paranoid about it once puff pointed it out. :| It certainly made me think twice about it.

But I have something else in mind right now. This is a basically a level shifter with ESD protection. The input can handle up to 60V constantly since the FET is essentially off above a diode drop below 3.3V. Output side can be pulled up or down. This is similar to what they use with I2C level shifters. As a bonus, it is also bidirectional. And in the case of gate-drain short failure mode, not a problem.
Attachments
protectedlevelshifter.png
protectedlevelshifter.png (5.92 KiB) Viewed 11716 times
Sudo
Posts: 92
Joined: Mon Mar 17, 2014 12:53 am

Re: Versatile Level shifted IO - Sudo

Post by Sudo »

This circuit is now "Versatile Level shifted IO - Sudo" @Russian, change the topic if you can.
VIO.png
VIO.png (8.01 KiB) Viewed 11683 times
The reasoning for this circuit is to provide is versatile general purpose level shifted IO with optional ESD protection. This circuit can be used in various modes.

Common points:

1. The main limitation of any modes is bandwidth and drive current. I don't have exact numbers for bandwidth, but with the added inductance and pull up slew rate, it may or may not work with bandwidth higher than 1 MHz. It is intended to be for I2C speed.
2. The 2n7002 will allow the Vex can be at Vds of the MOSFET, which is up to 60V.
3. The MCU side is assumed to be equal or lower than the external voltage in any modes.
4. Riex, Ciex, Desd all serve as protection to ESD and overcurrent, which are optional.
5. Rmcu is also optional if MCU IO is set to pull up.
6. This circuit is originally designed for I2C voltage translator. Both of these app notes will provide much better details of the circuit. http://www.adafruit.com/datasheets/an97055.pdf and http://www.nxp.com/documents/application_note/AN10441.pdf

IO modes (relative to MCU side):
1. Pull up/drain input and/or output modes are allowed. The Vex can be up to 60V (limited by 2n7002). The Vex must be equal or higher than Vmcu. In these modes, both side are allowed to pull down at anytime.
2. Push/pull or totem pole input will still work. The 2n7002 is effectively off when Vex is a diode drop above the Vmcu. Again, the Vex should ideally equal or higher than the Vmcu.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Digital/discrete inputs - Sudo

Post by kb1gtt »

For ESD, I think you need a TVS diode as close to the connector as possible, going from the input pin / harness pin to GND. Preferably avoiding any sharp bends. If you keep the transients off the board, you keep is out of your components. Schematic wise that would be shown as going from the External signal, to GND. A TVS of around 50V would probably work reasonably well, as long as you can get one that's good for ESD / low pF and fast switching times. Remember ESD can damage the capacitor and MOSFET. Protecting the MCU pin is of little benefit, as the MCU pin is typically already well protected against ESD. Typically the Desd pins 1-2 are for slight reverse polarity situations. This diode will typically provide around 1V of protection against slight reverse polarities caused by ringing and such. Many MCU's can only tolerate a negative pin polarity of around .7V max. That diode often enhances that negative protection significantly.

Also keep an eye on the leakage current of the pins 2-3 of the Desd diode. The pull up is going to pull up with around 33uA. It's not un-common for a diode to have leakage currents in that range. You may experience odd behavior as you may have more leakage across pins 2-3 than expected, or you may leak it away via pins 1-2 when you don't expect it. That diode will need to have some very low leakage currents. Also beware the MOSFET could have up to 10uA of leakage for Idss. That might also cause some odd or non-predicted behaviors. It may also allow the MCU pin to get pulled higher than desired, but only when you hit the conditions just right for that 10uA leakage to happen.

This circuit only works when you have external pull up resistors, your pin drive is limited by the pull up resistor. As well this circuit is good for digital signals like I2C, not good for Analog circuits, as the MOSFET's transition region will create warp-age during the transition stages.
Welcome to the friendlier side of internet crazy :)
Sudo
Posts: 92
Joined: Mon Mar 17, 2014 12:53 am

Re: Digital/discrete inputs - Sudo

Post by Sudo »

Yes, alot has to do with routing too, making sure that energy doesn't transfer to neighboring signals and making sure that it return to the external. But the 200pF is what protects the MOSFET. This circuit is actually been tested. During an ESD event, the 200pF is a short and it will transfer most of the energy to the TVS diodes. Believe it or not, the capacitor actually survives and protects to MOSFET. The reasoning is probably the fact that the cap isn't shorted to ground and taking all of the energy. In the test, I initually use a TVS exactly as you said without a capacitor on the mosfet, I was still able to destroy the 2n7002. At the end, I didn't even needed a TVS diode once the cap was added. I was relying on the ESD protection of a microcontroller inputs. I hit the circuit countless times with an ESD generator. There are alot more variables we can add to ESD events that we cannot actually easily prove. I am not going to claim this circuit 100% ESD proof. But results speaks for itself sometimes. And I have over 300k devices using a simular circuit without a single ESD damage to the MOSFETs or inputs. :D You could say that I am lucky. :twisted: ESD protection is about reducing the odds, there is never a 100% protection.
User avatar
kb1gtt
contributor
contributor
Posts: 3758
Joined: Tue Sep 10, 2013 1:42 am
Location: ME of USA

Re: Digital/discrete inputs - Sudo

Post by kb1gtt »

Was the ESD gun set to 1kV or 8kV? Just wondering what range you were looking to survive. The layout is very often the critical component of ESD, as the high frequencies do some really odd things.
Welcome to the friendlier side of internet crazy :)
blundar
contributor
contributor
Posts: 141
Joined: Tue Jan 07, 2014 4:38 am
Location: Cincinnati, Ohio
Github Username: blundar
Slack: Dave B.
Contact:

Re: Digital/discrete inputs - Sudo

Post by blundar »

Might as well add some spark gaps... They're handy as a first line of defense.

.lbr isn't an allowed extension so I can't upload the library of cookie-cutter spark gaps I use. I can email you my eagle library if you want, but I don't do kicad yet.
User avatar
AndreyB
Site Admin
Posts: 14323
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Digital/discrete inputs - Sudo

Post by AndreyB »

I hope I have just enabled .lbr attachments
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Post Reply