Switch Photoelectric Sensor?

Status
Not open for further replies.

Hanalee

Member
Location
China, Hongkong
Occupation
Electronic Engineer
Good day, all
I am doing a project that use arduino uno to switch on and off a photoelectric sensor (according to the note Infrared Photoelectric Switch). How do i test the current of the output signal black wire as i worry that the arduino can only take in 5V and 40mA. I have connected the brown to 18V power supply, blue to collector of transistor and 5V supply to the base transistor.

Parts Used:
NPN photoelectric sensor
supply voltage 10-30V
output current <100mA
power consumption <20mA
NPN Transistor 2n3904
 
Someone gave me an idea, if the sensor's output is PNP type, I'll need to at least use a voltage divider, or something a bit more complex. The following is PNP type photoelectric sensor:
PNP type photoelectric sensor.jpg
According to the previous design, photoelecric sensors are switched by light, if the sensor output is "NPN open collector", can I use INPUT_PULLUP on the Arduino input pin? :unsure:
 
generally, if the output circuit is open collector you will need a pullup resistor on it. many inputs have this already included.
 
210630-1529 EDT

Hanalee:

See

At 12 V and 2.4 k you have less than 5 mA of current that can be fully switched. So the pullup resistor and power source voltage in the Arduino will determine whether you can fully switch the logic input without amplification. Going to a 24 V supply will approximately double this current level.

..
 
210630-1655 EST

petersonra:

The photosensor shown is essentially a pullup device, the PNP output switch. Thus, no pulldown capability.

If electrical isolation, the 4N35 optical coupler, is not required, then a far simpler solution is a single NPN transistor, like a 2N4400, and the 2400 ohm resistor would be fine to limit 2N4400 base current. Current switching capability would be greatly increased. I would also likely add a 1000 ohm shunt resistor from the 2N4400 base to emitter.

.
 
... According to the previous design, photoelecric sensors are switched by light, if the sensor output is "NPN open collector", can I use INPUT_PULLUP on the Arduino input pin? :unsure:
Setting the pinMode () in Arduino to INPUT_PULLUP will connect an internal 20K pull up resistor to 5V. That should work with a photo sensor that has an open collector NPN output.
You could also tie your own pull up resistor to a 5V supply instead.
 
210630-1655 EST

petersonra:

The photosensor shown is essentially a pullup device, the PNP output switch. Thus, no pulldown capability.

If electrical isolation, the 4N35 optical coupler, is not required, then a far simpler solution is a single NPN transistor, like a 2N4400, and the 2400 ohm resistor would be fine to limit 2N4400 base current. Current switching capability would be greatly increased. I would also likely add a 1000 ohm shunt resistor from the 2N4400 base to emitter.

.
It is hard to know what is actually in the output of the PE. The circuits they show usually are incomplete but most of the them don't require a pull down resistor, at least the ones I have used. But, you never know.
 
Status
Not open for further replies.
Top