I'm trying to get going with the RPI-1391 sensor but I'm obviously doing something wrong.


I'm connecting it to a Raspberry Pi, where:

  • Pins 1 and 3 are connected to Pi's ground
  • Pin 2 is connected to physical pin 2 on the raspberry (5V)
  • Pin 5 is connected in series to a 270 ohm resistor which is connected to 5V on the raspberry as well
  • Pin 4 is connected to a GPIO pin set up to listen for changes in voltage configured with an internal pull-down resistor.

I tested my GPIO pin by supplying 3v to it directly from physical pin 1 on the raspberry and my program is successfully reading changes in the state.

With this setup I insert a piece of plastic in the sensor's opening and nothing happens, where I expect to see a changed state on my GPIO pin.

Things to consider:

  • Previously I connected the sensor's pin 5 directly to 5V before I knew better which should have burned the IR LED, however I tried connecting a white LED in series to pin 3 and then to the raspberry's ground and it very slightly lights up which means current is passing through the IR LED on the sensor which I'm assuming means that it's not burned?

  • When I measure the voltage after my 270 ohm resistor to raspberry's ground I'm reading 4.5V where I was expecting something along the lines of ~1.5V, since that's kind of the nominal voltage of the IR LED.

  • \$\begingroup\$ The 'Things to consider' part is a bit confusing, can you please add a schematic? \$\endgroup\$ – Richard the Spacecat May 28 at 11:06

Check your LED polarity; anode is meant to be the positive and cathode the negative electrode. You seem to have connected them the other way around. Also, don't forget the current-limiting resistor for the LED.

Also, this opto puts out up to 5V on its output. Your raspi will not like that.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.