Hoping someone can help me get started with gpio switching.
I’ve got a 2 model B v1.1 board with the 40 pin connector. I’m trying to drive a simple arduino 5V relay module: enter link description here
I’ve physically tested the relay module separate to the Pi and connecting 5V to Vcc and Gnd to Gnd illuminates the green led only, and the relay remains unswitched in the NO position. Shorting In1 to 5V does nothing, but shorting In1 to Gnd illuminates the red led and the relay switches to C position. Technically the relay is a SPDT, but you get the idea. I think this is called “Active Low”
I’ve connected (relay module <-> Pi) Vcc <-> Pin 4 (5V), Gnd <-> Pin 6 (Gnd), In1 <-> Pin 12 (gpio 18)
The relevant section of my configuration.yaml is:
#Raspberry pi PIR sensors
binary_sensor:
platform: rpi_gpio
ports:
11: PIR Kitchen
12: PIR Front Door
13: PIR Movie Room
15: PIR Baby
pull_mode: "UP"
bouncetime: 50
invert_logic: false
# Raspberry pi Relays
switch:
platform: rpi_gpio
ports:
18: Front Lights
38: Door Lights
40: Alarm Siren
invert_logic: false
Right now I’ve only got anything connected as above, but just in case my future setup is causing grief it’s in the config.
Behaviour is as follows:
- HA service stopped: Green LED only, relay NO.
- HA service started: After a few seconds, red LED lights, relay C. Front Lights switch in HA is off.
- Click on Front Lights switch, activity light on Pi illuminates briefly, no change on relay.
- Click off Front Lights switch, activity light on Pi illuminates briefly, no change on relay.
- HA service stopped: Red turns off, green LED only, relay NO.
So, clearly HA is doing something with the gpio, but I can’t seem to control it in any way.
I’m sure it’s some sort of rookie mistake, but I’m stumped.
Any help would be appreciated.
Regards,
Mark