protect input that might be driven when AVR is off? with FET?

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have an AVR input that the other side might attempt to drive when the AVR with that input is off.  I'd like to somehow cut off that input when the AVR is off.

 

I found isolated level shifters which explicitly guarantee this but I think it's more than I need, and it seems like a FET should be able to do this, but I don't

know exactly how.

 

I though maybe a 2N7000 with the gate connected to the AVR Vdd or a divider of it, but:

 

  * I notice 2N7000 has "On-State Drain Current" minimum of 75 mA.  I'm guessing this is a guarantee and not a requirement, but I'm unsure

 

  * The gate threshold voltage is 0.8 to 3 V.  So I'm not sure how I can pick the exact shut-off level I want.  A simple divider on Vdd seems not good enough

since the wide Vgh_thresh makes it impossible to pick a value.

 

Is there a simple circuit to do this, or a simple cheap IC that guarantees it?

 

Thanks,

Britton

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Using a little MOS fet in a circuit similar to the "level shifter" can work in your situation.

This circuit is easily built by yourself, but you can also buy them on a little pcb (usually 4 circuits on a mini pcb) from Ali / ebay / or any shop which is oriented on the hobby market.

If you build it yourself: You need a pullup resistor on the AVR side.

The idea of this level shifter is that the fet only starts conducting if one of the sides gets below the voltage the Gate is tied to minus the Gate threshold voltage. If both voltages are above that the FET is off and the input of your AVR is essentially floating. You can enable the interanal pullup, or ad an external one.

 

bkerin wrote:
"On-State Drain Current" minimum of 75 mA.

https://www.onsemi.com/pub/Colla...

This "On state Drain current" is a minimum guaranteed curren which will flow under the stated circumstances.

The 2N7000 is a quite old fet. (30 years or so, mabye more?) and it has quite "rounded" and "analog like" curves. ST has it marked as obsolete in a datasheet from 2008.

http://www.st.com/content/ccc/re...

 

For this application you want a fet which is more optimized for digital switching aplications.  You want it to be "off" when the gate is 100mV under the threshold and "on" when the Gate voltage is a few 100mV above the threashold voltage.  The spread in the trheshold voltage is also quite big by this old fet.

 

For your application the Gate threshold voltage is not important. Anything between 500mV and 2.5V will do. If it gets above 2.5V however you start eating away your noise margin.

You seem to be somewhat unexperienced with MOS fets. Therefore I want to advise you buy some (they get damaged quite easily by ESD) and build some circuits on a breadboard. It is quite enlightening to re-create some of the graphs you find in the datasheets with a simple piece of paper and a pen.

If you do this you will also learn why the Gate threshold voltage is not important, and the noise margin eating part.

 

Edit:

Because of the way the body diode is used in this circuit you really want a threshold voltage which is below 2V.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

Last Edited: Sun. Aug 20, 2017 - 01:38 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Would simple current limiting having a series resistor work? Like 1kΩ in series with limiting to 1mA?

 

Supertex (now Microchip) application note AN-D11 details using two depletion mode mosfet's (LND150) for circuit protection by limiting current to a set value like 1mA over a ±500V excursion. On mosfet would suffice for a single polarity application. The appnote is written for measurement applications, should work fine for moderate speed digital input use.

 

http://ww1.microchip.com/downloads/en/AppNotes/AN-D11.pdf

 

Further discussion

http://www.avrfreaks.net/forum/%C2%B1500-volt-protection-circuit

Last Edited: Sun. Aug 20, 2017 - 03:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The ESD diodes on AVR's can hanle about 5mA continuously (from the top of my head) but they are not designed for continouus current.

So for series  resistor only I'd reccomend > 1k from a 5V power supply.

Or add an extra Scottky diode to be safe.

but MOSfet + resistor is also 2 components and is a better overal solution

Unless, you also need the inherent increase of ESD protection from the series resistor...

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where does the current that flows through the series resistor and either the input diodes or any external diodes go?

'This forum helps those who help themselves.'

 

pragmatic  adjective dealing with things sensibly and realistically in a way that is based on practical rather than theoretical consideration.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Power comes from the external 5V circuit and flows through the resistor to the AVR input pin.

Via the AVR input pin it goes through the internal ESD diode (or external scottky) to the Vcc pin of the AVR.

This power might even be enough for the AVR to start executing code.

Or it might lift the Vcc pin of the AVR to a level that other (3V3 only) chips might get damaged.

(But that is not so likely due to the current limiting).

It can also reverse bias the voltage regulator or other nasty stuff, so be carefull.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could also use the venerable optocoupler..your input drives the input side of the coupler (which is likely just an LED, but could be an internal low current "amplifier" & LED).

The opto's output side is powered by the processor supply...so when the processor is powered down, so is the optocoupler output.

This has the advantage of providing isolation from any potential high voltages that might make their way into the primary side signal line.

Note if both sides share a common gnd, then a gnd fault on the primary side will be a fault (such as shock hazard) on the "isolated" side.  In this case you don't have true safety isolation.

 

Nowadays, there are also capacitive and magnetic "digital" isolator chips, which can be handy too.

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A simple diode and the internal pull-up may be sufficient, depending on the nature of the input signal (i.e. speed):

 

                    +-------------------------
                    |
                    | internal
                    |  pullup
                    |    |
                    |    /
                    |    \
                    |    /
                    |    \
                    |    /
