Infrared Proximity Sensor with Raspberry Pi Pico

Description: When an object moves in proximity of the IR Transmitter, infrared light sent from IR Transmitter bounces back from the object and is detected by the IR Receiver which then triggers the LED to turn ON.

Infrared Proximity Sensor with Raspberry Pi Pico

Notes: A 10k Resistor helps keep the voltage passing from the IR receiver to analog pin 26 in a readable range. Also, this IR Receiver is best used in low light or nighttime scenarios as any ambient or direct light that contains infrared will interfere with the real-time analog values.

Supplies:

1 – Breadboard 400 Points
1 – Raspberry Pi
1 – IR Transmitter 940nm LED Diode
1 – IR Receiver 940nm LED Diode
1 – 10K Ohm Resistor
1 – 330 Ohm Resistor
1 – LED
1 – 220 Ohm Resistor

Arduino Code:

#define led 15

int ifRead;

void setup() {

  Serial.begin(9600);
  pinMode(26, INPUT);
  pinMode(led, OUTPUT);

}

void loop() {

  ifRead = analogRead(26);  
  Serial.println(ifRead);

  if(ifRead >= 400 ) {
    digitalWrite(led, HIGH);
  } else {
    digitalWrite(led, LOW);
  }
}

Comments

Leave a Comment

98 − = 97