Page 1 of 1

GPIO export and default status at boot

Posted: Sunday 19 February 2017 16:06
by gohan
Hi
I'm running v.3.6707 on RPI3 (it is also acting as a MySensors mqtt gateway ans mqtt broker) and I wanted to connect an 8 relays board (one of those that you find on Amazon) to the GPIO and control it directly through Domoticz, so I followed the wiki and added the "gpio export PIN out" in the domoticz.sh as specified, but now those port by default turn on the relay at boot and before shutdown. Is it normal? I would like them to stay off all the time and only turn on when asked to, since i'd like to avoid to have gate that opens and lights to turn on in case of a reboot.
Also I noticed that when adding a light switch connected to one of the GPIO it has reversed logic (domoticz shows lights as on while the relay is off and vice versa): did I set up something wrong?

PS in addition I found this in the log but I didn't setup anything on GPIO22 since it is used for NRF24L01 radio for the mysensors gateway
2017-02-19 23:02:27.449 GPIO: Queuing interrupt for GPIO 22.
2017-02-19 23:02:27.449 GPIO: 1 interrupts in queue.
2017-02-19 23:02:27.449 GPIO: Too many interrupts for GPIO 22. Ignoring..
2017-02-19 23:02:27.449 GPIO: Acknowledging interrupt for GPIO 22.
2017-02-19 23:02:27.449 GPIO: Processing interrupt for GPIO 22...
2017-02-19 23:02:27.458 MySensorsMQTT: Topic: domoticz/in/MyMQTT/2/1/1/0/1, Message: 45.0
2017-02-19 23:02:27.459 (MySensor MQTT) Temp + Humidity (MEGA_TempHum)
2017-02-19 23:02:27.499 GPIO: Done processing interrupt for GPIO 22 (HIGH).
2017-02-19 23:02:27.499 (GPIO) Lighting 1 (Unknown)

Re: GPIO export and default status at boot

Posted: Friday 19 May 2017 8:24
by tapas
Hi, I have this exactly same problem, did you ever figure out why relay state changes on startup/shutdown?

Re: GPIO export and default status at boot

Posted: Friday 19 May 2017 8:33
by gohan
In theory adding this script to the boot (like in rc.d) should set the pin state, but I haven't tested much yet

sudo sh -c 'echo pin > /sys/class/gpio/export'
sudo sh -c 'echo high > /sys/class/gpio/gpiopin/direction'
sudo sh -c 'echo 1 >/sys/class/gpio/gpiopin/active_low'

BCM pinout numbering