IR distance click carries Sharp’s GP2Y0A60SZ0F distance measuring sensor, which comprises of an integrated PSD (position sensitive detector), an infrared LED and a signal processing circuit. The measuring range is between 10 and 150 cm. The click is designed to run on either 3.3V or 5V power supply. It communicates with the target MCU over RST and AN pin on the mikroBUS™ line.
The sensor on IR distance click is not easily influenced by variations caused by the reflectivity of the object whose distance is measured (it won’t be able, however, to detect the distance of a mirror). For optimal operation the lens should be kept clean, because dust, water or oil on its surface can impact the precision of the sensor.
With these precautions in mind, the IR distance can be used for designing touch-less switches, various energy-saving devices, but it’s also suitable for robotics.
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.
IR distance click features an SMD jumper (zero ohm resistor) that let’s you switch between a 3.3V or a 5V power supply.
MIKROE-1991Type | Optical |
Applications | Touch-less switches, various energy-saving devices, robots |
On-board modules | Sharp’s GP2Y0A60SZ0F distance measuring sensor |
Key Features | 10 to 150 cm measurement range. Sensor consists of PSD, IR LED, and signal processing IC |
Key Benefits | Long range. Not easily influenced by reflectivity of object |
Interface | GPIO |
Input Voltage | 3.3V or 5V |
Compatibility | mikroBUS |
Click board size | M (42.9 x 25.4 mm) |
This table shows how the pinout on IR distance click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Code examples for IR distance click, written for MikroElektronika hardware and compilers are available on Libstock.
This example initializes the ADC, UART and the IR distance board, and in an endless loop measures distance in centimetres and displays the result on the UART port.
01 void system_init() 02 { 03 ANSELA = 0x04; 04 TRISA = 0x04; 05 LATA = 0; 06 07 ADC_Init(); 08 UART1_Init( 57600 ); 09 ir_measure_init( ADC_Read, 2, RESOLUTION_10 ); 10 UART1_Write_Text( "Here and Readyrn" ); 11 } 12 13 void main() 14 { 15 char tmp_text[20]; 16 17 system_init(); 18 19 while( 1 ) 20 { 21 sprintf( tmp_text, "Distance is: %4.2frn", ir_measure_cm() ); 22 UART1_Write_Text( tmp_text ); 23 Delay_ms( 500 ); 24 } 25 }
Key features