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

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

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

Post 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 !
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

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

Post 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.
- Don Kinzer
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Post 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
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post 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.
Attachments
ClampingDiodes.jpg
ClampingDiodes.jpg (12.47 KiB) Viewed 3688 times
- Don Kinzer
Post Reply