Getting Started with IR Distance Click

Getting Started with IR Distance Click

Last Updated on 25 July 2017

INTRODUCTION

IR distance click carries Sharp’s GP2Y0A60SZ0F distance measuring sensor. The sensor module comprises an integrated PSD (position sensitive detector), an infrared LED and a signal processing circuit. The measuring range is between 10 and 150 cm.

 

The sensor is not easily influenced by the reflectivity of the object, but it is important to keep the lens clean. The click board outputs an analog voltage corresponding to the distance of the object (through the mikroBUS™ AN pin). An Enable (EN) pin is also utilized.

 

The board is designed to use either a 3.3V or a 5V power supply.

 

Features:

  • 10 to 150 cm measurement range.
  • Sensor consists of PSD, IR LED, and signal processing IC.
  • Can use either 3.3V or 5V power supply.
  • Analog output.
  • Supported in all MikroElektronika compilers.
  • Application: Touch-less switches, various energy-saving devices, robots.

HARDWARE PREPARATION

This tutorial is required the following items:

1. IR Distance Click comes with unsoldered header pins, so you have to solder them on your own as a good hardware connection will help a lot to accomplish your project. You can follow the following steps.

Put the header pins into breadboard.

Insert IR Distance Click into header pins and solder each pin properly.

 

2. By default, IR Distance Click is set to working at 3V. You can change it to 5V by desoldering the 0 ohm jumper and soldering it to the 5V pad. For beginners, we recommend to stick at 3V and using the following connections:

 
CONNECTIONIR Distance ClickArduino Uno
Operating Voltage3V33.3V
GroundGNDGND
Input SignalOUTA0

PROGRAMMING

The output from the IR Distance Click is analog, we can test this sensor first by displaying ADC and voltage from the OUT - A0 pin. Upload the code to Arduino Uno then open Serial Monitor with 9600 baud rate. You will get the following result.

Yes the sensor is working well, when I put the object near to the sensor, the voltage goes high (~2V), when no object, the reading shows below 0.5V. The next step, is figuring out how to determine the distance in cm. Here, you can refer to the Sharp’s GP2Y0A60SZ0F datasheet to know the sensor characteristics in order to determine the relation between voltage and distance.

 

Below is the Electro-optical Characteristics table for Sharp’s GP2Y0A60SZ0F:

The first table is for 3V operating voltage and second table is 5V operating voltage. For this tutorial, we will refer to the 3V table. The 2 parameters that are related to distance calculation are Output Terminal Voltage and Output Voltage Difference.

  • Output Terminal Voltage: Voltage reading for L = 150cm.
  • Output Voltage Difference: Voltage different between L = 10cm and L = 150cm.

Now, you can create a formula based on the data above to get the distance in cm.

 

So, thank you for reading this post, I hope it helps on your project journey. All the best! :)

REFERENCES

  1. IR Distance Click Product Page.
  2. IR Distance Click MikroElektronika.
  3. GP2Y0A60SZ0F datasheet.

If you have further questions, please go to our technical forum as we seldom check the comment here. Thanks and have a good day!

Related Products