Hi @nawak86, after setting up the two HC-SR04 sensors, I am not very happy with its performance. It basically works, also with the Pages module.
It sounds like @thobach is pretty happy with his gestures module (even you need an Arduino besides the Pi, right?).
Here is a picture of how I integrated the sensors into my mirror, I could maybe upload a video in the next days.
For connecting everything you need the two sensors, jumper wires, 2 times a 1k Ohm resistance, a breadboard.
Read the statement by Michael Teeuw here.
Posts made by nowis
-
RE: Further development of the MMM-Swipe module
-
RE: Further development of the MMM-Swipe module
@richland007 Hey, I am on vacation right now, so I cannot access my mirror but I will try to help you anyways.
The output “Start: Right” means the application detected a distance smaller thanrightDistance
(from the config) and therefore checks if you made a swipe. In your example with the detected left swipe it found a value (7) for the right sensor and so checks if there is a valid swipe.
For your second example it does not detect a valid swipe, since the first measurement for both sensors is lower than the threshold (I assume so?!). We assume your hand never covers both sensors, so we declare this event as invalid and therefore no swipe.
To get a feeling for the sensors setcalibrate
totrue
and a position for the module in your config. This will print the measured distances for both sensors on your mirror. I experienced I have to make my hand very flat in order to trigger the sensors.Regarding the page increment/decrement: Just to be sure, a “Swipe Left” means you start at the right and move to the left. The right sensor is the one on your right side when you look at your mirror and vice versa. Currently a “Swipe Right” sends a
PAGE_INCREMENT
. If you want to change this, check the functionsocketNotificationReceived
in theMMM-Swipe.js
file.Hope this helps,
Simon
-
RE: Further development of the MMM-Swipe module
@richland007: I’m glad you could figure a solution for your problems.
Ragarding your questions: Yes, both trigger pins are connected to one RPi GPIO pin. It works fine for me.
There are two ways for testing your movements:- In the module-config, set a position: this will display “waiting for movement …” and will change to “Swipe Left” or “Swipe Right” for 2 seconds, if a movement is recognized.
- More precise method: In the module config, set “verbose” to true. This will print to the console (see attached image). The first line means where a potential swipe started. The next two rows give you the measured distanced used to detect a swipe. So far this does not mean we detected a swipe! Only if there is a line “----> Swipe Left” or “----> Swipe Right” a swipe is detected. This output helps you to figure out how fast do move your hand. Sometimes the sensors get noise and try to therefore try to detect a swipe. In this case you won’t see the last line, which means we do not recognize the false positive.
The centers of sensors are 20cm apart from each other. In general you can mount them just as you like, since you can configure the swipe-speed
I hope this helps! Just let me know if you need any further help.
-
RE: Further development of the MMM-Swipe module
Hi @richland007,
could you figure out a solution with the help of @AxLed by now? If not, let me know and I will try to help you. I should definitely put the math-statistics module in the package.json, sorry for that.
Edit: I just saw I removed it from the dependencies at some point, that was a mistake.
About the error with electron: Here and there I get the error after adding submodules, but I’m still not sure when and how… When I have time I should check this, but it’s probably a problem with more than just my module.I hope this helps,
Simon
-
RE: Further development of the MMM-Swipe module
Hey,
I got the module up and running. I forked shbatm’s module and changed the method of how to detect a swipe. It is not perfect, yet, but it works for me.
There is still more work to do, but I thought I will share it with you already, so you can try it. It works with the MMM-Pages module.
I will continue working on it the next days. Feel free to share your experience with me, as well as ideas for improvements.
It took me a while to “learn” the right technique to swipe. I put my hand in front of one sensors (try to make form a flat surface with your hand), stay there for about 400ms (sounds weird, sorry) and then swipe from there over the other sensor. Just practice a little bit. The swipe detection is not trivial.Here is the link, have fun! https://github.com/Simon089/MMM-Swipe
-
RE: Further development of the MMM-Swipe module
I will have a look at both modules sometime the next week. Will keep you updated.
-
RE: Further development of the MMM-Swipe module
Hey,
I tried to use the MMM-Swipe module some month ago, but without any success. No I finally had time to look over it and figured out a way to use the HC-SR04 sensors withoutsudo
. So far the module recognizes if you out your hand in front of a sensor, but I haven’t tried to calibrate a nice “swipe” gesture, yet.
I would be up to develop the module further, including a switch page functionality.
Since I took the one from mochman as a starting base, I would ask him if it’s ok if i fork or link to his page in a new repo.
So if you guys want, I will try to upload my module soon (after cleaning up a little bit).