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.
No, not connected to a simple digital input GPIO.
- You can't differentiate between the sensors.
- 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.