I'm currently using pin 3 on my Raspberry pi to run one of my IR sensors. But I need to use 4 IR sensors for the purpose. Is it possible to connect all the 4 IR sensors to the same pin using a bread board and be able to differentiate among all the 4 IR sensors when I code for it. I'm making a Car with 4 IR sensors on all 4 sides, so as to detect any kind of obstacles and move without hitting any objects. Please help. Thanks a lot.

  • Please tell me if you're using analog or digital sensors? – Manav Jun 15 '17 at 13:35
  • It is a digital sensor. – Vijay Jindal Jun 15 '17 at 13:36

No, not connected to a simple digital input GPIO.

Two reasons:

  1. You can't differentiate between the sensors.
  2. Generally IR sensors actively set their outputs high or low. If a sensor raises an alarm its output will be overridden by the other sensors denying the alarm.

To use multiple sensors on the same GPIO they need to be part of a bus. Perhaps search for IR sensors which use the Dallas 1-wire bus or the I2C bus.

| improve this answer | |

Using digital sensors there is no way to differentiate between the 4 sensors on the same pin.

| improve this answer | |

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.