1

IR Infrared Sensor Module

What's the proper way to connect this IR Sensor Module to a GPIO input? I'm guessing it's output is 5v, not 3.3v that the GPIO wants.

  • I would use a level shifter, but first I would find out what the datasheet says. You may also be able to run it with 3.3v to VCC and not have a problem (though no guarantees). – Steve Robillard Dec 8 '15 at 3:14
  • I tried 3.3v VCC but the LEDs don't show any life. With 5v, one LED lights up and the other comes on when I wave my hand in front. I am able to drive a (5v) relay with the OUT line. – Mike Dec 8 '15 at 3:27
  • In that case I would go with a level shifter. You may have to do some searching if you are looking for one that can drive a relay or use a separate pin to control the relay. – Steve Robillard Dec 8 '15 at 3:31
3

Given that the device is sold as an Arduino module it probably does output at 5V.

A level shifter of some sort would be best to convert the 5V output to Pi safe 3V3.

I tend to use a couple of resistors as a voltage divider.

A couple of resistors with one twice the value of the other would be almost perfect giving a voltage of 3.333V from 5V. At a pinch you could use a pair of resistors with the same value as that would give 2.5V which will likely still be seen as high at the Pi.

  • Is there a resistor range that is more comfortable for the components? like 1 and 2 Ω, kΩ or MΩ? I suspecting the values might affect current. – Mike Dec 8 '15 at 13:02
  • You shouldn't source or sink more than 16 mA to a GPIO, so very low values are not a great choice. I tend to use resistors like 1k and 2K, but 10k and 20k should work as well. I guess the highest values which work would be most comfortable for the components. I'm a software type so treat what I say about electronics with caution. – joan Dec 8 '15 at 13:11
3

A level shifter is the safe option. They are not expensive. If you are just looking to drive a logic input a voltage divider should also work.

You state:-

I am able to drive a (5v) relay with the OUT line.

I don't see anything on the board that looks like it would drive a relay (unless you are talking about a relay module with logic input). Directly connecting a relay risks damaging the device.

  • Yes, it is a relay module that I usually drive with the Pi's GPIO out output. – Mike Dec 8 '15 at 4:05

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.