• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Further development of the MMM-Swipe module

Scheduled Pinned Locked Moved Requests
25 Posts 7 Posters 14.6k Views 7 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    nowis
    last edited by Oct 9, 2017, 7:13 PM

    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

    R 1 Reply Last reply Jan 15, 2018, 5:49 AM Reply Quote 0
    • R Offline
      richland007 @nowis
      last edited by Jan 15, 2018, 5:49 AM

      @nowis

      Hi there i followed your instructions step by step and got everything installed from your fork for MMM-Swipe, however when i add the MMM-Swipe config parameters to the MM’s config.js file and start the Magic Mirror i get a blank screen and nothing else .
      Only after ctr-alt-del and manually killing the MagicMirror instance (ctrl+q does nothing in this case) i am able to get back to Rpi’s desktop.
      After inspecting the MagicMirror npm start messages i found out that MMM-Swipe and some error with math-statistics module (i do not have a MagicMirror math statistics module) being unavailable that seems to be the culprit of it all, it also seems that the math statistic’s module is a node.js package of MMM-Swipe.
      If i go back to MagicMirrors nonfig.js and comment out the MMM-Swipe module everything works just fine with my MagicMirror … what do you think it is happening??
      Does it have anything to do with maybe the physical sensors?? They are wired just as they are supposed to according to the schematics but maybe they are not working?!?!?!
      I am unable to give it an answer by myself so any help will be greatly appreciated
      Thank you in advance
      Denis

      1 Reply Last reply Reply Quote 0
      • A Offline
        AxLed Module Developer
        last edited by Jan 29, 2018, 7:32 PM

        @richland007
        i had the same error on a rpi1 B, here is a solution that worked for me:
        Change into MagicMirror/modules/MMM-Swipe

        npm install math-statistics –save
        

        After that i got an new error like
        Error: Module version mismatch. Expected 48, got 50)
        Solution for this:
        Change into MagicMirror/modules/MMM-Swipe
        Rebuild module for the correct elecron version

        npm rebuild --runtime=electron --target=$(../../node_modules/electron/cli.js --version) --disturl=https://atom.io/download/atom-shell --build-from-source
        

        Regards
        Axled

        1 Reply Last reply Reply Quote 0
        • N Offline
          nowis
          last edited by nowis Feb 7, 2018, 1:37 PM Feb 7, 2018, 1:35 PM

          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

          R 1 Reply Last reply Mar 14, 2018, 1:10 AM Reply Quote 0
          • R Offline
            richland007 @nowis
            last edited by Mar 14, 2018, 1:10 AM

            @nowis Sorry for the late reply i did figure out the math statistic on my own “…the power of research on the internet” :)
            and also a simple npm install fixes “… the got 53 and expected 48 issue”

            Everything on my end is working nicely i got no errors on my Magic Mirror and i have a lot of modules… however i can’t test the MMM-Swipe …granted it is not installed in the exact position where it is going to ultimately be. Mirror’s Raspi is still on my desk hooked to the monitor, wired though with the sonic sensors… cause i just got done with the programming part and have not started with the physical built of the mirror yet but i had a couple of question regarding the wiring of the two sonic sensors!!

            Are both of the trigger pins for both sensors connected to the same Rpi GPIO?? How can i test if my hand movement can move the pages?? I have tried but nothing happens the module on the software side has no errors but i don’t know if it works!!

            How far apart should the centers of the 2 sensor pairs be from each other ultimately on the mirror frame??

            Any help will be greatly appreciated
            thank you
            Denis

            1 Reply Last reply Reply Quote 0
            • N Offline
              nowis
              last edited by Mar 16, 2018, 8:50 AM

              @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:

              1. 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.
              2. 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.

              0_1521189887407_Bildschirmfoto 2018-03-16 um 09.44.09.png

              R 2 Replies Last reply Mar 18, 2018, 4:10 AM Reply Quote 0
              • R Offline
                richland007 @nowis
                last edited by Mar 18, 2018, 4:10 AM

                @nowis Thank you very much for the quick reply i will try it as soon as i get some free time …can’t do much on the weekends. I will report back any changes or difficulties i might have
                have a great remeinder of the weekend
                Denis

                1 Reply Last reply Reply Quote 0
                • R Offline
                  richland007 @nowis
                  last edited by Mar 26, 2018, 3:48 AM

                  @nowis Ok so i got the chance to try it with your suggestions and i guess my connections are right and it sort of works!!!

                  I got to read a swipe only once … a Swipe Left and judging from the readings on the console it detects movement but i am unable to replicate any additional swipes granted they are very close to each other and not aligned.
                  However do these numbers seem right to you?? judging from this pic that i am attaching …what are these reading in the 3 thousand range?

                  Any pointer in the alignment or calibration of the sensors and when i get it to read the swipes left and right correctly does that mean the pages are going to be go left and right also meaning if i swipe from left to right the pages are going to ump one forward and if i swipe from light to left the MM pages are going to go backwards?? that’s our ultimate goal isn’t it

                  thanks again
                  Denis

                  ps. I cant upload a image so here is a text copy of it

                  Start: Right
                  [MMM-Swipe] Left : [{“dist”:“158”},{“dist”:“3076”},{“dist”:“5593”},{“dist”:“13”},{“dist”:“280”}]
                  [MMM-Swipe] Right: [{“dist”:“7”},{“dist”:“3054”},{“dist”:“8”},{“dist”:“165”},{“dist”:“237”}]
                  [MMM-Swipe] ----> Swipe Left
                  [MMM-Swipe] -------------------------
                  [MMM-Swipe] Start: Left
                  [MMM-Swipe] Left : [{“dist”:“4”},{“dist”:“2805”},{“dist”:“143”},{“dist”:“7”},{“dist”:“151”}]
                  [MMM-Swipe] Right: [{“dist”:“12”},{“dist”:“9”},{“dist”:“12”},{“dist”:“154”},{“dist”:“3”}]
                  [MMM-Swipe] -------------------------

                  N 1 Reply Last reply Mar 29, 2018, 4:12 AM Reply Quote 0
                  • N Offline
                    nowis @richland007
                    last edited by Mar 29, 2018, 4:12 AM

                    @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 than rightDistance (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 set calibrate to true 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 function socketNotificationReceived in the MMM-Swipe.js file.

                    Hope this helps,

                    Simon

                    N 1 Reply Last reply Apr 15, 2018, 12:24 AM Reply Quote 0
                    • N Offline
                      nawak86 @nowis
                      last edited by Apr 15, 2018, 12:24 AM

                      @nowis Hello can you take a photo and video of your installation ? it’s difficult to properly setup motion detection.

                      how did you integrate the sensors on the mirror ?

                      Sor for my bad english

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 2 / 3
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy