CN0569 User Guide5/5/2022
- Bill of Materials
- Layout Files
- Assembly Drawing
- EVAL-ADICUP3029 ($52.97) Ultralow Power Cortex-M3 Arduino Form Factor Compatible Development Board
- EVAL-CN0569-PMDZ ($42.80) Infrared Light Angle Sensor Module for Gesture Recognition
- Highly Integrated Optical Front End
- Dual Light Sensors for Intensity and Directionality Measurements
- Open Source Gesture Detection Algorithm
Touchless user interfaces are a fast-growing technology trend, with increasing popularity in healthcare, access control, and consumer based products. This technology enables human-machine interaction without direct physical contact. These systems utilize gesture recognition techniques to look for bodily motion such as hand waving or "swiping" and interpret those movements as commands. This method of interaction relies on data captured by light sensitive devices like cameras or light sensors.
Vision and optic-based systems are only dependent on reflected light. This is ideal for public spaces and noisy environments, where the background noise and ambient sounds make it difficult for language based touchless user interface systems to accurately capture data.
The circuit shown in Figure 1 is a low cost, optical system for common gesture recognition applications. This reference design transmits pulses of infrared light into space and reads the reflected light data received by the light sensor. A gesture object (such as a human hand) which moves into this space reflects infrared light onto the light sensors. The reference design then detects this light and generates a response based on the object’s position.
The typical gesture sensing range is up to 20 cm and the sample rate is up to 512 samples per second, allowing the response time and noise rejection to be adjusted to suit the application's specific requirements.
The I2C Pmod form factor makes this reference design easy to connect up to an external development platform. Algorithms can be developed on a host computer in a high level language, such as Python or MATLAB, then ported to an embedded implementation.
With gesture recognition, a user interface is able to detect hand movements and patterns and translate them to commands. This technique requires the system to perform three basic functions:
- Detect the beginning and end of a gesture.
- Track hand movement during the gesture.
- Identify the gesture based on the hand movement.
Infrared Light Angle Sensor
The core of the circuit is the ADPD2140 infrared light angle sensor. This device performs 2-axis, single-point measurement of incident angles for infrared light, and multiple devices can be used to triangulate distance. The ADPD2140 has a radiant sensitive area of 0.31 mm2, divided into four photodiode channels with a common cathode terminal. When operating at a reverse voltage of 0.2 V, all four channels achieve ultralow typical values for junction capacitance and reverse dark current (12.7 pF and 1.74 pA, respectively). Additionally, the ADPD2140 does not require precise alignment because its sensor maintains a linear response within the ±35° angular field of view.
The ADPD2140 package includes a built-in optical filter with a sharp cutoff of visible light, eliminating the need for external lenses and preserving the dynamic range of the sensor when placed under sunlight or indoor lighting. When selecting a source of infrared light for this design, it is important to choose a part that operates at a wavelength above 800 nm so the light can pass through the internal optical filter of the ADPD2140. The light source should also be placed at a distance from the sensor such that the reflected light falls within the ±35° field of view. In this reference design, a single 850 nm infrared emitter serves as the light source and is placed 6 mm away from the first ADPD2140 and 19 mm away from the second, as shown in Figure 2. A 3D printed baffle is placed around each ADPD2140 to restrict incident light to within approximately ±35°, as intense light at steeper angles can contaminate the measurement.
Photometric Front End
The photometric front end in the CN0569 is the ADPD1080; it is a highly integrated device that includes LED drivers, transimpedance amplifiers, integrators, analog-to-digital converter (ADC), digital signal processing, and an I2C interface.
The ADPD1080 is responsible for pulsing the infrared LED, sensing the ADPD2140 response, converting the analog photocurrents to digital codes, and sending the data to an external microcontroller via I2C. With eight parallel, high performance photodiode input channels and compact design, the ADPD1080 can be used with the ADPD2140 to create a discreet, low cost solution for light angle sensing using synchronized LED pulses.
The CN0569 uses two ADPD2140 infrared light sensors connected to the ADPD1080, facilitating both gesture and distance sensing. Figure 3 shows a simplified block diagram of a typical measurement channel.
The ADPD1080 has three LED drivers (LEDX1, LEDX2, and LEDX3) that can be used to power external LEDs. These LED drivers operate as current sinks, and the average current drawn by each from the LED supply can be calculated using Equation 1:
ILED_AVERAGE is the average current drawn by the LED driver from the LED supply in mA.
ILED_PEAK is the peak current setting of the LED driver in mA.
tLED_PULSE is the LED pulse width in μs.
tLED_PERIOD is the LED pulse period in μs.
As shown in Equation 2, the peak current setting of an ADPD1080 LED driver is a product of three factors: the coarse current setting, the fine current setting, and the current scale factor.
ILED_COARSE is the coarse current setting of the LED driver.
ILED_FINE is the fine current setting of the LED driver.
LED_Current_Scale is the current scale factor of the LED driver.
The values of these factors are based upon the LED control registers of the ADPD1080:
- For adjusting the coarse current settings, use ILED1_COARSE, ILED2_COARSE, and ILED3_COARSE.
- For adjusting the fine current settings, use ILED1_FINE, ILED2_FINE, and ILED3_FINE.
- For selecting the current scaling factors, use ILED1_SCALE, ILED2_SCALE, and ILED3_SCALE.
The coarse current setting of an LED driver has a base value of 50.3 mA, and increases by 19.8 mA with each LSB. Likewise, the fine current setting of an LED driver has a base value of 0.74 mA, and increases by 22 μA with each LSB. The final values for these settings can be calculated using Equation 3 and Equation 4 respectively. The current scale factor is limited to only two options, either 10% or 100% depending on the value of the ILEDx_SCALE bit. The current scale value can be calculated using Equation 5. For more details on the LED control registers, refer to the ADPD1080 data sheet.
ILEDx_COARSE is the decimal value of the LED control register bits.
ILEDx_FINE is the decimal value of the LED control register bits.
ILEDx_SCALE is the binary value of the LED control register bit.
To avoid damaging the LED, the peak current setting needs to be set such that it does not exceed the actual forward current rating and pulse handling capability of the infrared LED.
During a sampling period, the LED is pulsed, and the transimpedance amplifier stages convert the photodiode currents into voltages. These output voltages are then integrated within a window programmed for the time slot. The width of this integration window is set by the SLOTA_AFE_WIDTH register for Time Slot A and the SLOTB_AFE_WIDTH register for Time Slot B, with each bit corresponding to 1 μs of integration time.
The LED is then switched off and integrated in the opposite polarity for the same amount of time, after which the integrator output is digitized by the ADC. This synchronous sampling sequence rejects ambient light, as the measurement is only dependent on light reflected from the LED.
The ADPD1080 measurement path is highly configurable; the transimpedance gain, integration time offset, averaging, and other parameters can be adjusted to suit the end application. Refer to the data sheet for the complete information.
The data measured by the ADPD1080 from the photodiodes can be used to discern basic hand movements when processed by a gesture recognition algorithm. A simple but effective method of gesture recognition is described in the ADPD2140 data sheet, which can be applied to the CN0569.
- Calibrate the 32 kHz and 32 MHz clocks of the ADPD1080 following the procedure provided in the ADPD1080 data sheet.
- Set the MODE register to Normal Operation.
- Read the photocurrent data from the ADPD1080 registers using the first in, first out (FIFO) and interrupts.
- Subtract the ADPD1080 ADC offsets from each channel. The SLOTA_CHx_OFFSET, SLOTB_CHx_OFFSET registers contain the ADC offsets for Timeslots A and B, respectively, for channels 1 to 4.
The default value for all offsets is 0x2000. To modify these offsets, measure the 16-bit output of each channel in ADC codes and add it to the existing 16-bit number in the ADC offset register, SLOTx_CHx_OFFSET (nominally 0x2000). Then, write to the ADC offset register with this result. When the offsets are correctly subtracted, the intensity reading L is close to zero codes with no objects in the sensor field of view.
- Calculate the light intensity from the photocurrent data using Equation 6:
- Monitor the light intensity. The start of a gesture is indicated by the intensity value going above the preset threshold. The threshold should be set to 1000 codes by default but can be changed depending on the application. Figure 4 shows typical static readings for a hand held at 12.7 cm and 30.5 cm away from the sensor.
- At the start of a gesture, calculate the angular positions of the gesture object using the following equations:
- Continue monitoring the light intensity. After a preset number of samples (five samples by default) have been monitored, start checking for the end of the gesture. The end of a gesture is indicated by the intensity dropping below the preset threshold.
- At the end of a gesture, calculate the new angular position values of the gesture object using the above equations.
- Calculate the distance between the starting and ending angular positions and its slope using the following equations:
- Determine the type of gesture based on the angular position values at the start and at the end of the gesture, the distance, and the slope between those points. The gesture can be interpreted using the following criteria:
- If d is less than a preset threshold or if |m| = 1, the gesture is a "click".
- If |m| > 1 and ySTART > yEND, the gesture is a "swipe up".
- If |m| > 1 and ySTART ≤ yEND, the gesture is a "swipe down".
- If |m| < 1 and xSTART > xEND, the gesture is a "swipe left".
- If |m| < 1 and xSTART ≤ xEND, the gesture is a "swipe right".
Figure 5 and Figure 6 show typical intensity (Equation 6) and angle (Equation 7 and Equation 8) calculations for "Swipe Up" and "Swipe Down" gestures. In these data sets, the object is held at approximately 5 cm above the ADPD2140 and LED. The intensity measurement in Figure 5 determines the beginning and end of the gesture, while the angular position shown in Figure 6 then determines which gesture occurred. Note that the “swipe direction” is arbitrary and based on the orientation of the device within a specific application.
Power Regulation and Level Translation
The CN0569 is compatible with 3.3 V Pmod platform boards, but the ADPD1080 requires a 1.8 V supply.
The LT1761 is a low noise, low dropout, micropower regulator that has a wide input voltage range of 1.8 V to 20 V and a maximum output current of 100 mA. The fixed 1.8V variant requires input, output, and noise reduction capacitors.
As the ADPD1080 uses 1.8 V logic for its digital lines, a level translation feature is included in this reference design to ensure compatibility with controller boards running on 3.3 V logic. For the ADPD1080 I2C bus, the data and clock lines are passed through an LTC4313-3 - a hot swappable, 2-wire bidirectional bus buffer that also supports level translation to 1.8 V. Figure 7 illustrates the connection setup of the ADPD1080 I2C bus data and clock lines to the LTC4313-3.
Similarly, for the ADPD1080 GPIO0, the data line is passed through an ADG3301 single-channel, level translator.
A vertical cavity surface emitting laser (VCSEL) can be used in applications requiring greater sensing ranges. The ADPD1080 LED drivers can be disabled and a GPIO pin can be configured to trigger a VCSEL driver instead.
The on-board LED is driven by a single LEDX output, providing a maximum pulsed current of 370 mA. Up to 3 LEDX outputs may be connected in parallel to provide up to 1.11 A LED drive to a high intensity external LED.
This section covers the setup and procedure for evaluating the CN0569 Circuit Evaluation Board using the ADICUP3029 development platform.
For complete details on using the EVAL-CN0569-PMDZ, refer to the CN0569 User Guide.
The following equipment was used:
- EVAL-CN0569-PMDZ Circuit Evaluation Board
- EVAL-ADICUP3029 Development Platform
- Host PC (Windows, Linux, or Mac)
- Python 3.6 or Higher
- CN0569 Theremin Python Script
- Micro USB Cable
Setup and Test
To run a basic gesture sensing demonstration based on the algorithm listed above, follow the below procedure:
- Connect the EVAL-CN0569-PMDZ Circuit Evaluation Board to the EVAL-ADICUP3029 Development Platform through the I2C Pmod port.
- Using the micro USB cable, connect the EVAL-ADICUP3029 Development Platform to the computer. Refer to Figure 8 for the system test setup.
- Once connected to the computer, upload the prebuilt HEX file to the ADICUP3029 by dragging the file to the DAPLINK drive. Refer to the user guide for the latest HEX file.
- Press the 3029_RESET button (S1) on the EVAL-ADICUP3029 Development Platform.
- Run the CN0569 theremin python script on the computer.
- Perform hand gestures over the CN0569 reference design board and observe the gesture readings on the computer terminal.