Raspberry Pi Interface for the SainSmart 8-Channel 5V Relay Module
Switch branches/tags
Nothing to show
Pull request Compare This branch is 10 commits behind fixedd:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


#Raspberry Pi SainSmart Relay Module Interface Board


This interface board will allow you to connect your Raspberry Pi (rev 2.0, at least) to a SainSmart 8-Channel 5V Relay Module.

Parts List

Quantity Part Notes
8 12kΩ ¼ Watt Resistors
8 10kΩ ¼ Watt Resistors
8 2N3904 Transistors I used these.
1 2 inch x 2 inch single-sided PCB I cut this down.
1 3 inch jumper wire
1 26 pin header (2x13)
1 10 pin header (1x10)


The SainSmart board is powered by 5v and the relays are triggered by taking the input pin to ground. Since the Raspberry Pi's GPIO pins output 3.3v I used a set of transistors to take the relay pins to ground.

I used 2N3904 transistors simply because they were cheap and readily available. In theory any NPN transistor should work, but the resistors may need to be adjusted.

To make the board I used the toner transfer method. There are plenty of instructions on the internet for this, so I won't go into it here.

The Sainsmart Relay Module has opto-isolation on the input pins. To maintain this isolation you would need to use an external 5v power supply.


  • eagle_files - Provided here are Eagle PCB schematic and layout files.
  • images - Images of my board and the files I printed to do the toner transfer.
  • test_scripts - Some python scripts to test the operation of the board.



Thanks to the folks on the Raspberry Pi BB, without their guidance it would have taken me longer to figure this out.