Received the DLI IOT Relay today for about $20 on Amazon Prime. This box is a SPDT relay that controls 3 AC outlets, two of which are normally off and one is normally on. The fourth outlet is always on, which is handy as I plan to use it to power the raspberry pi.
Link to datasheet: https://cdn-shop.adafruit.com/product-files/2935/P2935B+datasheet.pdf
I setup a quick test to turn a lamp on and off using the relay and a python script. I used the RPi.GPIO library that comes standard with Rasbian. I should note there are different GPIO numbering modes, in this case I use "BCM" which is based on the broadcom chip and NOT the header pin numbering. This bugs me, I will probably use the board pin numbering next time, designated as "BOARD".
#!/usr/bin/env python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.output(17, GPIO.HIGH)
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.