Gpio motion sensor help

Post Reply
Posts: 10
Joined: Saturday 21 May 2016 15:09
Target OS: Raspberry Pi
Domoticz version: Latest B
Location: Sorumsand, Norway

Gpio motion sensor help

Post by Norway » Saturday 21 May 2016 15:46

Hi everybody!

I am not a forum veteran, so please bare with me if I do something "wrong".

I have a Raspberry Pi 3b, and I recently bought a chinese, cheap motion sensor like this one (, and I have connected it to bcm gpio 11, and to 5V and GND.

When I previously have connected for example a temperature sensor to the gpio, I only had to define lets say "gpio export 27 IN", but I have an impression its not that easy with my motion sensor.

I dont understand the "EDGE" definition.

So, I would like the motion sensor "window" in the control panel to change state from open to closed or vice versa when the my garage door opens. Is that possible?
Sensor state.tiff
Sensor state.tiff (65.59 KiB) Viewed 1937 times
Switch.tiff (171.26 KiB) Viewed 1937 times
ssh.tiff (37.81 KiB) Viewed 1937 times

Posts: 13
Joined: Monday 11 November 2013 20:29
Target OS: Raspberry Pi
Domoticz version:

Re: Gpio motion sensor help

Post by andyman » Friday 17 June 2016 8:39

I have used a bit differend aproach to this. First I followed to install wiringpi and stuff.

I have a Rpi as a domoticz slave in my garage. I have connected a cheap relay card from ebay to control my two garagedoors (I think it was an active low relay so that my garagedoors does not open if I reboot my Rpi.

I also have a magnetic sensors connected to gpio and place on the garagemotor-line for each door. A magnet is placed on the garagemotor-door pusher and when the door is closed there is contact and Domoticz sees the door as closed. You can look at the attachements.

The sensors are cheap ebay magnetic sensors, I have not used any resistors.
In domoticz the trigger is defined as a push-on button with a 1 second delay.

The extra sensor in the files and screenshots (Sensor1-18) is planned to be used at det side-door in the garage.
I have a plan to install two lasers to deliver light to two photoresistors so that I cant't close the door if something is in the way.

The code i use to activate the gpio is placed at the very end of /etc/init.d/

/usr/local/bin/gpio export 17 out
/usr/local/bin/gpio export 21 out
/usr/local/bin/gpio export 18 in
/usr/local/bin/gpio edge 18 both
/usr/local/bin/gpio export 23 in
/usr/local/bin/gpio edge 23 both
/usr/local/bin/gpio export 24 in
/usr/local/bin/gpio edge 24 both

Sorry for my bad english description of the garagedoor-line but that was the word that came to mind. You can always PM me if you have more questions.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest