This example application aims to show how the A121 sensor can be implemented as a touchless button.
The application works for two different ranges, one close to the sensor and one further away. The intended close range is from the sensor to 0.05 m and the intended far range is from the sensor to approximately 0.24 m, but may register events slightly outside the range. The application works for further ranges as well if the sensor settings are adjusted.
The processor has three different measurement types; one for close range, one for far range and one for both. If both ranges are used the processor output will consist of two booleans, each indicating the button state for one range.
Each range consists of one subsweep and can therefore be modified separately.
The close range subsweep utilizes a shorter profile (
PROFILE_1) to be able to detect smaller objects such as fingers while the far range subsweep utilizes a longer profile (
PROFILE_3) and reacts on larger objects such as hands.
Each subsweep consists of a multiple number of points (
num_points), where each point corresponds to a distance.
All points are calibrated separately and continuously.
The threshold for each point is calculated from the number of frames received during the time set by
calibration_duration_s together with the sensitivity for each range (
The threshold will continuously be updated as long as there are no detections at any range.
Thus, the processor might show slightly different behavior when running both ranges at the same time versus running them separately on the same data.
The processor will for each frame determine if the sweeps are significantly above the threshold or not.
It will register a significant frame on the chosen range/ranges, when at least two sweeps at the same depth are above the threshold in the same frame.
The patience-setting (
patience_far) determines how many frames in a row must be significant in the chosen range to count as a detection.
It also determines how many frames in a row must be nonsignificant to count as the end of the detection.
Increasing the patience setting will make the button detect only slower movements and longer presence in front of the sensor, thus making the button less responsive.
Increasing the number of sweeps per frame will make the detection slower but increase the probability of a detection within the frame.
Since the data from the A121 sensor is complex, each data point includes both phase and amplitude information. The threshold takes advantage of both the real and imaginary part of the data and can be seen as an ellipsis-shaped boundary is the complex plane. A data point can pass the threshold by either a shift in phase (which would be caused by movement), a shift in amplitude (which would be caused by a more reflecting object) or both at the same time. Which in turn will trigger a detection.
- class acconeer.exptool.a121.algo.touchless_button.ProcessorConfig(*, measurement_type=MeasurementType.CLOSE_RANGE, sensitivity_close: float = 1.9, sensitivity_far: float = 2.0, patience_close: int = 2, patience_far: int = 2, calibration_duration_s: float = 0.6, calibration_interval_s: float = 20)#
- measurement_type: acconeer.exptool.a121.algo.touchless_button._processor.MeasurementType#
The measurement type.
CLOSE_RANGEcorresponds to a range of approximate 0 cm - 5 cm.
FAR_RANGEcorresponds to approximate 0 cm - 24 cm.
CLOSE_AND_FAR_RANGEgives two detection outputs, one for each range.
- sensitivity_close: float#
Sensitivity for close range detection. High sensitivity equals low detection threshold, low sensitivity equals high detection threshold.
- sensitivity_far: float#
Sensitivity for far range detection. High sensitivity equals low detection threshold, low sensitivity equals high detection threshold.
- patience_close: int#
Number of frames in a row above threshold to count as a new close range detection, also number of frames in a row below threshold to count as end of detection.
- patience_far: int#
Number of frames in a row above threshold to count as a new far range detection, also number of frames in a row below threshold to count as end of detection.
- calibration_duration_s: float#
Calibration duration in seconds
- calibration_interval_s: float#
Interval between calibrations in seconds. When reached a new calibration is made. Should not be set lower than the longest estimated continuous detection event.