Page 1 of 1

Best way to reduce a 12v pulse for input to a 328

Posted: 04 June 2010, 14:34 PM
by FFMan
Accidentally blew a 328n as i forgot the output from my magnetic sensor was at the supply voltage of 12v - oops

so whats the best way of simply making the 12v inout OK for the 328 - can i simply use a series resistor or should i use a resistor divider ?

Simple is good here as space is very limited !

Re: Best way to reduce a 12v pulse for input to a 328

Posted: 04 June 2010, 14:46 PM
by dkinzer
FFMan wrote:can i simply use a series resistor or should i use a resistor divider ?
A series resistor will work in a pinch since the AVR chip has clamping diodes on all inputs. You compute the size of the resistor so as to limit the current to 10mA or less, e.g. (12V-5V)/10mA =700. A 1K resistor would be fine.

A better solution, I think is to add your own external clamping diodes or a transistor and two resistors. The latter solution will give you an inversion, of course.

Posted: 04 June 2010, 14:52 PM
by FFMan
electronics not my strong point - when you say clamping diodes to you mean a 5v zener ?

just experimenting with a resister divider - is this not a good plan ?

trying to get it working for a race weekend starting tomorrow - reed switch based mag pickup proved unstable with engine vibration

Posted: 04 June 2010, 15:24 PM
by dkinzer
FFMan wrote:electronics not my strong point - when you say clamping diodes to you mean a 5v zener ?
No. A clamping diode serves to limit the excursion of a signal to a fixed voltage level, i.e. it "clamps" the voltage level. Consider the image below, excerpted from AN213 External Device Interfacing. If the input signal rises above about 5.6 volts (assuming a typical silicon diode) the input to the ZX will be clamped at the 5.6V level with the resistor dropping the remaining voltage. A similar thing happens when the signal tries to go negative.

You can use Schottky diodes for clamping purposes as well. The advantage of this type of diode is that it has a smaller forward voltage drop, on the order of 0.3V compared to 0.6V for a small signal silicon diode.