• 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
  1. Home
  2. markbajaj
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
Offline
  • Profile
  • Following 0
  • Followers 0
  • Topics 1
  • Posts 2
  • Groups 0

markbajaj

@markbajaj

0
Reputation
321
Profile views
2
Posts
0
Followers
0
Following
Joined Jun 12, 2017, 1:55 PM
Last Online Aug 3, 2017, 11:05 PM

markbajaj Unfollow Follow

Latest posts made by markbajaj

  • RE: MagicMirror on Pi Zero W

    @rootsudo Thank you!

    This along with post number 23 got my Pi Zero and Pi zero W working perfectly :)

    posted in Tutorials
    M
    markbajaj
    Jun 12, 2017, 6:45 PM
  • MMM-Motion with RPi3 and RPi Official TFT

    I thought I would post this here as I was trying to get my motion sensor to work with the official RPi TFT 7" screen. The module for motion only turns off the HDMI port and not the TFT that is connected via the display connector on the RPi3. What I did to get it to work is to write a short python script that checks for motion. Please excuse my poor python…it’s the first one I’ve written :)

    #!/usr/bin/env python
    import RPi.GPIO as GPIO
    import time
    import os
    GPIO.setmode(GPIO.BCM)
    PIR_PIN = 22
    GPIO.setup(PIR_PIN, GPIO.IN)
    os.system("echo 0 > /sys/class/backlight/rpi_backlight/bl_power")
    while True:
            i=GPIO.input(PIR_PIN)
            if i==1:
                    os.system("echo 0 > /sys/class/backlight/rpi_backlight/bl_power")
                    time.sleep(1)
            elif i==0:
                    os.system("echo 1 > /sys/class/backlight/rpi_backlight/bl_power")
                    time.sleep(1)
    
    
    

    Basically, the PIR is on GPIO pin 22 and all this script does is to check for motion and if there is any then turn on the backlight, if not it turns it off. The delay is set on the PIR to about 1 min 30 secs before the pin turns off.

    I saved it in my home directory (/home/pi). Don’t forget to make it executable by typing:

    chmod +x motion.py
    

    I then added an entry in the /etc/rc.local file to run it at boot as below:

    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    
    # Print the IP address
    python /home/pi/motion.py &
    _IP=$(hostname -I) || true
    if [ "$_IP" ]; then
      printf "My IP address is %s\n" "$_IP"
    fi
    
    exit 0
    
    

    Also, don’t forget the ‘&’ at the end as the script is intended to run in the background and the Pi may not boot if you forget.

    I hopes this helps someone :)

    posted in Troubleshooting
    M
    markbajaj
    Jun 12, 2017, 2:07 PM
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