ATmega32 input pin protection

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

I have a board that uses a 47k resistor as input protection to PC5 but I am having trouble getting the voltage to go low enough for PC5 to be low. The internal pull-up is enabled and when I ground the input to the resistor, PC5 goes from 3V3 to 1V8 which is not low enough.

The board has places for PC5 to be pulled-up to 3V3 and pulled-down to ground. If I install a 10k pull-down resistor, PC5 goes from 0V8 to 0V6 (IIRC) when the input gets grounded. So I then installed a 10k pull-up in addition to the pull-down but the voltages are something like 2V4 and 1V5. Sorry I cannot remember the exact voltages, I got distracted.

I have STFF and STFW (until I got distracted) and found a real input protection circuit but that requires a new PCB.

I am afraid to lower the input resistor lower than 20k since its sole purpose in life (I think) is for over-voltage protection. I believe the inputs are supposed to survive 14V.

Another thought was to replace the resistor with a Schottky diode. Will this work?

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

I've never seen our hardware designer put anything higher than 1k as a series resistor to the real world. That is for industrial environments. What kind of voltage spikes are you protecting against?

Wouldn't a diode merely let pass the stuff you are trying to protect against, after a small voltage drop?

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

You could replace the pull-up resistor with a diode (cathode connected to 3V3) and replace your series resistor with perhaps a 1K. Remove the pull-down resistor if you have one. This will act as a voltage clamp, preventing the voltage at the anode of the diode (connected to the input pin) from rising above 3V3 + the diode forward voltage.

I've been using a SP724 for input/ouput protection. It will clamp any voltage above VCC or below GND on an input line. I've attached a portion of a schematic page where I am using these devices. Also attached a datasheet and the ordering information from DigiKey.

Attachment(s): 

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

@Lee
The idea was to put the diode in "backwards" so there is a path from the PC5 internal pull-up to the grounded input. Any input voltage above 3V3 will be blocked by the diode. The guy who designed this is no longer with the company and I have never understood analog.

@zoomcityzoom
I will try your suggestion as soon as I receive my 0603 diodes from Mouser.
Have you had good success with the SP724? This is the same circuit used in the AVRISP. I have ruined two AVRISPs by accidentally putting 12V on reset.

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

The SP724 is really meant for protecting against transient voltage spikes. It's not a good solution to protect against a stiff 12VDC (or any voltage above its VCC) applied to a protected pin.

To protect against the threat of a stiff 12VDC or any voltage above VCC, I would use a transorb to gnd at the pin with a series PolySwitch ressettable fuse. However, designing input protection circuits takes much analysis and then verification through testing with the proper equipment.

I've attached a datasheet for Tyco PolySwitches and a PDF on reverse battery protection, and a datasheet for a transorb that I use that you may find interesting.

-Tom

Attachment(s): 

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

Thanks. Well I guess I have got some light reading to do while waiting for Santa.

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

Speaking of reading, here's a list of some books that I've found very useful:

The Art of Electronics
Hacker's Delight
The Circuit Designer's Companion
Printed Circuit Board
Op Amp Applications Handbook
Pointers on C
Code Complete

-Tom

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

Complete tytle of cuiruit board book is Printed Circuit Board Designer's Reference: Basics by Christopher Robertson

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

zoom--

Check the sticky post(s) at the top of the Forum message list, and add your favourite references to the appropriate thread(s).

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Why is the internal pullup enabled? (useless for protection)

Disable it and tell us what you see.

Klaus
********************************
Look at: www.megausb.de (German)
********************************

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

@Klaus
For this application, the input is meant to be connected to a normally open button and goes to ground when pressed. The internal pull-up is for level sensing when the button is open. I still need to protect PC5 if high voltage is applied to the input. Plus other applications might apply a voltage to the input.

@zoomcityzoom
I just connected the diode between 3V3 and PC5 and replaced the 47k series resistor with 1k and it sort of seems to work. When I ground the input, PC5 goes low (there is much rejoicing). If I apply 5V, PC5 is limited to 3V6 which I believe is right for the diode I bought. But if I apply 12V, PC5 is limited to 4V6 which I am a little worried that voltage is too high. PC5 still works though.

I bought is a Bourns Schottky Barrier Diode, http://www.bourns.com/pdfs/SBCD0603_1005.pdf, because its size is 0603. The forward voltage is 0V37, forward current is 30mA and reverse voltage is 30V

