Read the statement by Michael Teeuw here.
MMM-PIR Busy Issue
-
Upon fresh startup, rpm run start:wayland works as intended
- MagicMirror starts and all modules appear to work as intended
- MMM-Pir reads sensor and refreshes countdown timer as desired
After control-Q to stop the MagicMirror, each successive operation of npm run start:wayland returns error “PIR Error Detected: Error: ‘GPIO busy”
- Log shows [ERROR] [MMM-Pir] [LIB] [PIR] Error: ‘GPIO Busy’
- MagicMirror works, including all other modules except MMM-Pir
Sensor AMR312 connected to 3v power (Pin 1), Ground (Pin 6), and GPIO21 (Pin 40)
Current config.js settings
module: ‘MMM-Pir’,
position: ‘top_left’,
config: {
debug: false,
Display: {
timeout: 60 * 1000,
animate: true,
style: 1,
colorFrom: “#FF0000”,
colorTo: “#00FF00”,
// mode: 1,
// mode: 7,
mode: 8,
counter: true,
lastPresence: true,
lastPresenceTimeFormat: “LL H:mm”,
availability: false,
// availability: true,
autoDimmer: false,
xrandrForceRotation: “normal”,
wrandrForceRotation: “normal”,
wrandrForceMode: null,
waylandDisplayName: “wayland-0”,
// waylandDisplayName: “HDMI-A-1”,
relayGPIOPin: 0, //<-- default was 0
ddcutil: {
powerOnCode: “01”,
powerOffCode: “04”,
skipSetVcpCheck: false
}
},
Pir: {
mode: 1,
gpio: 21
// gpio: 4 // <–connected to 4
} -
on boot, gpioinfo shows “GPIO21” unused input active-high. first start of npm run start:wayland works as intended.
After CTRL-Q, gpioinfo shows “GPIO21” “lg” input active-high [used pull-down]. Successive npm run start:wayland shows GPIO Busy error.
-
@siujd2001 in your config you have:
Pir: { mode: 1, gpio: 21 // gpio: 4 // <–connected to 4 }
Did you try with
mode: 0
?Mode 1 uses an external python script and since that’s an external executable, there’s always a chance that the script has locked up the GPIO so when you start MMM-Pir again, it tries to start a new version of the script.
-
Switching to mode:0 does now appear to work, in that there is no gpio error and ctrl-q and restarts don’t throw an error. So that’s great! Thank you.
Screen blanks but does not turn all the way off, so that’s still an issue.
-
@siujd2001 you hadn’t mentioned anything about screen.
I recently switched to using
start:wayland
also and found that in MMM-Pir, theddcutil
mode worked best. Screen control in general seems to vary on RPi depending on the monitor you have. -
Thank you. I will look at ddcutil mode next and update.