Raspberry Pi: 8 Channel Relay + External Power Supply Tutorial and Example

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 มิ.ย. 2017
  • Setup an 8 channel relay using an external power supply and a raspberry pi.
    Details:
    - Raspberry pi 2 B+
    - 5v 8 Channel relay
    - 5v 0.7A power supply ( was a cellphone charger but i cut the end off)
    - 8 pin f/f ribbon cable
    - single pin f/f cable
    I've seen in forums that some people have unreliable relays while using the 3v pin on the Rpi, so you can switch it over to the 5v pin.
    Python Test Script:
    github.com/Mattrachwal/gpio-8...
    Link To Relay:
    www.amazon.com/gp/product/B00...
  • แนวปฏิบัติและการใช้ชีวิต

ความคิดเห็น • 103

  • @twoporciento
    @twoporciento 6 ปีที่แล้ว +4

    Hi, I'm familiar with these setup and use relays with external supply before with arduino. My project uses PIC Microcontroller running at 3.3V and 4 channel relay. I connect with external power supply JD-VCC to external source and Ground to external ground. I Connected the VCC to 3.3V of the PIC microcontroller. However, the relay(input 4) sometimes runs strange like not enough voltage is drawn, turning off and on quickly. My question is that the gpio from raspi going to input of relay is 3.3V? and Does running 3.3V on VCC ok? Because power seems low.

  • @humbertoramos9172
    @humbertoramos9172 6 ปีที่แล้ว

    Hi, how did you make that power supply? Can I use one of the ribbon cables with a charger to make one myself?

  • @moritz-rissel
    @moritz-rissel 5 ปีที่แล้ว +4

    Great video! I tried many things but this one got me in the right direction. very cool!

    • @hayafatima9844
      @hayafatima9844 ปีที่แล้ว

      Cn you tell me will this relay work on raspberry pi 3 model b

  • @aramroshani6197
    @aramroshani6197 2 ปีที่แล้ว

    Short but very useful video, thanks

  • @MrIMacro
    @MrIMacro 3 ปีที่แล้ว

    Thanks
    Does the pi support all kinds of relays ?
    220v / 12v ...etc

  • @ralphgriffith2689
    @ralphgriffith2689 3 ปีที่แล้ว

    Thanks for the great video! Can you please tell me the purpose of the jumper wire? I know in the video you said it powers the internal relay switches, but don't the relays require 5V? Instead, you're using the jumper to connect to a 3V pin on the RPi (I'm sure I'm the one confused). Also, I am trying to use a 12V external power supply due to the small 12V dosing pumps I'm wanting to use for pH control in a hydroponic system. Can I substitute a 12V external power supply as used in your example? TIA for any help.

    • @RitchieTheBrit
      @RitchieTheBrit 2 ปีที่แล้ว

      The PSU is an external 5v, which powers the actual relays (via JDVCC pin). By removing the jumper block, it allows us to use a 3.3v signal to switch the relays and protect the pi from the 5v circuit.

  • @sriharshareddy2096
    @sriharshareddy2096 5 ปีที่แล้ว +1

    Hey Techplant, it was a informative video. I dont have a ground right next to the JD-Vcc pin, can I connect the ground of the 5V power source to the other ground pin which is along with IN1, IN2 pins? Kindly clarify. Thanks

  • @csc3538
    @csc3538 3 ปีที่แล้ว

    Just seeing this today, 3 years after you posted it 😄
    I have a question: is the trigger a low signal for this kind of boards?
    Thank you, very nice and clear video.

  • @jitendravishwakarma1523
    @jitendravishwakarma1523 6 ปีที่แล้ว

    Can i use 12volt relay board with 12volts external supply on raspberry

  • @talmaier
    @talmaier 5 ปีที่แล้ว +1

    Thanks for this video, helped me a lot! I have a 5V 3A power supply, can i use this single source for the RPi and the relay board as well?

    • @TechplantChannel
      @TechplantChannel  5 ปีที่แล้ว

      im not an expert on this question, but i bet you could split the psu off into two separate power plugs. and attach one to the pi and one to the relay.

    • @anonymoushubhaiya4743
      @anonymoushubhaiya4743 2 ปีที่แล้ว +1

      no need to supply relay board if you are using 5v 3A power supply you can use power relay from pi gpio. relay operation drop current around 600ma so if you are using 5v 2a power supply for your pi then you need external power supply. I hope you understand

  • @dgb5820
    @dgb5820 4 ปีที่แล้ว +1

    This is one very clear and very well made video

  • @iggyblack
    @iggyblack 7 ปีที่แล้ว

    Great video my dude

  • @dickman1981
    @dickman1981 4 ปีที่แล้ว +1

    I've had to watch this more than I'd like to admit.

    • @TechplantChannel
      @TechplantChannel  4 ปีที่แล้ว

      No worries. I watch tutorials a ton too!

    • @dickman1981
      @dickman1981 4 ปีที่แล้ว

      Techplant I’m a post grad at TH-cam University by now.

  • @AJB2K3
    @AJB2K3 5 ปีที่แล้ว +1

    ??????
    Why connect a seperate wire to VCC as that is connected to the I/O header (at least on mine.) the jumper is only their to connect Jc-VCC to Vcc to power the relays from the IO header.
    Ah, you didn't use the VCC and GND on the I/O header.

  • @alexanderrohrer4563
    @alexanderrohrer4563 3 ปีที่แล้ว +2

    What conditions decide, whether the power supply of the Raspberry is sufficient or a external power source has to be added?

    • @TechplantChannel
      @TechplantChannel  3 ปีที่แล้ว +1

      how much power is needed per relay, and how many relays do you want activated at the same time. I forget what these use but if its 500mw and you wanna power 8 at once you are looking at 4W which could be too much for the RPI. again these arent accurate numbers but the concept is the same

    • @alexanderrohrer4563
      @alexanderrohrer4563 3 ปีที่แล้ว +1

      Okay, got it. I also found a document saying one relay needs 450 mW. Thanks!

  • @Ryan-nd3zh
    @Ryan-nd3zh 11 หลายเดือนก่อน

    Can the 8 relay script be used with Venus os?

  • @FrancescoFiorentino
    @FrancescoFiorentino 6 ปีที่แล้ว

    Where can I buy an external power supply like that one? And/or how can I build it?

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว +1

      I get my wall warts/power supplies from thrift stores because they are dirt cheap there. Just look on the label at the output and make sure it says 5v, and has at least .7A rating. If you cant find one, amazon.com offers them for 6-10USD.

  • @hl9gykorea679
    @hl9gykorea679 4 ปีที่แล้ว

    Great video; thanks! Can you point me to tutorial info that shows how to actually command those relays?

  • @viswanathnimmagadda2183
    @viswanathnimmagadda2183 5 หลายเดือนก่อน

    I dont have a JD-VCC on my board, where can I connect the power supply?

  • @siddharth4662
    @siddharth4662 2 ปีที่แล้ว +2

    why was the single cable plugged into the 3V supply pin of RPI?

    • @TechplantChannel
      @TechplantChannel  2 ปีที่แล้ว

      since this was like 3 years ago i forgot most of it, but if i remember correctly you still need to activate the relays with some power i honesly cant rememeber im sorry

  • @leonlionheart5927
    @leonlionheart5927 5 ปีที่แล้ว

    What happen to the relay board when is connected to the raspi and then you turn the raspi on? Does the relays switching during the boot time? Would like to know because that is a very very important point to be able to make meaningful projects.

  • @Felix-lr1xv
    @Felix-lr1xv 2 ปีที่แล้ว +1

    Does the py still need amperage for switching the relay with the external power supply?

    • @TechplantChannel
      @TechplantChannel  2 ปีที่แล้ว

      Yes it still uses a tiny bit to activate the relay but the relay is using thr psu

  • @mohitkundu6909
    @mohitkundu6909 5 ปีที่แล้ว +1

    i have a 8 channel board which don't have a JD-VCC pins it has only 10 pins . this board dont have another 3 pins how do i give power supply to all 8 channel .

    • @TechplantChannel
      @TechplantChannel  5 ปีที่แล้ว +1

      can you link me the model, im not an expert so id have to see and do some research

    • @mohitkundu6909
      @mohitkundu6909 5 ปีที่แล้ว

      @@TechplantChannel brother this module don't have the right and same picture online, i bought it from amazon but i can send its pic on your email or whatsapp if you wish .

    • @TechplantChannel
      @TechplantChannel  5 ปีที่แล้ว +1

      upload it to imgur and link it here!

    • @mohitkundu6909
      @mohitkundu6909 5 ปีที่แล้ว

      @@TechplantChannel i make a Google Drive Link here it is - drive.google.com/file/d/17BC80SY1wBHM-3qSKZnWlmc1kXxSOUR_/view?usp=drivesdk

  • @radityawaliulu
    @radityawaliulu 2 ปีที่แล้ว

    could you make video explain wiring relay 8 ch in Raspbery 3 B+

  • @pongpolc.8696
    @pongpolc.8696 6 ปีที่แล้ว

    Dear friend ,thank you for your youtube. I already did it but i have some problem for quit. how can I turn off project. when I run project on terminal , i try to close by using ctrl z. The result is stop but when I close terminal window , the project run again. please advise. many thanks in advance

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      Im not really sure why its doing that, how are you running the script? try CTRL C

  • @vladfriedman5445
    @vladfriedman5445 ปีที่แล้ว +1

    Great video, worked perfectly, except that I needed to connect the VCC pin to the 5V on the Raspberry pi B instead of the 3.3V.

    • @TechplantChannel
      @TechplantChannel  ปีที่แล้ว +1

      nice! was it due to the relays requirments. its been such a long time since i touched this stuff i forgot a lot about it I should really start doing more projects like this again. Good luck on your project!

  • @jamesmcbride680
    @jamesmcbride680 2 ปีที่แล้ว +1

    Are you powering the pi through the relay board instead of powering the relay board through the pi, or are you using two power supplies?

  • @TCreatorO
    @TCreatorO 4 ปีที่แล้ว +1

    Very interesting, a really good followup video would be, if you showed how to make a touch screen GUI to activate each relay

    • @TechplantChannel
      @TechplantChannel  4 ปีที่แล้ว +1

      Im moving into a new place soon, right now ive been limited by my bedroom, and my channel name barely makes sense. But once i have a new house. The entire basement is getting automated using these, lights, water pumps, fans. its gunna be pretty crazy. But this is all going to be like 6 months out. so if you are willing to wait some really cool automation stuff will be comming

    • @TCreatorO
      @TCreatorO 4 ปีที่แล้ว

      @@TechplantChannel thats awesome! Congratulations!, you must be very excited, no worries I'll wait.

  • @aatmajbarbhaiya3228
    @aatmajbarbhaiya3228 ปีที่แล้ว +1

    what if i have to use a 15-0-15 V at 300mA rating transformer connected to a IC L7805CV Voltage Regulator operating at 5V DC output?!
    i did this but it resulted in a humming sound when the relay was turned ON, and heating of the IC circuit.

  • @mohammadharib4914
    @mohammadharib4914 3 ปีที่แล้ว

    Which software should I use for the 8 channel relay????

    • @FuzzThePiGuy
      @FuzzThePiGuy 3 ปีที่แล้ว

      That depends what you want to do with the relay board.

  • @wsswetghg8791
    @wsswetghg8791 6 ปีที่แล้ว

    are relays bistable or monostable?

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      Im not really sure, here is the data sheet for the relays on this board - pub.ucpros.com/download/27115-Songle-Relay-Datasheet.pdf?osCsid=tqkrkpgfau5ki5j03e5lmk89b5

  • @quaziz
    @quaziz 6 ปีที่แล้ว

    Could one have a 5V 2A adapter? Or is 2A to much?

    • @quaziz
      @quaziz 6 ปีที่แล้ว

      Also, on the relay, there is 3 connectors for each relay. Plus, minus, but the third? And which one is plus and which one is minus and so forth. Thanks

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      It should be fine as the relay will pull what it needs. The important number to not deviate from is the 5v.

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      I will try and get up a video explaining that

    • @quaziz
      @quaziz 6 ปีที่แล้ว

      Thank! :)

    • @tdoe1232
      @tdoe1232 6 ปีที่แล้ว

      1. When considering a power supply, the most important thing to consider is that it can supply *at least* enough current for any load. So, for example, if you have a device that draws 1 ampere, the power supply should be rated for at least 1 ampere. You can also use a power supply rated for 100 amperes, because a load will only draw what it needs. (Search "ohm's law" and you'll notice voltage and resistance is what dictates current draw)
      2. Relay has 3 terminals: The center terminal will connect to one of the outside terminals depending on if its on or off. So, for example, if a relay's left-and-middle terminal are connected when its off, the right-and-middle will be connected when you turn it on. Refer to this picture for more info:
      www.learningaboutelectronics.com/images/SPDT-relay-diagram.png
      As you can see, the "COM" pin is normally connected to "NC" but if you power the coil, COM will instead connect to "NO." Hope that helps.

  • @matthewbair6476
    @matthewbair6476 2 ปีที่แล้ว +1

    Contrary to some, I actually enjoyed the music. What is the song?
    Oh yeah, and this helped a lot. Thank you

    • @TechplantChannel
      @TechplantChannel  2 ปีที่แล้ว

      At this point i have no idea. but it is one of the free songs youtube lets us use. sorry!

  • @ShamanRing
    @ShamanRing 6 ปีที่แล้ว

    Is that adapter going to power all the relays?

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      It provides them power to turn on and off, but it will not power devices that are connected to each relay.

    • @ShamanRing
      @ShamanRing 6 ปีที่แล้ว

      I see. then what is the purpose of the adapter? I see two power sources going into the relay board. one from raspberry pi, one from the wall. Shouldn't one of them power devices connect to a relay?

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      it takes about .7 amps to power all 8 relays at a time, so the adapter takes the brunt of the load away from the rpi. otherwise your rpi will struggle to run well during high load.

    • @ShamanRing
      @ShamanRing 6 ปีที่แล้ว

      That makes sense. Any video you could provide me with to power the actual relays? I will essentially connect my relay to the wall outlet and power stuff with it.

    • @waydecurzon3551
      @waydecurzon3551 6 ปีที่แล้ว

      The .7amp 5v is in fact what powers the actual relays. The relays are essentially a switch that will provide or cut power to what ever is hooked up to them. Think of it as a light switch! Hope this helped

  • @guruslakkimar12
    @guruslakkimar12 5 ปีที่แล้ว

    why use a raspberry pi when you can install the app on the mobile phone ?? the pi is not as stable either as i have been using it..... hangs a lot ....

  • @SaeedAhmed-ix8nm
    @SaeedAhmed-ix8nm 6 ปีที่แล้ว +1

    I am your student and following your tutorials and i also edit your code.
    But now i am facing the problem can you please help me.
    I am using the above configration to turn on and turn off the load as you did in the video. i want to read or sense the pins if they or low every 5 seconds and to print the output in .txt or .csv file. for one pin i have attached the code and it working fine but how i can expand to all 8 channels. please help me
    python code:
    import time
    from time import sleep # Allows us to call the sleep function to slow down our loop
    import RPi.GPIO as GPIO # Allows us to call our GPIO pins and names it just GPIO
    GPIO.setmode(GPIO.BCM) # Set's GPIO pins to BCM GPIO numbering
    INPUT_PIN = 26 # Write GPIO pin number.
    GPIO.setup(INPUT_PIN, GPIO.IN) # Set our input pin to be an input
    # Start a loop that never ends
    while True:
    if (GPIO.input(INPUT_PIN) == True):
    # load is turned off.
    print (time.strftime ("%Y/%m/%d , %H:%M:%S"),"0")
    else:
    #now 20 watt load is turned ON!.
    print(time.strftime ("%Y/%m/%d , %H:%M:%S"),"20")
    sleep(10); # Sleep for 10 seconds.
    and i want to save all the data in a .csv or .txt file with time stamp at the start and other 8 columns for pins status that are connected with relay.
    my output should look like
    06/01/2018,18:54:00,1,0,1,1,1,0,0,0
    06/01/2018,18:54:05,1,0,1,1,1,0,0,0
    06/01/2018,18:54:10,1,0,1,1,1,0,0,0
    06/01/2018,18:54:15,1,0,1,1,1,0,0,0
    06/01/2018,18:54:20,0,0,0,0,0,0,0,0
    please help me

  • @mralfordbaker
    @mralfordbaker 4 ปีที่แล้ว +2

    How's the Pi getting ground???

    • @TechplantChannel
      @TechplantChannel  4 ปีที่แล้ว

      Its in a box now doing nothing. but im moving soon and im gunna make some elaborate plant setups that will use this!

    • @mralfordbaker
      @mralfordbaker 4 ปีที่แล้ว

      @@TechplantChannel I'm working on a industrial bottle filling machine with raspberry pi 3 b+

  • @jairmercado8595
    @jairmercado8595 7 ปีที่แล้ว

    can you use a 7.5 v power supply?

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      It depends on the 8 channel relay and if the voltage regulator can handle that large of a difference. What relay do you own?

    • @wsswetghg8791
      @wsswetghg8791 6 ปีที่แล้ว

      do relays "remember" positions when ppowered off, or do they fall back into "default"?

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      they fall back into default.

  • @ApplySkills
    @ApplySkills 6 ปีที่แล้ว +2

    how do i make the 5v 0.7A power supply. Please help my life is on the line

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      how soon do you need a video?

    • @ApplySkills
      @ApplySkills 6 ปีที่แล้ว +2

      idk but the disease is catching up to me i dont have alot of time. plz make video or i die

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว +2

      Sentimental value ok I'll try tomorrow

  • @pedroesteves9582
    @pedroesteves9582 6 ปีที่แล้ว +1

    Your solution may work, what doesn't mean it's perfect: you forgot to connect the ground(s) between the Pi and the relay board.

    • @TechplantChannel
      @TechplantChannel  6 ปีที่แล้ว

      Do you need too?

    • @notepid
      @notepid 6 ปีที่แล้ว +1

      Technically you don't need to when you use the same power supply for both the RPI and the supply for the relays as the grounding in your building will be more or less the same. However, it is good practice to make sure the grounding, or zero level, of your signals are the same to avoid ground loops

    • @FeathersMcgeaw
      @FeathersMcgeaw 5 ปีที่แล้ว

      Can you specify if you mean it's better to connect the GND of the RBP with the GND next to IN1 or the GND next to VCC and JD-VCC of the external power?

  • @POOP-qm9hk
    @POOP-qm9hk 3 ปีที่แล้ว +1

    Will he reply to a person commenting on a 3 year old video?

  • @raeliean
    @raeliean 3 ปีที่แล้ว +2

    Good video. The music is VERY distracting and makes it super hard to hear.

    • @TechplantChannel
      @TechplantChannel  3 ปีที่แล้ว

      Sorry about that this was one of my first videos when i just started so i was a rookie!

  • @BarryBranton
    @BarryBranton 3 ปีที่แล้ว +1

    It's hard to hear the narrator with all of the noise in the background.

    • @TechplantChannel
      @TechplantChannel  3 ปีที่แล้ว

      sorry, this was one of my first videos ive ever made so i made some rookie mistakes

  • @gold-junge91
    @gold-junge91 5 ปีที่แล้ว

    Not work

  • @robertd6826
    @robertd6826 6 ปีที่แล้ว +7

    Do we really need the music? ?

  • @ktbristol1540
    @ktbristol1540 2 ปีที่แล้ว +1

    hi

  • @triac777
    @triac777 5 ปีที่แล้ว

    Would have been a great video but the music was too annoying. Could not watch the entire vid.