Please read the release notes carefully since this update requires adjustments to your Raspberry Pi configuration!
MMM-Swipe - Hand gestures
I was tinkering around with the HC-SR04 Ultrasonic Rangers and I figured I’d use them to try and detect hand motion in the form of “swipe” gestures. In the module’s current form it allows you to detect swiping left or right along with a “press” (when both sensors are covered). The module then sends a notification & payload to other modules for their usage.
It has a calibration mode which allows you to see the raw distance data from each sensor so you can determine what a good “detection” distance is. I use 20cm for mine. There is also a “verbose” mode which will show you the “swipes” on the screen so you can see if it works for you. The normal mode is invisible, since it is used to send data to other modules for their use.
The issue I ran into was permissions. I couldn’t figure out a way to use the GPIO portion of the pi without running MagicMirror using
sudo npm start
This will constantly update with both sensor’s distances. You can see that I put my hand in front of the right sensor. This is used to tweak the initial trigger distance (how far out from the sensors you want to have your hand to register a movement).
This will show you when you perform a swipe or press movement. The program waits for a trigger by you putting your hand in front of a sensor, then it looks to see if you move it away and put it in front of the other sensor. This will give you a swipe. If you put your hand in front of both sensors at the same time, it give you a press.
Here’s the testbed so you can see the wiring.
I updated the module to also let you use it as a physical button. Besides sending notification, you can also have it activate another GPIO pin as a momentary press. I’m thinking about integrating it with either Alexa (which looks for a button press) or @EoF’s Hide All Module.
Shampooman last edited by
Thats great. Didn’t try it, but it looks amazing. Thank you for sharing…
For troubleshooting or HOWTO questions, please post in the Troubleshooting thread:
c.keen last edited by
I was quite excited when I read about this module. And since there is the MMM-Profileswitcher, I would really like to know if someone has tried to connect the swipe-module to the profileswitcher? Unfortunately I am a programming NOOB, is there anybody out there who wants to develop this module any further?
There is the module from thobach at https://github.com/thobach/MMM-Gestures. But I wanted to use the HCSR-04 ultrasonic range instead an arduino …