Arduino Tutorials – Lesson 30 – Sharp Distance IR Sensor Module (2Y0A02 F 5x) using ARDUINO UNO

Creating distance of the target object in the range of (20-150) cm detect program using Arduino UNO

Required Components

  1. Arduino Uno Board -1 no
  2. Sharp IR 2Y0A02 F 5x sensor -1 no
  3. Data Cable -1 no
  4. Jumper wires -3 no

Circuit

Steps

  1. Make sure the components are working properly.
  2. Connect Sharp distance Sensor board VCC, GND to 5V, GND of Arduino Uno Board.
  3. Connect Sharp IR 2Y0A02 F5x sensor Board data pin to the Arduino Uno Board A0 pin.
  4. Check the Arduino program.
  5. Check the Circuit Connections.
  6. Run the Arduino program.

Arduino Program

#include <SharpIR.h>
#define ir A0
#define model 20150
SharpIR SharpIR(ir, model);

void setup() 
{
  Serial.begin(9600);
}

void loop() 
{
  delay(2000);   
  unsigned long pepe1=millis();
  int dis=SharpIR.distance();  
  Serial.print("Mean distance: ");  
  Serial.println(dis);
  
  unsigned long pepe2=millis()-pepe1;  
  Serial.print("Time taken (ms): ");
  Serial.println(pepe2);
}  

Usage

  1. Touch-less switch (Sanitary equipment, Control of illumination, etc., )
  2. Sensor for energy saving (ATM, Copier, Vending machine, Laptop computer, LCD monitor)
  3. Amusement equipment (Robot, Arcade game machine)

Leave a Reply

Your email address will not be published. Required fields are marked *