• 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.

MMM-Navigate, Issues with KY-040 rotary encoder

Scheduled Pinned Locked Moved Unsolved Troubleshooting
15 Posts 2 Posters 1.2k Views 2 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.
  • S Offline
    stinkycol
    last edited by Apr 25, 2024, 10:46 AM

    Re: [MMM-Navigate](Navigation inside MagicMirror with Rotary Encoder)

    Hi all, I am hoping for some assistance, wisdom or divine intervention before I loose my mind after struggling with my MagicMirror for several days now.

    I am trying to use a rotary encode to navigate between different pages on my MagicMirror and to prove the hardware I first just wanted to see the menu working before integrating it into the rest of the build but this simple attempt has me stuck.

    I started with a fresh install of Raspberry Pi OS (64 Bit) 15/03/2024 vintage on my Pi4 and then installed the latest version of Magic Mirror including NPT and Node.js as well as the additional development tools. Started the application and MM sparked up fine so I moved on to installing MMM-Navigate and connected the KY040 rotary encoder according to instructions via a breakout board.

    I copied the MMM-Navigate entry into my config and sparked up the MM again, i can see the menu but it doesn’t fade and no twisting or pressing of the encoder makes any impact on the menu. I then went through some of the recommended fixes, adding GPIO configs [both pull up and down] to boot/config (now located in boot/firmware/config apparently) but this didn’t help, I changed the pins used but again nothing. I then became paranoid that i maybe had a broken encoder or was reading the pin layout wrong so i installed MMM-ProfileSwitcher and used the pins connected to the encoder to trigger notifications to ProfileSwitcher and these worked as expected so i knew i had the encoder connected correctly, it worked and the pins were correct as well.

    I have also tried installing python3-rpi.gpio, python3-uinput and then added uinput to the /etc/modules list but no joy there either.

    I did notice references to MMM-Navigate having a dependency on “onoff” in several internet chats as well as and entry in node_helper.js “const Gpio = require(‘onoff’).Gpio;” so I am wondering am I missing something but i cannot find a module listed as onoff and no module dependency is listed in the write up.

    I know MMM-Navigate works for other people and now I have moved beyond my original interest in the module and just want to solve the mystery before i go mad.

    Any suggestions greatly accepted.

    S 1 Reply Last reply Apr 25, 2024, 11:19 AM Reply Quote 0
    • S Offline
      sdetweil @stinkycol
      last edited by Apr 25, 2024, 11:19 AM

      @stinkycol

      did you try adding tge line to /boot/config.txt

      1000025768.jpg

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      S 1 Reply Last reply Apr 25, 2024, 11:24 AM Reply Quote 0
      • S Offline
        stinkycol @sdetweil
        last edited by Apr 25, 2024, 11:24 AM

        @sdetweil

        Hi, yes I tried that but when editing boot/config there was an entry inside saying it had moved to boot/firmware/config so I added it there.

        S S 2 Replies Last reply Apr 25, 2024, 11:58 AM Reply Quote 0
        • S Offline
          sdetweil @stinkycol
          last edited by Apr 25, 2024, 11:58 AM

          @stinkycol the dependency for onoff is in the package.json, and would be loaded in the module node_modules folder during npm install

          the fact that you don’t have a black screen error indicates it is installed and I see the module has the updated postinstall step to make sure it has the correct binary level matching the electron version

          did you look at the output of npm start to verify the module loaded correctly?

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          S S 2 Replies Last reply Apr 25, 2024, 2:45 PM Reply Quote 0
          • S Offline
            stinkycol @stinkycol
            last edited by Apr 25, 2024, 2:41 PM

            @stinkycol This is the message i see when i try to edit boot/config:

            Screenshot 2024-04-25 154023.png

            1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @sdetweil
              last edited by Apr 25, 2024, 2:45 PM

              @sdetweil said in MMM-Navigate, Issues with KY-040 rotary encoder:

              did you look at the output of npm start to verify the module loaded correctly

              this is what I am looking for

              when you do npm start. MagicMirror puts out message

              if you use pm2 to autolaunch MM during boot

              then the command
              pm2 logs --lines=nn

              where nn is some number of lines to display, default 15
              will display the collected logs…

              generally I recommend NOT using pm2 during module adds and reconfigures to be able to review these messages more easily.

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              S 1 Reply Last reply Apr 25, 2024, 2:50 PM Reply Quote 0
              • S Offline
                stinkycol @sdetweil
                last edited by Apr 25, 2024, 2:48 PM

                @sdetweil said in MMM-Navigate, Issues with KY-040 rotary encoder:

                @stinkycol the dependency for onoff is in the package.json, and would be loaded in the module node_modules folder during npm install

                the fact that you don’t have a black screen error indicates it is installed and I see the module has the updated postinstall step to make sure it has the correct binary level matching the electron version

                did you look at the output of npm start to verify the module loaded correctly?

                Hi, firstly I would like to thank you for helping me out especially as i am so new to this. There are messages on the npm report but I was starting the MM from my terminal on the screen and i didn’t see the messages since the mirror started up and covered them but I have started using Putty and now i can see them. I see that there is an exception that has onoff in the message so perhaps it hasnt been loaded correctly?

                Screenshot 2024-04-25 154307.png

                S 1 Reply Last reply Apr 25, 2024, 3:06 PM Reply Quote 0
                • S Offline
                  stinkycol @sdetweil
                  last edited by Apr 25, 2024, 2:50 PM

                  @sdetweil I am using PM2 in my other build but i haven’t implemented it in this one as i just wanted to confirm the KY040 code worked before moving on to autostarting

                  S 1 Reply Last reply Apr 25, 2024, 2:53 PM Reply Quote 0
                  • S Offline
                    sdetweil @stinkycol
                    last edited by Apr 25, 2024, 2:53 PM

                    @stinkycol pm2 has lots of commands

                    in linux the convention is commands provide help two ways

                    1. using the --help param
                    2. providing a manual page, seen with man program_name

                    pm2 status will show you what is defined and what its state is
                    you can control individual apps (I have 10 defined on one system)
                    with the number of the row that matches their name or the actual name (oops I have 3 MagicMirror apps defined in different locations, so I have to use the row number

                    pm2 stop xx

                    or if you know what they are you can stop them all
                    pm2 stop all

                    you can restart an app too

                    etc…

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @stinkycol
                      last edited by Apr 25, 2024, 3:06 PM

                      @stinkycol i have seen that error on other posts, and it sounds like there are some new tests on setting up the gpio pins.

                      the code wants 3 pins,
                      the node_helper code

                      		console.log('MMM-Navigate, listen on GPIO PINs (BCM): '+self.config.GPIOPins[0]+','+self.config.GPIOPins[1]+','+self.config.GPIOPins[2]);
                      		const CLK = new Gpio(self.config.GPIOPins[1], 'in', 'both',{debounceTimeout : 0 }); //BCM Pin 20
                      		const DT = new Gpio(self.config.GPIOPins[0], 'in', 'both',{debounceTimeout : 0 }); //BCM Pin 26
                      line 38		const SW = new Gpio(self.config.GPIOPins[2], 'in', 'both',{debounceTimeout : 20 }); //BCM Pin 19
                      

                      the error is on the last, which is the one you added to the boot time config.
                      I think ‘both’ incorrect for this.

                      when you used profileswitcher, what module did you use for connecting the encoder? as that module doesn’t have a hardware component

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      S 2 Replies Last reply Apr 25, 2024, 3:56 PM Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        1/15
                        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