5 Volt Relay (Raspberry Pi)

Поділитися
Вставка
  • Опубліковано 24 лис 2024

КОМЕНТАРІ • 90

  • @EchoVids2u
    @EchoVids2u 6 років тому +38

    Finally, this is the first video I've seen of relay set up with the code that's step by step and understandable. Thank you!

  • @channelkerr
    @channelkerr 6 років тому +5

    Thanks, this worked great. Was a bit hard to see which RPi pins you used but after checking your website I was up and running 👍
    So many google results insist you need additional components so I'm glad I found your vid. I found that a multimeter with continuity test was really handy to check which contacts are being closed when the relay engages.

  • @MrTPLinh
    @MrTPLinh 6 місяців тому

    Great tutorial ! Though I used a little different relay from your vid but it still worked perfectly with your code. Thank you so much !

  • @masistani
    @masistani 6 років тому +1

    Thanks a lot. Made it very clear on how to use relay 5VDC with Pi. Saved me a lot of time and extra ordering relay 3VDC. Excellent tutorial!! Thank you!!!

  • @IIIXJannikXIIIDE
    @IIIXJannikXIIIDE 2 роки тому +4

    I have the same relay, but it always turns on once the GPIO is set to OUT, and only turns off when the GPIO is set to IN

    • @SachinWable
      @SachinWable 4 місяці тому

      Same problem for me as well, any solution for this?

    • @IIIXJannikXIIIDE
      @IIIXJannikXIIIDE 4 місяці тому

      @@SachinWable Uhm actually I dont remember perfectly. I think I still have the same relais tho. It is working and I have no idea what my problem was back then xD
      I have it on Pin 18, set up as output and it works normally by gpio.output(18, gpio.HIGH) or LOW to disable it again.
      I have a raspi 4

  • @JesseSightler
    @JesseSightler 7 років тому +3

    The gpio.low may not turn it off, but the cleanup call should. Unfortunately, I think this is just a function of the relay board not being designed for the 3.3V source on the pi. I wish that more tutorials made this clear.

    • @Ed19601
      @Ed19601 6 років тому

      If driven by an npn transistor the Triggervoltage shouldn't be a problem, but this one looks much like one that's driven by a PNP, then the voltage may be a problem arduinodiy.wordpress.com/2018/08/07/re-inverting-an-inverting-relay/

    • @stuartg40
      @stuartg40 6 років тому

      I thought the GPIO was 5V. Why is everyone now saying 3.3V? TIA.

    • @abagga5942
      @abagga5942 5 років тому

      @@stuartg40 The Pi provides pins for 5V, but those are for power. The pins we use for GPIO actually output 3V or 3.3V.
      www.raspberrypi.org/documentation/usage/gpio/

  • @ryangleeson5916
    @ryangleeson5916 10 місяців тому

    Thanks for this. Ive brought the same relay however it doesnt switch from the 3v. When i drop the relay ever so slighty it then switches to on. Could this mean faulty relay, connection issue or something else? Much appreciated

  • @TheChrisPutnam
    @TheChrisPutnam Рік тому

    I built this exactly the same as you - the green light on the relay turns on and off at intervals but it doesn't seem to power the 12V side - is it because my relay is too cheap and doesn't work with 3.3V ?

  • @Stagedrengen
    @Stagedrengen 4 роки тому

    Great video! Would it be possible to power the relay with a battery pack? Any tutorials on how to do it?

  • @carlosvaldemarsoria941
    @carlosvaldemarsoria941 6 років тому +4

    hi, great video!
    i iam working with a pi 3 and don't have the same results, i had worked with node red and y i had to be use a logic converter to 3,3v (pi out) to 5v relay in and vcc.

  • @xuzhongwei9735
    @xuzhongwei9735 3 роки тому +2

    I noticed that, when I output from GPIO pin, no matter High or SLOW, my relay turns off
    Only after I change my code in the following can the relay be able to be switched by me.
    import RPi.GPIO as GPIO
    from time import sleep
    try:
    while True:
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(21, GPIO.OUT)
    GPIO.output(21, True)
    print("high")
    sleep(2)
    GPIO.cleanup()
    print("low")
    sleep(2)
    except KeyboardInterrupt:
    print("key board interrupted")
    GPIO.cleanup()

  • @prashantochatterjee3064
    @prashantochatterjee3064 3 роки тому

    Worked without any glitch 👍🏽. Excellent tutorial

  • @relsonriverapro_ggram3d535
    @relsonriverapro_ggram3d535 2 роки тому

    Hola bro, muy buen contenido,aunque tengo una duda, porque al utilizar tu codigo,en vez de que se respeten los time, estos se suman, lo cual hace que el encendido dure más, y no se detenga, que me recomiendas hacer?

  • @shortmeister6776
    @shortmeister6776 Рік тому

    What do u mean by changing the jumpers?
    PLs explain !

  • @selticeapps
    @selticeapps 6 років тому +32

    How is your 3.3v GPIO output switching your 5V relay?

    • @krus4722
      @krus4722 5 років тому +4

      on the top right pin the voltage is 5V

    • @fouroakfarm
      @fouroakfarm 5 років тому +11

      The pin on the RPi? Thats constant 5v from the power supply. The GPIO pins output 3.3v, the relay expects 5v. You need to something in between the RPi and relay to get this to work (or get a 3.3v relay)

    • @rbelar21
      @rbelar21 4 роки тому +3

      I know this is old, but maybe it'll help someone else. If it has a high/low jumper, set it to HIGH. This will allow a low voltage range like 3v-5v. If you set it to low it only seems to take in the 5v as a trigger.

    • @AIMatesanz
      @AIMatesanz 4 роки тому +1

      @@fouroakfarm I also came here to answer the question but still not a right one..

    • @DanielKorgel
      @DanielKorgel 4 роки тому +3

      Hi was looking for the same answer and I found it in a raspberry Pi forum: You need to use 3.3V for VCC (instead of 5V), then you can use 3.3V from the GPIO to trigger it.
      Just don't use 5V at all for these single channel relay boards. I tested it and it worked for me (see yt video My1BDB1ei0E )

  • @ch4.hayabusa
    @ch4.hayabusa 4 роки тому +1

    Those GPIO pins are in incredibly anemic... Designed originally for 3mA... 15mA is pushing it. That took me by surprise.

  • @RobBrulinski
    @RobBrulinski 6 років тому

    Your video tutorials are the best!

  • @_Big_boi_
    @_Big_boi_ Рік тому

    Can you use a relay to throttle a motor precisely? Say, run 30%, then 50%?

  • @davyS4v
    @davyS4v Рік тому

    can I avoid powering the relay via raspberry and power it with another power supply, by only letting the signal cable come out of the raspberry?

  • @sergiusvitus7512
    @sergiusvitus7512 7 місяців тому

    Very nice, I like this tutorial 👍

  • @Dalrae
    @Dalrae 3 роки тому

    Hey I have the same relay module you showed first, how can I get that one working?

  • @spawn666reaper
    @spawn666reaper 3 роки тому +1

    As you describe in the end, I to am having problems. I’ve switched cables multiple times, tried deferent pins. Even added a 2n2222 transistor with a 1k resistor to the signal wire to try and resolve the issue. Still no luck. Would you recommend a totally different relay then the one you are using in the video? Because that’s the one I’m having problems with.

    • @unnainconnu9098
      @unnainconnu9098 3 роки тому +1

      This relay has a pull-in voltage of max 75 % its nominal voltage. Since this is the 5V version, up to 3,75V is required to make it operate so it can't be reliable on the RPi.

  • @liron28
    @liron28 3 роки тому

    hi ty for the vid. the relay act as a switch and a volt divider between the power supply and the R-pi?
    because of the 3.3 volt limit in the R-pi
    ty.

  • @kenstovall5091
    @kenstovall5091 6 років тому +1

    I would like to add a relay to turn on and off my CPU fan so if the temp on my cpu gets too high then the relay would close and start my fan and then if the temp dropped below a cooler temp the relay would open up and turn my cpu fan off....im wanting this so that the fan will not be running all the time and help save the life of the fan and not drawing power from the Pi when not needed. Thanks for any help !!

  • @kooshaalf7240
    @kooshaalf7240 2 роки тому

    I have a similar project with arduino and everything was fine until yesterday my relay chatters whats the problem?

  • @stephencovert7856
    @stephencovert7856 4 роки тому +1

    Thank you, this was a very well done tutorial!

  • @k1ngydoteth403
    @k1ngydoteth403 6 років тому

    Can I use the 12v power source to also power a led light? Connect the led light ground to the ground of the 12v power, and then the positive to another relay?

  • @ovidiurosu6632
    @ovidiurosu6632 4 роки тому +1

    Didn't understand how you can safely control a 5V Relay with the output of the Pi (which is 3.3v).

    • @unnainconnu9098
      @unnainconnu9098 3 роки тому

      The pull-in voltage is max 75 % its nominal voltage. Since this is the 5V version, up to 3,75V is required to make it operate so it can't be reliable on the RPi.

  • @legit_koxu
    @legit_koxu 5 років тому

    Only tutorial which worked for me, thanks so much! works for arduino too!

  • @timursumer4271
    @timursumer4271 3 роки тому

    Thanks for this video i used this to make a shel server that can turn my pc on and off anywhere so i can always stream to it to game or code

  • @SachinWable
    @SachinWable 4 місяці тому

    I have tried this but it doesn’t for me. I have 5v relay module as soon as I connect vcc to 5v pin, ground to ground pin and in to pin 18 which is set to out both relay lights glow. Even if I change pin status of 18 to dh or dl it doesn’t control relay at all. It always glows both the lights. But if I remove and connect pin 18 then it turns on and off the relay state. I have no idea why pin 18 high and low not controlling the relay. Any idea on this? Thank you.

    • @SachinWable
      @SachinWable 4 місяці тому

      Whereas I am able to control led light through the same output pin 18 but not relay.

  • @DivideBYZero69
    @DivideBYZero69 6 років тому

    Great video. I have the same relay unit and the code example is spot on. Got it working for my with my rPi Zero W. Thanks very much.

  • @jhulindawati7489
    @jhulindawati7489 Рік тому

    hello, I can't speak English. I'm using google translate. I'd like to ask. I get the message "RPi.GPIO as GPIO no module" what is the solution? I have installed but it didn't work. Please help me 🙏🙏

  • @brijeshmandyal
    @brijeshmandyal 4 роки тому

    really very useful and informative

  • @Traumatizes
    @Traumatizes 6 років тому

    How can you have the linear actuator move in reverse? What changes in the wiring and in the code? Ideally, I have 2 push buttons on my breadboard and I want one of them to push it forward and one of the to reverse it,

    • @Traumatizes
      @Traumatizes 6 років тому

      I know for a regular DC motor, I would need a motor driver and I am comfortable using the L293D to drive it's direction but I am unsure what to do for my 12V linear actuator with relay

  • @alejandrovelez2147
    @alejandrovelez2147 3 роки тому

    hello, Thanks a lot for this video. It is exactly what I was looking for :D

  • @danielbell2660
    @danielbell2660 5 років тому

    I also had an issue where I tried GPIO14 and 15 and it wouldn't work, but did on 21. Is that just a fluke or is something to that? It seemed like you had a similar issue.

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  5 років тому

      I think the 5V logic makes it unreliable with the RPI. I've read online that there is a hack where you add a resistor and it will work better with the RPI.

  • @lewise3885
    @lewise3885 6 років тому

    I had to add a resistor to my gpio pin on boot. It didn't matter what pin I assigned. My python accident work perfectly. The reboot/boot was my issue because it activated the relay. But with one and or two workarounds. 1. User a resistor., 2. Create a bash script to 🔥 a python script at boot.(I still could not get my direct python script to for at boot alone. So I used a bash in-between.)

  • @blanked_out_chin
    @blanked_out_chin 7 років тому

    Hey so why use a 12v PSU? Is that what the DC motor needs? Sorry, I'm new to electronics forgive me!

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  7 років тому

      Used for demonstration purposes. Definitely double check to make sure your dc motor has similar voltage specifications.

    • @channelkerr
      @channelkerr 6 років тому

      A lot of the things used by the relay (eg motors, solenoids) are 12V

  • @approxd
    @approxd 6 років тому

    hey im new to the raspberry pi and just wanted to ask how do i load the script into the pi? in the video you skipped over this part

    • @approxd
      @approxd 6 років тому

      nvm figured it all out great vid mate!

  • @arjanitajeti3500
    @arjanitajeti3500 6 років тому

    Wahts I connect to a 24 volt power suply

  • @yky1360
    @yky1360 4 роки тому +1

    that relay is 5V which means if your output is less than 5V, you can control the relay to close, if larger than 5V, relay is open...but raspberry GPIO pin can only gives you 3.3V maximum...how can you control that relay???

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  4 роки тому

      Hey YK Y, you're correct in that the 5v relays may have issues with the pi. (I made this tutorial a while back and have been meaning to update it)
      You can try using a 3.3v relay instead. Also I found this hack which may work in the meantime: ua-cam.com/video/p7wmzAzDX-Q/v-deo.html

    • @yky1360
      @yky1360 4 роки тому

      @@PiddlerInTheRoot I just found out, if you connect the relay with 3.3V power, and send signal with 3.3V you can actually use that 5V relay.

    • @Anag0n
      @Anag0n 3 роки тому

      @@yky1360 is that safe to do when the relay is controlling a 220v circuit?

    • @yky1360
      @yky1360 3 роки тому

      Mathias Højsleth You can find the spec for this product, usually the working load is printed on the body, like 3A/50VDC or 5A/250VAC etc. and you can also select those products which you can set the mode to be “high-voltage-triggered” or “low-voltage-triggered”.

    • @Anag0n
      @Anag0n 3 роки тому

      @@yky1360 ok, but what you are saying about connecting the 3.3v does that mean I should use the 3.3v gpio instead of the 5v on the PI?

  • @gonzalooviedo5435
    @gonzalooviedo5435 Рік тому

    Thanks!!!!

  • @emranproject4156
    @emranproject4156 5 років тому

    very helpful for meeeeee, thanks

  • @stevenbrown8782
    @stevenbrown8782 6 років тому

    Good video.

  • @vikkashchuk
    @vikkashchuk 6 років тому

    Thanks a bunch!

  • @leon-set
    @leon-set 6 років тому

    Can you use it in europe where mains voltage is around 16Amps?

    • @PiddlerInTheRoot
      @PiddlerInTheRoot  6 років тому

      I'm pretty sure the one in my tutorial is rated for 10 Amps.

  • @ykyk9859
    @ykyk9859 5 років тому

    Thanks!

  • @ggesdsdsdsd
    @ggesdsdsdsd 5 років тому

    so could you run this with a SD card?

  • @eriklaken1025
    @eriklaken1025 6 років тому

    Thank you. :)

  • @aldomefa6256
    @aldomefa6256 6 років тому

    Lol video