Hand Motion Detection#
The purpose of the hand motion detection algorithm is to detect the presence of a pair of hands in front of the faucet in a sink. In the typical application, the goal is to minimize the water consumption by turning the faucet on and off, based on the output of the algorithm.
To achieve low power consumption, thereby enabling the usage of battery, the hand motion detection algorithm is paired with the Presence Detector, monitoring the presence of a human in the vicinity of the sink. If presence is detected, the application switches over from the presence detector mode to the hand motion detection mode. Once hand motion is no longer detected, the application switches back to the low power mode.
Algorithm outline#
The hand motion detection algorithm detects the presence of a pair of hands moving in front of the sensor by calculating the amount of variation of the data within a frame and over consecutive frames. The result is compared to the noise floor of the system and finally compared to a user defined threshold.
A number of configuration parameters are available (see later section in this guide), controlling the responsiveness and robustness of the algorithm.
Algorithm modes#
The algorithm can run in the following two modes:
PRESENCE
: Presence detector, configured to run at low power consumption.HANDMOTION
: Hand motion detection, designed to be responsive.
The current running mode is returned as part of the application result through the variable
app_mode
.
The algorithm can be configured to only run in the hand motion detection mode if power consumption is not a requirement.
Configuration#
The configuration is divided into three subsets of configuration parameters.
Example application configuration
The example application configuration handles the switching between the presence mode (low power) and the hand motion detection mode.
use_presence_detection
: Controls whether or not to use the presence detector based low power mode. In a battery driven application, the usage of this mode will increase the battery life time. If the system is driven by power from the grid, and power consumption is not an issue, this mode can be disabled.hand_detection_timeout
: Controls the duration in the hand motion detection mode without detection before returning to the low power mode.
Presence detection configuration
For details on the presence detector configuration and how to configure, follow this link.
Hand motion detection configuration
The configuration has three parameters, related to the physical installation of the sensor and geometry of the faucet. The parameters are described below, followed by picture, illustrating their relationship.
sensor_to_water_distance
: The distance from the sensor to the center of the water jet (m).water_jet_width
: The water jet width. Note, when setting this parameters, it is good to consider the maximum variation of the water jet over the life time of the system, including clogging and other sources of water jet width variation (m).measurement_range_end
: End point of the measurement range (m). The end of the measurement range is the location where the detection of the hand should start, for instance the end of the sink.
The range related sensor configuration parameters are automatically determined based on these three configuration parameters, including the usage of subsweeps, utilized to capture data in front of and behind the water jet, while avoiding effects from the motion of the water jet.
Next, the following three parameters are related to the responsiveness and robustness of the detection:
filter_time_const
: Filter time constant of the algorithm. A higher value yield a more robust but less responsive performance.threshold
: The threshold against which the detection metric is compared to.detection_retention_duration
: Duration of retaining the detection after the metric is below the threshold. Setting the time to 0 s disables the retention.
Lastly,
hwaas
,
sweeps_per_frame
,
sweeps_rate
and
frame_rate
are all sensor configuration parameters.
For more information regarding these parameters see Configurations.
Configuration hints#
The following hints should be used as a starting point when setting up application, from which further manual tuning might be needed to optimize the performance.
With the water turned off, adjust
filter_time_const
,threshold
anddetection_retention_duration
to get desired response.Set the parameters
sensor_to_water_distance
,water_jet_width
andmeasurement_range_end
according to the sensor installation and faucet setup.Make sure that the algorithm does not detect running water by starting the water flow and observing the hand motion metric, visualized in Exploration Tool. If the water causes the metric to go over the threshold, increase
water_jet_width
to further increase size the region not being measured an/or increase thethreshold
.Tuning the parameters of the presence detector is easily done in the Presence Detector application, available in Exploration Tool. Once a satisfactory configuration is found, transfer the parameters back to this application.
Result#
The result object contains the complete result from the underlying presence detector and
hand motion example application, in the two members
presence_result
and
hand_motion_result
.
But more importantly, it also contains the two following members
app_mode
indicating the current operation mode of the applicationPRESENCE
- Detecting presence in the vicinity if the sink.HANDMOTION
- Presence has been detected. Now scanning for hand motion in the vicinity of the faucet.
detection_state
indicating the state of detection when running in the hand detection mode.NO_DETECTION
- No hand detected.DETECTION
- Hand is currently being detected.RETENTION
- Hand has previously been detected. Retaining detection fordetection_retention_duration
seconds.
Configuration classes#
- class acconeer.exptool.a121.algo.hand_motion.ModeHandlerConfig(*, example_app_config: ExampleAppConfig = NOTHING, presence_config: DetectorConfig = NOTHING, hand_detection_timeout: float | None = 5.0, use_presence_detection: bool | None = True)#
- example_app_config: ExampleAppConfig#
Hand motion detection configuration.
- presence_config: DetectorConfig#
Presence detector configuration.
- hand_detection_timeout: float | None#
Duration without detection before returning back to low power mode (s).
- use_presence_detection: bool | None#
If true, use presence detector to wake up hand motion detection.
- class acconeer.exptool.a121.algo.hand_motion.ExampleAppConfig(*, sensor_to_water_distance: float = 0.12, water_jet_width: float = 0.02, measurement_range_end: float = 0.2, filter_time_const: float = 0.3, threshold: float = 1.5, detection_retention_duration: float = 1.0, hwaas: int = 32, sweeps_per_frame: int = 64, sweeps_rate: int = 1000, frame_rate: int = 10)#
- sensor_to_water_distance: float#
Distance from the sensor location to the center of the water jet (m).
- water_jet_width: float#
Water jet width (m).
Defines the width of a region, centered around the water jet, where the hand motion is not analyzed, in order to exclude the water jet motion from the motion metric.
- measurement_range_end: float#
Distance between sensor and end point of measurement range (m).
- filter_time_const: float#
Time constant of filter applied during processing.
A lower value yield a more responsive algorithm. A higher value yield a more robust response.
- threshold: float#
Threshold applied to the calculate metric.
If the metric is above the threshold, a hand movement has been detected.
- detection_retention_duration: float#
Detection retention duration (s).
The detection will be kept as True for this duration, after detection is lost.
- hwaas: int#
HWAAS.
- sweeps_per_frame: int#
Sweeps per frame.
- sweeps_rate: int#
Sweep rate.
- frame_rate: int#
Frame rate.
Result class#
- class acconeer.exptool.a121.algo.hand_motion.ModeHandlerResult(*, app_mode: AppMode, detection_state: DetectionState | None = None, presence_result: DetectorResult | None = None, example_app_result: ExampleAppResult | None = None)#
-
- detection_state: DetectionState | None#
Detection state.
- presence_result: DetectorResult | None#
Presence detector result.
- example_app_result: ExampleAppResult | None#
Hand motion example app result.