I have a 12V pulse square signal coming from an RPM sensor. I would like to translate it into 5V pulses since I will need to use it as input in an Arduino. What do you guys think is the easiest way? Can a comparator be used?
Arduino – Converting 12V Pulses to 5V Pulses
12v5varduino
Best Answer
Several methods:
The method you choose depends on how much electrical noise your environment has. If it’s a car or motorcycle engine, this might be a lot.
There are combo solutions such as using a voltage divider and a zener and a transistor or FET to condition the signal. That said, the optoisolator is the most robust solution as it breaks up any potential current loop between the sensor and your Arduino. It’s also more expensive, but much less than the cost of your fried board.
There's an additional benefit to using an optoisolator: by referring the diode input to the sensor ground, it will reject common-mode noise that might find its way onto the sensor wires.
More here: Detect car +12V using Arduino
And a Littelfuse appnote about automotive noise
MORE: Here's a simulation of common-mode noise with the optoisolator (try it here). I added a Zener to protect the opto LED, it's optional.