I am working on a project that requires a camera analyzing some images and activating the appropriate GPIOs to control a relay board. I currently have a touchscreen display, a Raspberry Pi Cam attached to the Raspberry Pi. I am trying to connect a 16 channel relay module to control some motors. Here is the specific relay module I am using

I looked at videos online about how to connect, however whenever I run it, nothing happens. The relay module has an external 12V power supply, which I connected. And I have connected all the GPIOs that I wanted to use from the Raspberry Pi to the relay board. In addition, I connected the 5V and 3.3V connections to the 2 5V pins on the relay module (I used the 3.3 because the other 5V is being used to power the touchscreen display). I have checked all the voltages and everything seems fine. Whenever I run the following code, nothing seems to happen:

import RPi.GPIO as GPIO
import time


x = [27,28,29,32,31,36,33,38,35,40]

for y in x:
    GPIO.output(y, GPIO.HIGH)

Connections from Raspberry Pi

Connection to Relay

Overview Connections

  • What is the point of connecting 3V3 to a 5V input? Why not split the 5V line? You need to add clear photos of your wiring if you want practical help.
    – joan
    Commented Jun 26, 2019 at 16:45
  • I didnt have anything to split the 5V with...
    – Sajid Khan
    Commented Jun 26, 2019 at 20:57
  • Perhaps it uses 5V logic. See if it switches if you connect 5V to one of the relay inputs.
    – joan
    Commented Jun 26, 2019 at 21:38
  • This appears to use opto-isolation. There are many similar modules on the market and frankly they are unsuitable for the Pi. Get a module with logic inputs.
    – Milliways
    Commented Jun 26, 2019 at 22:09

2 Answers 2


The relay module you linked (which has limited documentation) states:-

12V 16-Channel Relay interface board, and each one needs 15-20mA Driver Current

The Pi GPIO can (safely) sink up to 16mA - and if using all relays would overload an Arduino, and probably the Pi.

Of course this assumes the Pi could even drive the opto-isolator, but if this has a series LED and resistor is unlikely.

Powering from 5V is dangerous and is likely to blow up the Pi.

The comments on the Amazon site indicate it is unsuitable for use with the Pi.

The Foundation even has a FAQ detailing the shortcomings.

As an aside there is absolutely NO POINT is using an opto-isolator with a relay! Any additional isolation they claim to supply is illusory if there is ANYcommon connection between the two. Opto-isolators have a low current transfer ratio - which just makes it harder for the Pi to drive.

There are a number of (poorly-designed) relay boards on the market - they MAY work with an Arduino, but are unsuitable for the Pi. (There are quite a few posts on this site discussing these.)

There ARE modules (without opto-isolators) designed to be driven by 3.3V logic levels which are suitable.

You could drive this from the Pi using a transistor (if you haven't already blown the Pi).



  1. relay module has 12V power supply, ...

  2. have connected all the Rpi GPIOs relay board, ...

  3. connected 5V and 3.3V connections to the two 5V pins on the relay module (5V is being used to power the touchscreen display) , ...

  4. Run code, nothing happen, ...


It is not clear why you connect 3V3 power to 5V. And it is not clear if your 12V power relay accepts Rpi GPIO 3V3 signals.

The most newbie proof way is to use 3V3 relays which are a bit expensive (see Appendix A below).

Cheapy relays are mostly 5V powered, but only those High level trigger types are almost guaranteed to work for Rpi.

Almost half of those Low level triggered relay work for Arduino, but NOT work for Rpi (See Appendix B for get around).

And avoid using 12V powered relays, because newbies always connect the wrong wires to Rpi GPIO.


Appendix A - [Expensive/Industrial grade] Rpi Compatible 3V/5V Relays (US$15 ~ US$30)

PiFace Raspberry Pi Relay Board - £27

WaveShare Raspberry Pi Relay Board - $19

SeeedStudio Raspberry Pi Relay Board - $25

seeeduino relay

I2C Interface DockerPi Four Channel Relay Module - Seeed Studio - US$19

Amazon WaveShare Raspberry Pi Compatible Relay Module with photocoupler - XYG Study US$24

Amazon Electronics-Salon RPi Compatible (Panasonic) Relay Module - Electronics-Salon UUS$17

Using the Seeed Studio Raspberry Pi Relay Board - JM Wargo 2017feb14

Appendix B - Get Around for Arduino Compatible Low Trigger Relay not Working for Rpi

Get Around for Arduino Compatible Low Trigger Relay not Working for Rpi

*Appendix C - Forbes Recommended, with JD-Vcc jumper, Optoisolated, Low Level Trigger 5V Relay (US$7)*

5V Relay for Raspberry Pi Home Automation US$7 - Forbes Finds 2018jul12

Forbes Recommended Amazon Rpi Compatible 5V Relay Module - US$7

Errata - The product spec says each channel needs 15mA ~ 20mA to drive.

THIS IS PLAIN WRONG! I measured a couple of similar relay modules and found each input end takes only 3mA to 5mA. In other words, the current sinking requirement is OK for Rpi GPIO pins.

Opto Isolation Consideration

This Forbes relay module has opto isolation, therefore the risk of resultant back EMF, EMI transients flying back to Rpi is much reduced, so your Rpi can live longer! You can even reduce back EMI / EMI by using "total optical isolation" (Must/need JD-Vcc jumper, see references and appendices for more details)

Appendix D - Cheapy Single Channel 5V Relay Modules for Poor Hobbyists (US$1)

For hobbyists and newbies, I would like to recommend the dirt cheap single channel, no optoisolation, high level trigger modules. Just now I googled "5v relay module raspberry pi" and found 200+ results.

Google search results for "5v relay module raspberry pi"

I found the Keyes KY019 relay module which I have tested OK for Rpi.

Keyes KY019 Single Channel 5V High Level Trigger Relay US$1 each

ky019 module

Ky019 and other relays: Compare and Contrast - A rpi.org forum discussion

Appendix E -I2C Interface Relay

DockerPi 4 Channel Relay Module - Seeed Studio - US$19

DockerPi - GitHub

52Pi Relay Modules Catalog - 52Pi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.