close
insta

Overview

Continuing our investigation about the APDS-9960 module, the integrated proximity sensor can sense distances up to a few centimeters (~6 centimeters).

In this simple project, 4 LEDs will be turned on via distance thresholds.

Hardware Used

Software Used

  • Arduino IDE

Libraries Used

Since we are using the same module, the Adafruit Library will be enough for this simple mini-project.

Application Description

According to www.ia.omron.com, there are three types of proximity dection systems : sensing metallic objects via eddy currents, recognizing electrical capacity changes in approaching objects, and utilizing magnets and reed switches.

For this particular module, An IR LED emits an infrared radiation (IR light) which bounces off on any nearby object or surface. The proximity distance is measured by the reflected IR light received by a photodiode. If the distance between the object and sensor is near, the reflected IR light intensity will be greater than distances afar. Thus the photodiode voltage increases in proportion to the IR light received, or distance.

Proximity Sensor in Action From (https://www.quora.com/How-do-proximity-sensors-work)

Since we are using the similar set-up from the gesture sensor, the only changes are the arrangements of pins and its corresponding pin numbers.

 

Set-up the Hardware

The hardware is pretty straightforward to set-up.

Code

 

Code Breakdown

This function returns TRUE when the the APDS-9960 is detected. Otherwise it will return FALSE.

As the name implies, it enables the proximity sensor of the module.

This function returns the converted analog signal to discrete digital levels, which ranges from 0 to 255.

This snippet of code compares if the “proximity_data” is greater than the set distance thresholds. If it is greater, then the corresponding LED lights up. Otherwise the LED is turned off.

More library codes/functions are not used but explored below.

The arguments above adjusts the proximity sensor’s gain. To use the arguments, call the function in setup().

where “GAIN” is one of the arguments shown above.

These functions will enable the Proximity Interrupt feature of the module. If enabled, the following functions can be used.

Conclusion

The Gesture sensor can sense proximity and, with a few calibrations, return distance in centimeters or inches. It works by  using a photodiodes to sense the reflected IR light. As such, ambient light (from nearby light sources) can affect the proximity threshold.

 

References

https://learn.adafruit.com/adafruit-apds9960-breakout/arduino-wiring-and-test

https://cdn.sparkfun.com/assets/learn_tutorials/3/2/1/Avago-APDS-9960-datasheet.pdf

https://www.ia.omron.com/support/guide/41/introduction.html

Tags : APDS-9960APDS-9960 ProximityarduinoGesture Sensorlight sensorProximityProximity Sensor

Leave a Response