A am using 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: https://www.amazon.com/SainSmart-101-70-103-16-Channel-Relay-Module/dp/B0057OC66U/ref=asc_df_B0057OC66U/?tag=hyprod-20&linkCode=df0&hvadid=311990496852&hvpos=1o1&hvnetw=g&hvrand=16991409045459790175&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9028086&hvtargid=pla-405660916688&psc=1 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

migrated from superuser.com yesterday

This question came from our site for computer enthusiasts and power users.

  • 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 yesterday
  • I didnt have anything to split the 5V with… – Sajid Khan yesterday
  • Perhaps it uses 5V logic. See if it switches if you connect 5V to one of the relay inputs. – joan yesterday
  • 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 yesterday

2 Answers



  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 – Rpi Compatible 3V Relays (Very Expensive!)

PiFace Raspberry Pi Relay Board – £27

WaveShare Raspberry Pi Relay Board – $19

SeeedStudio Raspberry Pi Relay Board – $25

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 – Rpi Compatible, Optoisolated, Low Level Trigger 5V Relay Recommended by Forbes (US$7 Only)

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

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


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 cause this is assuming 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 us unsuitable for use with the Pi.

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).

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: