Saturday, March 14, 2015

16-channel relay box controlled by a Raspberry Pi

It's not quite finished yet, but it's in a usable state. This isn't full instructions, but hopefully enough to get you started if you're interested. Please comment below if you'd like more information.

Some of the Parts:
8-Channel 5V Relay Board (two of these)
Raspberry Pi, SD card, associated cables
female to female jumper wire for connecting Raspberry Pi GPIO pins to relay board pins
thick wire for connecting relays to outlets
nine outlets
CNC or laser-cut front plate from this drawing
LightShow Pi software (haven't tried this yet)




An example Python script to flash through the relays one at a time:


import time
delayTime = 0.25
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
pins = [2, 3, 4, 17, 27, 22, 10, 9, 14, 15, 18, 23, 24, 25, 8, 7]

for pin in pins:
    GPIO.setup(pin, GPIO.OUT) 
    GPIO.output(pin, GPIO.HIGH)
    time.sleep(delayTime)
    GPIO.output(pin, GPIO.LOW)
    time.sleep(delayTime)
GPIO.cleanup

No comments: