Introduction: Raspberry Pi Pico and Proximity Sensor

About: Myself Ramji Patel, I am an Electronics and Communication Engineering Student and hobbyist and project designer.

INTRODUCTION:

In this instructables I am going to show you how you can interface the IR proximity sensor with raspberry pi pico. Combining the raspberry pi pico board and the IR Proximity sensor, I create an obstacle detector that detects the objects whenever they pass through in front of the sensor. So let's get started.

Supplies

Step 1: IR Proximity Sensor

OVERVIEW:

An IR (infrared) proximity sensor is a type of sensor that detects the presence of objects or obstacles within a certain range by emitting infrared radiation and measuring the amount of reflection or absorption of the signal. These sensors emit a beam of IR light and measure the time it takes for the light to bounce back to the sensor after hitting an object. sensor is an active sensor that detects obstacles(objects) whenever they pass through in front it. We can also adjust the sensitivity of the Proximity sensor. Proximity sensors are of following types

  1. Capacitive Proximity Sensor
  2. Inductive Proximity Sensor
  3. IR Proximity Sensor
  4. Ultrasonic Proximity Sensor

Here, I am going to use IR proximity sensor.

Working of IR Proximity Sensor:

An IR (infrared) proximity sensor is a type of sensor that detects the presence of objects or obstacles within a certain range by emitting infrared radiation and measuring the amount of reflection or absorption of the signal. These sensors emit a beam of IR light and measure the time it takes for the light to bounce back to the sensor after hitting an object.

Step 2: Making a Prototype Circuit on Bread Board

To make a prototype circuit on a bread board, we can take the help of the given schematic diagram. First fix the pico board and IR proximity sensor on the bread board. Now connect the pins of the IR proximity sensor as following wiring scheme:

VCC---------->VBUS

GND---------->GND

DO----------> GPIO-15

After connecting the IR proximity sensor. we are ready to connect the buzzer. Fix the buzzer on the bread board and connect its pins according to following wiring scheme:

+V---------->GPIO-14

GND----------GND

Finally our prototype is done, Connect the raspberry pi pico to the laptop with USB Micro-B cable.



Step 3: Writing a Micro Python Program

from machine import Pin

led = Pin(25, Pin.OUT)  #set GPIO-25 pin mode as OUTPUT
sensor = Pin(15, Pin.IN) #set GPIO-25 pin mode as INPUT
buzzer = Pin(14, Pin.OUT) #set GPIO-25 pin mode as OUTPUT

while True:
  if sensor.value() == 0: #read the value of the sensor pin and compare it with 0
    led.value(1)     #set led pin HIGH if sensor pin is LOW
    buzzer.value(1)   #set buzzer pin HIGH if sensor pin is LOW
  else:
    led.value(0)     #set led pin HIGH if sensor pin is HIGH
    buzzer.value(0)   #set buzzer pin HIGH if sensor pin is HIGH

 

   

  

 


Step 4: Watch the Video