Read the statement by Michael Teeuw here.
PIR motion works but screen ceeps alive
-
this is my first post, so be gantle with me please… ;-)
PIR motion works on test but my hdmi connected screen ceeps on, it will not going off.
Some PIR Test info on Python Idle3:
import RPi.GPIO as GPIO
import time
sensor = 4
GPIO.setmode(GPIO.BCM)
GPIO.setup(sensor, GPIO.IN, GPIO.PUD_DOWN)
previous_state = False
current_state = False
while True:
time.sleep(0.1)
previous_state = current_state
current_state = GPIO.input(sensor)
if current_state != previous_state:
new_state = “HIGH” if current_state else “LOW”
print(“GPIO pin %s is %s” % (sensor, new_state))OUTPUT on waving to PIR:
GPIO pin 4 is HIGH
GPIO pin 4 is LOW
GPIO pin 4 is HIGH
GPIO pin 4 is LOW
GPIO pin 4 is HIGH
GPIO pin 4 is LOW
GPIO pin 4 is HIGHConfig.js:
module: ‘MMM-PIR-Sensor’,
config: {
sensorPIN: 4,
powerSaving: true
}ON NPM Start:
Loading config …
Loading module helpers …
No helper found for module: alert.
No helper found for module: clock.
Initializing new module helper …
No helper found for module: currentweather.
No helper found for module: weatherforecast.
Initializing new module helper …
Initializing new module helper …
All module helpers loaded.
Starting server op port 8080 …
Server started …
Connecting socket for: calendar
Starting node helper for: calendar
Connecting socket for: newsfeed
Starting module: newsfeed
Connecting socket for: MMM-PIR-Sensor
Sockets connected & modules started …
Launching application.
Create new calendar fetcher for url: http://p35-calendars.icloud.com/published/2/xxxxxxxxxxxxxxxxxx - Interval: 300000
Create new news fetcher for url: http://feeds.nos.nl/nosjournaal - Interval: 300000
Whoops! There was an uncaught exception…
{ Error: EBUSY: resource busy or locked, write
at Error (native)
at Object.fs.writeSync (fs.js:786:20)
at Object.fs.writeFileSync (fs.js:1353:24)
at new Gpio (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/onoff/onoff.js:88:8)
at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_helper.js:54:18)
at Socket. (/home/pi/MagicMirror/modules/node_modules/node_helper/index.js:98:10)
at emitTwo (events.js:106:13)
at Socket.emit (events.js:191:7)
at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:503:12
at _combinedTickCallback (internal/process/next_tick.js:67:7) errno: -16, code: ‘EBUSY’, syscall: ‘write’ }
MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?Settings:
Edit /boot/config.txt
set hdmi_force_unplug=1
sdtv_mo=2 // Normal PALsudo su
/var/spool/cron/crontabs
@reboot python /home/pi/Documents/PIR/pir.py &Also done:
sudo apt-get update
sudo apt-get upgrade
sudo reboot
in MMM-PIR-Sensor folder
npm install
sudo rebootwhat O what can it be ?
-
I do remember that initially had some problems with my PIR sensor as well. It did not shut down the HDMI port properly. My personal problem was that I was not successful to disable the standard jessie screensaver.
Once installing unclutter (sudo apt-get install x11-xserver-utils unclutter) and disabling the screensaver i got my PIR working perfectly.
The error message in your log seems to indicate to me that is a resource conflict. Might it be possible that your are running your python script permanently and in parallel the PIR module ? And therefore causing the resource conflict ? Not sure whether this might be the case.
One easy thing for debugging whether HDMI switching on/off is successful would be to install the remote control module. I did use this in my debugging phase to use the web interface of the remote control module to manually switch on/off the HDMI interface.
Hope this helps, Steff -
thanks for the quick replay.
I did instyall the unclutter for mouse pointer disable but not the way you discriped.
I wil try what you typed above.- sudo apt-get install x11-xserver-utils unclutter
- disabling the screensaver
Afther that i take a look at the install of the remote control module.
The Python script was only to show that the PIR is working outside MM2
And i don’t run it the same time.i will inform back.
-
back again,
uncutter installed and is working
remote controle module installed and is working from pc and my iPhone, top app.
i can turn monitor off/on
when i check the PIR on Python Idle3 it’s handeling motion correctly.
BUT on the live mirror the PIR does nothing…HELP !
-
@hmoed said in PIR motion works but screen ceeps alive:
thanks for the quick replay.
I did instyall the unclutter for mouse pointer disable but not the way you discriped.
I wil try what you typed above.- sudo apt-get install x11-xserver-utils unclutter
- disabling the screensaver
Afther that i take a look at the install of the remote control module.
The Python script was only to show that the PIR is working outside MM2
And i don’t run it the same time.i will inform back.
The easiest way I find to disable the screen saver is to install xscreensaver and disable it! :) Quick and easy!