M5STACK Gesture Recognition and Object Counting Using a Single ST Time-of-Flight Sensor
-
Firstly I saw this amazing ST video
https://www.youtube.com/watch?v=c91Ve-g0J2U
but they did not publish source code.
So, it was the challenge. After a shot time I realized the idea and made my own.
Now, similar design with WEMOS D1 mini Lite works as room light controller with no faults allready 3 days.This example illustrates direction recognition with the single VL53L1X TOF sensor. Two Regions Of Interest(ROI) are defined in SPAD sensor array:
ROI1 ROI2
0,15___12,15
####----####
####----####
####----####
...
####----####
####----####
_____3,0 _____15,0
Data measurements distance0 and distance1 cyclically readed from both ROIs, switching them on the fly.
Then STM32duino_Proximity_Gesture library used for event interpretation.
To suit Arduino requirement I added necessary library description to Pololu vl53l1_api.
Also, to handle handMustCoverBoth parameter support in STM32duino_Proximity_Gesture library, I had to slightly modify tof_gestures_DIRSWIPE_1.cpp and tof_gestures_DIRSWIPE_1.h. Both libraries are included in this bundle.Data outputs to serial @115200 and to OLED. For investigations and adjustments it is suitable to use SerialPlot: https://bitbucket.org/hyOzd/serialplot.
Files here:
https://yadi.sk/d/MxBzgSyutU0f-Q
You should use exactly the libraries attached to project, as they were patched to suit classic gesture lib requirements and due to limited functionality of ESP32 Wire library. Also due this terrible Wire lib M5STACK works slower (42 Hz sample rate than to say ESP8266(72 Hz)).
Video here:
https://youtu.be/iSCgwss2vQs