GPIO export and default status at boot

Post Reply
gohan
Posts: 40
Joined: Tuesday 14 February 2017 0:42
Target OS: Windows
Domoticz version:
Contact:

GPIO export and default status at boot

Post by gohan » Sunday 19 February 2017 16:06

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)

tapas
Posts: 16
Joined: Thursday 18 May 2017 23:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: GPIO export and default status at boot

Post by tapas » Friday 19 May 2017 8:24

Hi, I have this exactly same problem, did you ever figure out why relay state changes on startup/shutdown?

gohan
Posts: 40
Joined: Tuesday 14 February 2017 0:42
Target OS: Windows
Domoticz version:
Contact:

Re: GPIO export and default status at boot

Post by gohan » Friday 19 May 2017 8:33

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests