Gpio motion sensor help

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

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 (http://preview.tinyurl.com/jh6mr26), 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 1306 times
Switch.tiff
Switch.tiff (171.26 KiB) Viewed 1306 times
ssh.tiff
ssh.tiff (37.81 KiB) Viewed 1306 times

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

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 http://www.domoticz.com/wiki/GPIO 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/domoticz.sh:

/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: 0vereem and 1 guest