Most relay HATs seem to be out of stock.
Amazon had one like this
https://www.amazon.com/Raspberry-Pi-cha ... B06Y4KZXYC
It has 4 relays at GPIO6, 13, 19 and 26.
You should be able to control a relay in Python.
Code: Select all
import RPi.GPIO as GPIO
import time
relaypin = 6
GPIO.setmode(GPIO.BCM)
GPIO.setup(relaypin, GPIO.OUT)
GPIO.output(relaypin, GPIO.HIGH)
time.sleep(10.0)
GPIO.output(relaypin, GPIO.LOW)
For web based control you can extend this with a Python flask server. The flask server could create a web page with a button. The state of the button could control the state of the relay.
If you want to create an app on a mobile phone you could learn to use the Python liblo library for listening to OSC commands.
Both of these remote approaches require quite a lot of learning to get the devices to work as you want. But it is doable. And fun.