0

First of all I am asking this question out of curiosity, I have no knowledge of electrical devices other than understanding of few terms that I learned in school. I am planning to work on home automation project but before that trying to figure out what I need, to do what I want to do. I saw some automation videos using Raspberry Pi and relay modules, after watching those videos I was sure I can use a Raspberry Pi with 5V relay board. I watched some more videos and from those videos I learned few things that relay needs 5V input but output of GPIO is 3.3V.

Now my confusion/concern is that is 3.3V enough to power/control 4 or 8 or 12 relay simultaneously?

Some posts suggests remove jumper on relay board and use of external 5V power supply to power relay than powering it from Pi, some suggest to modify relay board like this one, some even suggest to connect 5V of Raspberry Pi to VCC of relay and GND from Pi to GND of relay.

These posts and videos left me confused weather I can use Raspberry Pi with 5V relay board without any modification to relay board or supplying external power to it.

3
  • There is no magic involved - it depends on the relay module. Make sure you use one which can be controlled by the Pi in the manner you want.
    – joan
    May 2, 2017 at 19:28
  • Have you tried it? In order to help with useful answers it is very useful to see what you have tried and what the results have been.
    – SDsolar
    May 2, 2017 at 20:33
  • @SDsolar: Not yet. As I mentioned in my question I am still doing primary research before starting implementation.
    – Sandy
    May 2, 2017 at 21:22

2 Answers 2

1

This article includes a schematic to do what you want. Rather than using a pre-assembled relay board, this would let you control your relay directly. It uses the 3.3V GPIO output of the RPi to switch a transistor which is used to control the 5V relay. It should be easy enough to figure out even if you don't know electronics. Just be aware that the diode that you see to the left of the relay (connected across the coil) is polarized. That means it has to go in the same direction that the schematic shows (the line on the diode goes where the line on the schematic is). Also be aware that some relays have that diode built in, so check the specs or packaging of your relay. The transistor is common NPN, such as 2N2222.

1

The 3.3V line is very probably not enough to power the relays. Most 5V relays won't switch reliably at 3.3V, and the relay will create a large current spike on the s3.3V line which may upset the rest of the system. Preferably use a 5V supply independent to the pi, or failing that the 5V supply.

Usually a relay is switched via either a transistor or, for banks of relays, an IC containing an array of transistors. If you get a relay module, then check its datasheet for the threshold that it switches at, but typically 3.3V will be enough to control the relay - the common transistor array ULN2003A will switch on at anything above 3V.

Your Answer

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

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