Input            I/O|    |
  >-------|<|-------|----+
                    |
                    |
                    |
                    +-------------------------
                            |
                            |
                           GND

 

The voltage on the I/O pin will be pulled to GND + VF when the input in driven low.  More specifically, it will be driven to VINPUT+VF, limited VCC.  Voltages on the input above that threshold will have no effect on the I/O pin, and the internal pull-up will hold the pin at VCC.

 

Bottom line:  If VCC is 0, no (positive) voltage present on the input will be seen at the I/O pin.

 

Depending your signal needs, you may need to choose a faster e.g. Schottky diode.  Advantage is usually a lower VF, providing a better VIL at lower VCC, and faster switching.  If you need really fast switching (above a few hundred kHz) or the timing of edges needs to be accurate to better than a few μs, then you'll need a stronger external pull-up.  You'll just need to do the math to compute the TC of the RC filter for the rising edges (pull-up plus pin/trace capacitance).  Disadvantage of a Schottky is higher reverse leakage.  If it's too high, then perhaps enough current would flow into the I/O pin when VCC is 0, thus powering the AVR = bad.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you use the diode, DO use a schottky if you want the greatest noise margin.  The max allowed pin low voltage (mega88) is 0.3*Vcc for 3.3 or 5V operation...at 3.3v that gives 0.99V, so the diode can't afford to throw too much away trying to pull pin towards gnd.  Going beyond the max to 0.6*Vcc (1.98V) & it is then considered a "high" input.

When in the dark remember-the future looks brighter than ever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you use the diode, DO use a schottky if you want the greatest noise margin.  The max allowed pin low voltage (mega88) is 0.3*Vcc for 3.3 or 5V operation...at 3.3v that gives 0.99V, so the diode can't afford to throw too much away trying to pull pin towards gnd.  Going beyond the max to 0.6*Vcc (1.98V) & it is then considered a "high" input.

True, but remember the VF of a diode is current-dependent.  At the measly 150 μA or so sinked by the diode through the pull-up, VF drops quite a bit below that spec'd for the rated current.

 

Here's a 1N4004 with a nominal 35K internal pull-up, 20 pF of pin/trace capacitance, VCC=5V, and a 10 kHz 0-5V square wave input:

 

 

VIH settles very quickly at 280 mV.

 

True that the margin is better with a 1N5817:

 

 

About 60 mV.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Vishay have a Small signal schottky diode.  BAT85S

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And remember that reverse leakage on a Schottky can be significant.  Here's the 1N5817 with VCC=0V:

 

 

 

The I/O pin sees 1.026V when the input is at 5V.

 

The 1N4004:

 

 

Only 2.7 mV.

 

Mind you, this simulation ignores pin and trace inductance, and (probably more importantly) the load effects of the AVR silicon itself.

 

In both cases, note the strong positive spike on the leading edge of the input signal, and the strong negative spike on the falling edge.  These spikes are (I imagine) the combined result of the the simulated pin/trace capacitance and the modelled diode junction capacitance.  These spikes will not disappear with the use of a more sophisticated circuit such as one with a FET, but they may be greatly reduced.  Whether or not they pose a problem in the first place is for someone else to determine :)

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Tue. Aug 22, 2017 - 08:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, the Schottky diodes have very high reverse leakage, and it increases greatly with temperature.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm...computer model...let's try 35K, 4.95v, and a 1N4004 diode.  Now, let's measure the drop

 

 

 

sound like the sensitivity is high & perhaps the model off for this particular part.  But that's better than 0.7V drop.

I decided to take an actual look after seeing the end of this article:

https://jeelabs.org/2012/05/14/forward-voltage-drop-on-a-diode/

 

hmm... WWBPS?

When in the dark remember-the future looks brighter than ever.

Last Edited: Wed. Aug 23, 2017 - 12:31 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ultimately the noise margin may not be a significant factor.  It all depends on the application.  If VCC is stable, if the device operates over a reasonable range of temperatures, if the input signal is clean, more noise margin doesn't buy you anything.  At 5V, VIL is guaranteed 1.5V for normal I/O pins (not XTAL1, not /RESET) over the full temperature range of -40C to 105C.  Even the full spec'd 1V drop of a 1N4004 at IF=1A leaves plenty of noise margin.

 

Only the OP knows what kind of signal he has on the input, and what kind of environment the app must withstand.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

 

I read through all the posts and could not find if the input you are protecting is analog or digital.   If digital my thoughts are:

 

1) A series resistor might work, but be cautioned the current through this resistor will go through the AVR protection diodes and try to power your AVR.  Same with a schottky diode.

 

2) A 2n7000 with the drain connect to the AVR input and the gate to your "external" signal would work.....however

      a) there will be no ESD protection for the 2n7000

      b) there will be an inversion to your input.

 

3) Not knowing where your "external" signal is coming from,  is ESD protection needed for this signal path?

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The beefier the diode, the smaller the voltage drop will be, with a 1n540x it would probably be about 0.4V. But I think there is no point, looks like a 1N400x will be fine.