How to integrate a proximity sensor
Showcase, June 30, 2016 - 4:29pm, 1363 views
For applications which don't require a very accurate distance measurements, instead of a high precision Ultrasonic Distance Sensor, we may use a much cheaper IrDistance sensor. It will not be as accurate as Ultrasonic, but will enable our device to distinguish if something is empty/full (e.g. trash container) or open/closed. While US distance sensor's accuracy is about 1cm IR sensor is about 2-5cm. It is fairly enough for wide variety of apps. It is also very easy to integrate with the ConceptBoard.
- We have used typical Infrared Proximity Sensor - Sharp GP2Y0A21YK (e.g. https://www.sparkfun.com/products/242)
- sensor has three lines, they need to be connected to GND, 5V and Analog Digital Converter (we have used ADC2 on ConcepBoard's ADC multiplexer)
- converted values may differ depending on type of IR sensor. They can be aligned by conversion tables DISTANCES/VOLTAGES in IrDistanceSensorReader class