Slice Of Relay Documentation

This board was designed for the first generation of Raspberry Pi and the company who produced and sold has disappeared.

2018-07-04-slice-of-relay-001.jpg

This board has the optional headers installed so you can stack or extend the GPIO bus.

This information and whatever files and schematics we have here are merely an attempt to save the information from disappearing. I hope it helps someone some day.

I located the old document on the wayback machine and I was very happy as I could not find this document anywhere and I had lost my copy. I dusted off the Slice of Relay board recently as part of the effort to document everything I had been doing.

I realized that much of the earlier Raspberry Pi accessories had disappeared including the companies that had produced them. The documentation for much of these add-on boards has disappeared as well.

I have taken the original document and copied the schematic into a separate schematic in both PDF and jpg form.

Here is a graphic image (jpg) of the schematic in as high as resolution as possible. Click on the image to expand and then right-click to save.

slice-of-relay-schematic.jpg

Here is the schematic-only in pdf format.

slice-of-relay-schematic.pdf

Here is the entire document with some programming examples and instructions.

slice-of-relay-v-0-1.pdf

References

GitHub Repo for Quick GUI example for turning the Relay's on and off Here is a copy of this repo B047-Slice-of-Relay-master.zip

Wiring Pi - GPIO Interface library for the Raspberry Pi See http://wiringpi.com/

https://github.com/Gadgetoid/WiringPi2-Python
Here is a copy of the repo: WiringPi2-Python-master.zip

THIS REPOSITORY IS DEPRECATED - See https://github.com/WiringPi/WiringPi-Python
Here is a copy of this repo: WiringPi-Python-master-latest.zip

https://github.com/NeonHorizon/berryio

Example Python Code (for RPi.GPIO)

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)
GPIO.setup(18, GPIO.OUT, initial=GPIO.HIGH)
GPIO.setup(22, GPIO.OUT, initial=GPIO.HIGH)
print "Start : %s" % time.ctime()
time.sleep( 5 )
print "End : %s" % time.ctime()
GPIO.cleanup()

Example Shell Commands

# GPIO 24 and GPIO 25
echo "24" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio24/direction
echo "1" > /sys/class/gpio/gpio24/value # relay A on
echo "25" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio25/direction
echo "1" > /sys/class/gpio/gpio25/value # relay B on
sleep 10 # delay 10 seconds
echo "0" > /sys/class/gpio/gpio24/value # relay A off
echo "0" > /sys/class/gpio/gpio25/value # relay B off

As you can see using the relay board is easy!

Example Relay Control System

2018-07-07-rp-humble-pi-003.jpg

This python script is more advanced and was used for a breadboard test I was running with reading dip switches to both control and configure a nonexistent "machine" that needed a load switched on for a configurable period with the relay off time also configurable. It loops reading GPIO 23 until it is high. This means the dip switch A #1 was set to on on the PCB. The relay will continue to cycle 5-seconds off and 5-seconds on. Those values are of course easily changed in the script to meet your particular requirements. This script is easily expanded to include both relays (Slice of Relay!) and perhaps even sequence them as needed. In this example the dip switch could be some other sensor or momentary switch or magnetic door sensor, etc, Real Hackers create hardware and software, they have to write their own code, ahem.

#!/usr/bin/python
# free code 
import RPi.GPIO as GPIO
import time
# Testing Loop
# GPIO 23 has a dip switch with 3.3v being switched on (logic 1) which enables the relay
# to cycle. 

while True:

        print "Begin : %s" % time.ctime()
        GPIO.setmode(GPIO.BOARD)
        mode = GPIO.getmode()
        print "Mode is %s" % mode
        GPIO.setup(16, GPIO.IN)
        # Relay A
        GPIO.setup(18, GPIO.OUT, initial=GPIO.LOW)
        # Relay B
        GPIO.setup(22, GPIO.OUT, initial=GPIO.LOW)

        try:
                while True:

                        if GPIO.input(16):
                                print"GPIO 23 is high"
                                GPIO.output(18, GPIO.HIGH)

                                print "Activating Relay A 5-seconds"
                                time.sleep(5)
                                break
                        else:
                                print "Check: %s" % time.ctime()
                                print "GPIO 23 is low"
                                time.sleep(1)
        finally:
                GPIO.output(18, GPIO.LOW)
                print "End : %s" % time.ctime()
                GPIO.cleanup()
                time.sleep(5)