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.

    Help! Probem using PIR Sensor on raspberry pi zero to turn on/off screen

    Scheduled Pinned Locked Moved Troubleshooting
    15 Posts 5 Posters 8.7k Views 5 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.
    • Petal0uP Offline
      Petal0u
      last edited by

      Hi all,

      i followed every step of this post :point_down:
      @randombullet said in How I got my Magic Mirror working on a Raspberry Pi 0 (zero):

      I’ve been working on this for a little bit and I’m sorry for all the incoming questions and posts on here.

      On sudo npm install, I get npm ERR! code EPEERINVALID.

      I’ve tried googling some answers but I’m not confident enough to figure this out. Also I’m writing the steps in a more linear way to make more sense of it this is what I have so far and I’d like some input so that I can help other people.

      Step 2
      My Jessie Lite didn’t allow me to create files for some reason. I posted on reddit here.

      Anyways the way of going around this is to put in a “wpa_supplicant.conf” file into your SD card and put the following in:

      network={
      ssid=”YOUR_WIFI”
      psk=”WIFI_PASSWORD”
      }

      This is what I have so far. Please look over this. Thanks in advanced!

      1 sudo wget http://node-arm.herokuapp.com/node_latest_armhf.deb
      2 sudo dpkg -i node_latest_armhf.deb
      3 sudo apt-get install npm
      4 sudo apt-get install git
      5 cd /home/pi/
      6 git clone https://github.com/MichMich/MagicMirror
      7 cd MagicMirror
      8 sudo npm install #This will take a LONG time.
      9 sudo apt-get install midori
      10 sudo apt-get install unclutter
      11 sudo aptitude install xinit
      12 sudo apt-get install matchbox
      13 sudo raspi-config
      14 Boot Options -> B1 Desktop/CLI -> B2 Console Autologin
      15 sudo nano /home/pi/start.sh

      #! /bin/bash
      cd ~/MagicMirror
      node serveronly &
      sleep 45
      sudo xinit /home/pi/startMidori.sh
      16 Control + x > Y > Return
      17 sudo chmod a+x /home/pi/start.sh
      18 sudo mv /home/pi/start.sh /etc/init.d/startMagicMirror.sh
      19 sudo update-rc.d startMagicMirror.sh defaults 100
      20 sudo apt-get install x11-xserver-utils
      21 sudo nano /home/pi/startMidori.sh

      #!/bin/sh
      xset -dpms # disable DPMS (Energy Star) features.
      xset s off # disable screen saver
      xset s noblank # don’t blank the video device
      matchbox-window-manager &
      unclutter &
      midori -e Fullscreen -a http://localhost:8080
      22 Control + x > Y > Return
      23 sudo nano /boot/config.txt

      disable_overscan=1
      framebuffer_width=1050
      framebuffer_height=1680
      framebuffer_depth=32
      framebuffer_ignore_alpha=1
      hdmi_pixel_encoding=1
      hdmi_group=2
      display_rotate=1
      24 Control + x > Y > Return

      everything works fine exept the pir sensor. :smirk:
      I’ve a python script to test the pir sensor. Motions are detected but my mirror still turned off.

      does anybody have an idea ? :expressionless:

      Petal0uP 1 Reply Last reply Reply Quote 0
      • Petal0uP Offline
        Petal0u @Petal0u
        last edited by

        Pir sensor module works fine. Screen wakes up.
        I stil have nothing on screen, no smart mirror.

        MikgaboM 1 Reply Last reply Reply Quote 0
        • MikgaboM Offline
          Mikgabo @Petal0u
          last edited by

          @Petal0u did u ever get to solve the problem? I’m currently in the same boat.

          Cheers,
          Mike

          1 Reply Last reply Reply Quote 0
          • randomnoiseR Offline
            randomnoise
            last edited by

            Have you disabled screensaver? That can cause the screen to remain blank.

            Easiest way is to install xscreensaver then disable it from the desktop (yes this seems counterintuitive but it works)

            MikgaboM 1 Reply Last reply Reply Quote 0
            • MikgaboM Offline
              Mikgabo @randomnoise
              last edited by

              @randomnoise
              Hey! Thanks for getting back to me.
              My MM works pretty well, can’t get MMM stock to work though.
              My major problem is getting my PIR sensor to function properly. I have it working properly on a pi3 but not the zero.
              What code did u use for your PIR?

              Thanks,
              Mike

              Mykle1M N 2 Replies Last reply Reply Quote 0
              • Mykle1M Offline
                Mykle1 Project Sponsor Module Developer @Mikgabo
                last edited by

                @Mikgabo said in Help! Probem using PIR Sensor on raspberry pi zero to turn on/off screen:

                can’t get MMM stock to work though.

                If I remember correctly, that module’s API is no longer working, thus, killing the module. :-(

                Create a working config
                How to add modules

                MikgaboM 1 Reply Last reply Reply Quote 0
                • MikgaboM Offline
                  Mikgabo @Mykle1
                  last edited by

                  @Mykle1 Good day!

                  That’s interesting, I have MMM stock working on my Pi3. I am running an older version of Jessie though.
                  For you know of any stock ticker that would work on Pi Zero?

                  Thanks,
                  Mike

                  Mykle1M 1 Reply Last reply Reply Quote 0
                  • Mykle1M Offline
                    Mykle1 Project Sponsor Module Developer @Mikgabo
                    last edited by

                    @Mikgabo

                    Obviously, I am mistaken then, and I apologize for an old man’s faulty memory. :-/

                    I don’t know if this is what you are looking for or if it works
                    on a Pi zero

                    https://github.com/alexyak/stocks

                    Create a working config
                    How to add modules

                    MikgaboM 1 Reply Last reply Reply Quote 0
                    • MikgaboM Offline
                      Mikgabo @Mykle1
                      last edited by

                      @Mykle1 Many thanks, I’ll give it a try!

                      I have a few more avenues to explore I respect to the PIR sensor and will report back if successful.

                      Cheers,
                      Mike

                      1 Reply Last reply Reply Quote 0
                      • N Offline
                        NoNameRo @Mikgabo
                        last edited by

                        @Mikgabo said in Help! Probem using PIR Sensor on raspberry pi zero to turn on/off screen:

                        My major problem is getting my PIR sensor to function properly. I have it working properly on a pi3 but not the zero.
                        What code did u use for your PIR?

                        for the Pi Zero use the PIR script from @cruunnerr --> point 2.2 Using PIR script

                        maybe this is helpful

                        The very important thing is, that your monitor supports HDMI-CEC or ARC. Otherwise u will not be able to turn it on or off via HDMI.
                        To reassure you, most monitors do this ;)
                        To check if it works just go into terminal via ssh and type:
                        
                        sudo tvservice -o to turn off
                        sudo tvservice -p to turn on
                        
                        edit: for some monitors the following commands work better. Please use them if your monitor needs it:
                        
                        vcgencmd display_power 0 to turn off
                        vcgencmd display_power 1 to turn on
                        
                        MikgaboM 2 Replies Last reply Reply Quote 0
                        • MikgaboM Offline
                          Mikgabo @NoNameRo
                          last edited by

                          @NoNameRo Hi!

                          Thanks for the reply :)
                          I’ll give it a try later when the kids are sleeping.

                          Cheers,
                          Mike

                          1 Reply Last reply Reply Quote 0
                          • MikgaboM Offline
                            Mikgabo @NoNameRo
                            last edited by

                            @NoNameRo

                            Hi, So I placed this command sudo tvservice -o to turn offi in terminal and this is the result…any feedback?

                            pi@MagicMirror:~ $ sudo tvservice -o to turn off
                            [E] Unrecognized argument -- 'to'
                            Usage: tvservice [OPTION]...
                              -p, --preferred                   Power on HDMI with preferred settings
                              -e, --explicit="GROUP MODE DRIVE" Power on HDMI with explicit GROUP (CEA, DMT, CEA_3D_SBS, CEA_3D_TB, CEA_3D_FP, CEA_3D_FS)
                                                                  MODE (see --modes) and DRIVE (HDMI, DVI)
                              -t, --ntsc                        Use NTSC frequency for HDMI mode (e.g. 59.94Hz rather than 60Hz)
                              -c, --sdtvon="MODE ASPECT [P]"    Power on SDTV with MODE (PAL or NTSC) and ASPECT (4:3 14:9 or 16:9) Add P for progressive
                              -o, --off                         Power off the display
                              -m, --modes=GROUP                 Get supported modes for GROUP (CEA, DMT)
                              -M, --monitor                     Monitor HDMI events
                              -s, --status                      Get HDMI status
                              -a, --audio                       Get supported audio information
                              -d, --dumpedid          Dump EDID information to file
                              -j, --json                        Use JSON format for --modes output
                              -n, --name                        Print the device ID from EDID
                              -h, --help                        Print this information
                            

                            FYI this is how i’m trying to configure my PIR https://www.magicmirrorcentral.com/pir-sensor-raspberry-pi-magic-mirror/
                            If you have a soluton that currently works on your Pi ZERO please pass it on.

                            Thanks,
                            Mike

                            N 1 Reply Last reply Reply Quote 0
                            • N Offline
                              NoNameRo @Mikgabo
                              last edited by

                              @Mikgabo
                              To test if it works, you should enter it correctly

                              to turn off the screen

                              sudo tvservice -o
                              or
                              vcgencmd display_power 0
                              

                              to turn on the screen

                              sudo tvservice -p
                              or
                              vcgencmd display_power 1
                              

                              please follow the instructions under 2.2 Using PIR-Script, then your PIR will work too

                              MikgaboM 2 Replies Last reply Reply Quote 0
                              • MikgaboM Offline
                                Mikgabo @NoNameRo
                                last edited by

                                @NoNameRo Thanks! I’ll give it a try.

                                1 Reply Last reply Reply Quote 0
                                • MikgaboM Offline
                                  Mikgabo @NoNameRo
                                  last edited by

                                  @NoNameRo

                                  Thanks SOO much!!! Got er working now. I really appreciate your help in the matter!!!

                                  Cheers,
                                  Mike

                                  1 Reply Last reply Reply Quote 0

                                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                  With your input, this post could be even better 💗

                                  Register Login
                                  • 1 / 1
                                  • 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