Is there a chance I can get the PCB to work or do I need a new design? Would a resistor between PC5 and the diode help?

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

Use the version of the diode with the higher average forward current, select the 100mA or 200mA part if it is still available in a 0603 package. I don't remember how much current the internal pull-ups source, but you may want to increase the series resistor to as high as 2K.

The part you are using has to low of a forward current for clamping the input to 12V. The result is the high forward voltage you are seeing with 12VDC applied. Look at the forward voltage versus forward current graph for this part and the 100mA and 200mA parts.

-Tom

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

I have the same problem with protection of input pins. My solution is (but it is not checked in design with other parts) resistor 1k connected to a pin. All microcontrolers AVR have diodes (see figure) and it is also protection. If input voltage is higher then Vcc or GND, the current flows through the diodes. But I don't know eletctrical characteristic of diodes :? What do you think about this?

Attachment(s): 

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

BPar wrote:
@Klaus
For this application, the input is meant to be connected to a normally open button and goes to ground when pressed. The internal pull-up is for level sensing when the button is open. I still need to protect PC5 if high voltage is applied to the input. Plus other applications might apply a voltage to the input.

Disable the internal pullup and place a pullup before the input protection resistor. That pullup is seriously limiting the useable resistance of the protection resistor.

The other factor that limits that resistance is the leakage current of the pin itself, and certanly any leakage of diodes connected directly to the input pin. The datasheet usually lists leakahe current, but he rule of thumb I use is 10uA. Doesn't sound like much does it? Well, assume 10uA is being sources by the pin. The pin will have an offset voltage of 10uA * 47K = 0.47V.

Pin leakage current is dependant on process, voltage, and temperature, and will change over time. Also the leakage current can flow into the pin or out of the pin.

Thats why you need to limit the value of the input resistor.

If the overall source impedance of the input is limited to 10K you will have an offset of +/-0.1V. For extra protection I use 2 stages with clamping diodes between series input resistors. The diode's leakage currents will have less of an effect at a lower impedance point in the circuit.

Oh, and yes, transorbs or similar protctive devices are also excellent at transient protection. However, I like to design my inputs to be able to continuously withstand the highest voltage they may accidentally encounter.

Hope this helps.

DFR

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

duzamasa wrote:
I have the same problem with protection of input pins. My solution is (but it is not checked in design with other parts) resistor 1k connected to a pin. All microcontrolers AVR have diodes (see figure) and it is also protection. If input voltage is higher then Vcc or GND, the current flows through the diodes. But I don't know eletctrical characteristic of diodes :? What do you think about this?

Most ICs have the diodes you are referring to. They are actually bulk diode structures of the input pin circuitry and are there for ESD protection only. They are not intended for input protection, but everyone uses them that way anyway. I usually estimate on ON effective resistance of about 500 ohms or so.

DFR

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

zoomcityzoom wrote:
I've been using a SP724 for input/ouput protection. It will clamp any voltage above VCC or below GND on an input line. I've attached a portion of a schematic page where I am using these devices. Also attached a datasheet and the ordering information from DigiKey.

Just a comment if anyone is going to use these devics. For the best transient voltage protection place the clamping devices as close to the point where the signal enters your board. Running even a 1" trace between the input and the clamp can seriously degrade its performance due to the inductance of the trace.

Also run the signal through the pad of the clamp. Signal -> clamp -> rest of board.

DFR

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

@zoomcityzoom
Thanks, I just placed an order for all the 100mA and 200mA diodes in the 0603 package but it probably won't ship until Dec 27.

@danafraymond
Thanks for the suggestion but I don't think I'll be able to modify this board for it though. I don't remember reading about leakage current issue before so it is good that you mentioned it.

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

I use the following pin protection and it works well. It will handle 24VDC on the input indefinately.
The voltage going into the pin on the mega will not go above 5.6v as limited by the zener diode. The 240R resistor MUST be 2 watt as this limites the current going through the zener when it starts breaking down. The zener MUST be at least a 1watt zener. If you put 24vdc on the input, the 240R resistor does get fairly hot. Not hot enough to melt my plastic enclosure though. To decrease the heat build up in the resistor, you can simply go bigger on the wattage if space allows.

Attachment(s): 

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

Thanks for the circuit but I don't think I can get it on the current PC board. I will keep it mind during the next board redesign.