Hardware - digital Input protection

Status
Not open for further replies.

MolsonB

Active member
I'm designing a little car computer and wanting to over-do the input circuits. Looking at other posts, I'm trying to find out how to come up with the right resistor values. It will be for simple external switches (gnd on end of switch), but just in case something shorts, power touches it, etc...

R1 - 1K, that seems to be the norm for current limiting.
R2 - I read that 10K is good for the BAT54S diodes to allow current drain.
R3 - External pull-up, I came across one post talking about the MCU impedance, but my head started to develop it's own magic white smoke.

input.JPG
 
for an automobile it's better to use just an optocoupler, the PS2501-4 is good for 4 inputs, only needs one resistor per channel in series with its input to give a clean 3.3v signal back to mcu

IMG_0038.jpg
 
Agreed, optocouplers are the best way to "over do" input protection. ;)

The downside is they require the signal to source whatever current the LED requires. Taking temperature and aging into account, many need 10 mA. The best approach (used by MIDI) involves series resistors at both the transmitter and receiver, so you can tolerate shorts.

Don't forget to put a reverse clamping diode in parallel with the optocoupler LED.
 
you can use google's search for "led calculator"

depending on the voltage input, for 12v i use 1.5K series

for the calculator you want to aim for ~ 10mA for the optocoupler
 
The schematic (little blurry until you click on it) has 5V listed as Vcc. The datasheet for PS2501L shows roughly 1.2volts for LED.
(5V - 1.2V) / 10ma = ~ 390ohms. I went with the next size up with 430ohms.

Was wondering more on the MCU side of things. I generally put in 1K without really knowing how to come up with that value. The MIDI example does't have a resistor at all.
 
Status
Not open for further replies.
Back
Top