Maker Pro
Maker Pro

Reading Pulsewidth

microchipdip1

Dec 20, 2010
2
Joined
Dec 20, 2010
Messages
2
Hi,

I am new to the forums. I am trying to read a signal with a microchip. However the microchip has a max input of 5v. The incoming signal is a square wave (0v, 12v). At the end of a hi pulse, it spikes to 40volts or even more. Id really appreciate it if someone could tell me what components I would need to put in that circuit to drop it down to (0v, 5v), and block out that spike.

Thanks,
Steve
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Try something like this:

attachment.php


The 10K resistor limits the current. The 2 diodes clip any voltage higher than 5 or lower than 0) The additional 1k resistor limits the current through the protection diodes on the microchip should a really large spike come along,
 

Attachments

  • inputprotection.jpg
    inputprotection.jpg
    11.8 KB · Views: 219

microchipdip1

Dec 20, 2010
2
Joined
Dec 20, 2010
Messages
2
Can you point me to the most suitable and preferably cheap diodes that will do this? I am inept with electrical components. I only know how to program the microchip. Would TVS diodes be suitable?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Almost any diode will work in that circuit. The only exception would be zener diodes rated at significantly less than 5V -- in fact, making the bottom one a 5.1V zener has some advantages (but I digress)

1N400x would be fine (use whatever is cheapest). If you have some 1N4148's or 1N914's or almost anything.

A 40V spike will give you about 4mA through the diode. The reverse voltage will never exceed about 5V. Switching speed may be an issue, so I might prefer the small signal diodes if the spikes are especially fast (rise time) or high in energy.

Where is this input coming from (it's not the ignition coil of a car is it?)
 
Top