Help Connecting slotted optical sensor HOA6991

I need some assistance getting a circuit up and running. I am attempting to connect a slotted optical sensor (HOA6991) to an arduino board and get to the point that I can use the output of the sensor to control software events, but I cant get the sensor to perform the way I expect it to.

This sensor has five wires, two for the IR emitter portion of the sensor and two for the IR detector, along with another wire in the detector for the signal (output). When I hook the circuit up the way I believe it should work:

Black wire Cathode in the ground, a resistor to shorten the voltage (330ohm), and a red wire anode in the 5Vcc for the emitter.

For the detector:
Green in the ground, white in the 5Vcc and the blue wire is connected to a digital port, so I can monitor the output via serial port.

Hooked up in this manner, the output from the blue wire to the board read 0, and no matter what I do, I cannot get the system to work the way I want (i.e. respond to something in the gap).

I’m using an Ardunio Mega, and uploading a very basic monitoring sketch using the IDE.

Q: The output from the sensor (the value) is it the voltage, current, what? Where does that number come from? Perhaps that would help me figure out what is wrong about my expectations…

Much appreciated,


This sensor has an open collector output so you need to have a pull up resistor. Put one from the digital input to +5 or enable the internal ones. Also use a 100R resistor in place of the 330R you are using in the emitter side.

Got it set up as suggested, and it is working great, thank you so much for your help!