Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Photo interrupter Connections

For The Popcorn

Well-Known Member
Most Helpful Member
My vending machine controller project is continuing along.

My current issue is reading the drum speed sensor - a slot type photo interrupter. The schematic has the following detail. I don't think this is correct, as the negative side of the LED is connected is connected to the collector of the NPN transistor. (which most types of photo interrupters seem to be.) Is there any way this illustration makes sense.

The second illustration shows the circuit as I think it should be.



optical sensor 431.jpg





photo interrupter circuit.jpg
 
I don't know. It's located deep in the machine. Getting to it requires pulling out the motor which requires driving out several pins.
 
Hey the light direction is backwards too but then it has only 3 wires and is shown with "positive logic", Light on = +V out.
Green is ground
Red is current limited say 10 mA e.g. +(5V-2)/300 ohms
White is pulse out 3V optical open, 0 V blocked. ( with no pullup) If schematic and results are correct. add 10k~100k Output to ground.
If "negative logic" then use a pull up on output. Blocked light = +V out.
 
Last edited:
Good catch on the color codes – I didn't think about looking at leaded sensors.

I have the OEM board (which I an replacing/upgrading) in hand, so I'll trace the connections to find my error.
 
I think I have this figured out now, after tracing out the board. When looking at someone else's design, the question often is "Why did they do it this way?"

The LED is connected to the +24V source via a 1k resistor. The transistor is in series with the LED (which explains why the connections seemed wrong. The junction of the LED/transistor is connected to ground via a 1k resistor, which puts about 10mA through the LED when the transistor is off....and the junction point should be roughly 12 volts.

The emitter is connected to ground via an 18k/10k voltage divider, which will result in a pulse of ~ 5V.

I guess this circuit design will make a short pulse, as the LED current drops to near nothing when the transistor switches on?

Schematic_431 optical sensorcircuit_2025-06-11.png
 
On second thought, the LED stays on when the transister fires....so I don't entirely get why they did it this way.
 
I don't entirely get why they did it this way.

Probably because it works and it seemed like a good idea at the time.

Also consider that when the project was done, the designer thought to himself
"I am not doing opto switches like that ever again".

JimB
 
designer thought to himself
"I am not doing opto switches like that ever again".

LOL true! Maybe the phototansistot won't tolerate 24v.

I should have taken time to understand the circuit before I designed my board, but I didn't understand and was unsure about the opto sensor connections and I was working to beat the tariffs......
 
Possibly.

Fortunately I've found the error in my circuit. All of the dozen or so sense switches in this machine are supplied 24 VDC and the output goes through a 39k/10k voltage divider to provide a 5v signal when activated. Why change what has worked for 30+ years?*

I my haste to get the boards made before the tariff insanity started, I didn't study the encoder circuit in depth and figured 24v sensor supply --> 24v sensor signal, so the 39k/10k divider should work great.

The 18.8k/10k voltage divider provides about 5v from a 14 volt signal. With my 39k/10k divider, the output is less than 3 volts with a 14 volt signal. Swapping resistors should solve it.


* The original board I'm replacing was solely an interface board, sending signals to another microcontroller control board. It used two 74HC253 dual 4:1 data selectors with tri-state outputs to send the switch and encoder signals to the control board. All 4 outputs were connected to a single data line for the remote micro to read. This arrangement would all you to scan through all of the inputs quickly or to lock onto one signal continuously – like the encoder signal – but that sure sounds like a lot of extra effort to me! I'm reading the switches with a MCP23017 16 channel port expander and sending the encoder signal to the PIC18F micro's timer 1 input. Not all old technology should be replicated
 

Latest threads

Back
Top