Link NPN Sensor with MicroController

K

Thread Starter

Karl M

Hi,

I have a inductive sensor with a 12V npn output. The sensor gives out a digital signal(0/12V). I want to link this to a 5V microController. How can i reduce the voltage, so i wont hurt the microController?
 
> I have a inductive sensor with a 12V npn output. The sensor gives out
> a digital signal(0/12V). I want to link this to a 5V microController.
> How can i reduce the voltage, so i wont hurt the microController?

There are several ways for example a 12 Volt relay, the coil powered by the inductive sensor and the contacts switching 5 Volts to the controller.

A simpler way might be just a Voltage divider (2 resistors in series) to drop the Voltage, a 5.6K in series with a 4.7K would be close to 5 Volts.

Don't assume your sensor puts out exactly 12 Volts, if it's a solid state switch it will be a bit less.
 
C

Curt Wuollet

Google voltage divider. 10 mA is about the limit for 1/4 watt resistors. Something like a 2k ohm and a 500 ohm resistor should work pretty well. For long time use, 1/2 watt resistors would be best. Most ucontroller inputs draw negligible current.

Regards
cww
 
C

Curt Wuollet

Pardon me, I saw 12 but was thinking 24 V. Sub a 1k for the 2k. It's good to stay a little under 5 V for a 5 V device.

Regards
cww
 
Top