Raspberry Pi: 16 Channel Relay how to with example software for automation projects

Поделиться
HTML-код
  • Опубликовано: 22 окт 2024

Комментарии • 394

  • @highwaywarrior1078
    @highwaywarrior1078 6 лет назад +4

    Pete - thanks for this comprehensive guide - it's really been helpful. Having said that and having wired everything up as you said, I too have suffered some of the same issues that others have been reporting here and I believe I have found a work-around that requires no additional components and is very straightforward. I'm using a RPi 3, GrovePi sensor board and a 16 channel relay board very similar to yours except mine is a 5V input rather than 12V. What I eventually established is that you only need one 3V3 connection from the RPi to the relay 5V pin. Leave the other 5V pin unconnected. Then only connect 1 ground wire from the RPi to the GND pin on the relay board - making sure you connect the GND on the same row as the 5V pin you have connected to the RPi. So instead of having 20 wires connecting the RPi to the relay board I only have 18. I have had no problems whatsoever since doing this and all of your scripts have worked as they should. Hope this helps everyone else.

    • @madmax200769
      @madmax200769 2 года назад

      Tried that, it blew my Pi unfortunately :(

  • @marksonstein2807
    @marksonstein2807 8 лет назад +1

    Spent an hour researching why the relays would turn on, but not turn off. Then I saw Eric Steed's post below. Changing the VCC connection from Pin 2 (5V) to Pin 1 (3.3v) and everything worked as expected.

    • @thomaskblr1
      @thomaskblr1 5 лет назад

      OMFG! I wish I would have read this earlier. Spent most of the day thinking I missed a step!

  • @bakerpmp00
    @bakerpmp00 7 лет назад +4

    Connecting the 5v pins on the relay to the 3.3 v pins on the pi fixed the problem of them all turning on at once thanks!

  • @TheMachbose
    @TheMachbose 8 лет назад

    Hi. Wonderful job! Many thanks for that huge work.
    I was searching for "how to connect a SainSmart 16 channel board in the most simpliest way" and I founded it! Thanks!
    In my project, I want to use the 16 channels board directly on a RspiB mounted with Domoticz and an Arduino in USB mounted with "MySensors" and several sensors in a hydroponic project 100% automatized.
    You helped me to leave the first stone. Respect to all people sharings skills and passions over Internet.
    Following you now.

  • @markthrasher5847
    @markthrasher5847 6 лет назад +4

    I have hooked up my 16 port relay and Raspberry 3 per your video. The problem is when the script runs, the relays lock on and won't go off. Not really sure what is going on? Can you help?
    Thanks

  • @fireeeflies
    @fireeeflies 8 лет назад +1

    Thank you for replying , I' ll try to post a video, I have a 4 channel relay running some of your scripts, I have connected 1 LED light strip on each relay, running your script2 I thought the lights would turn on/off in the order the relay is switching (wave like), instead all the 4 led strips light up at the same time, what I wanted to accomplish was to have a sequence in the order the relay is switching like a light show, I know I may be confusing you with this question, so will try to post a video as soon as I can , i ordered all the same parts listed on your 4 channel relay video. Thank you so much!

    • @jamescue7464
      @jamescue7464 4 года назад

      Check your wiring, some wires may be out of sequence?

  • @zq_77
    @zq_77 7 лет назад

    I have the same relay switch except that it runs on 5v instead of 12v (I'm powering it from a 5v 2A dc adapter). Your scripts worked like a charm. Thanks man :-)

  • @krasate
    @krasate 7 лет назад +2

    Hey @skiwithpete, great video and great focus on the camera, thanks.
    One question please, as i have a similar module and struggling to figure out what's wrong.
    If you connect the 12v power to the module and then the 5v+GND from the module to the 5v_GND of the rPi, does it power the rPi on?
    I connected the 12v power to the module, used a multimeter on the 5v and gnd pins and it gives me 5v. Is that normal?
    Could you check on yours?

    • @jamescue7464
      @jamescue7464 4 года назад

      Check the amperage on the 5+v, it should be somewhere between 1.5+ amps to 3.0 amps to power the rpi. Connect the positive of you amp meter to positive post on the board and negative to negative post on the board. Depending on which pi you are using (check what voltage and amperage is required for that pi), you ought to be able to power your pi from that board.

  • @vikingofengland
    @vikingofengland 6 лет назад

    When I get my man cave built, thinking of creating a smart garden with lights and auto plant watering. Thanks for the videos, really clear and understandable.

    • @maarijkhan626
      @maarijkhan626 5 месяцев назад

      Is it a real cave or just a basement?

  • @ericcarrozzo5846
    @ericcarrozzo5846 4 года назад +1

    Great video, i too can't get it to work how you have it shown. Some of the comments have had people connect the 5V rail on the relay to the 3.3v on the PI. While this appears to work, several people said it fried the PI. I think I will have to just use two 8 channel relays for what I want to control. I wasn't too happy about needed a 12v external power source anyway.

    • @jamescue7464
      @jamescue7464 4 года назад

      Check the amperage of the 5+v on the board, if it is higher than what your pi requires it will fry your pi, if it it is too much under the amperage then your pi will not work.

  • @esteed71
    @esteed71 8 лет назад +3

    I figured out what my problem was. I was using the 5 V connection from my pi zero to the board. When I switched it over to 3.3 V, everything worked like a chanp. I'm using the same exact really is you, the same smart 16 channel really with Opto couplers.

    • @alexeyanisimov8744
      @alexeyanisimov8744 8 лет назад

      thanks for the tip! helped in my case as well!

    • @fasihzafar7423
      @fasihzafar7423 8 лет назад +1

      Thanks man.............You Saved me..............!...........Such a Big Help .......(y)

    • @sponsjeee
      @sponsjeee 7 лет назад

      rasp 2b worked for me 2 ! thanks

  • @anthonypottinger385
    @anthonypottinger385 8 лет назад

    Thanks for the video (16 channel Relay Raspi)really useful. Got it all working with a Pi Zero. I noticed that the 5v back feeds from the relay board and powers the Zero, so I am wondering if 5v really needed by the relay board as it appears to provide this via the 12v connection.
    Going to use this to provide an automated control for my wifes doll house light with a LDR and PIR so lights will change when PIR triggers.
    Got a bit of programming to first!

  • @josezepeda7396
    @josezepeda7396 3 года назад

    I know this video is 5 years old but I wanted to put it out there that I have a raspberry pi 4 B and I was getting all relays on at the same time when GND and 5V were supplied to both or just one. I switched that to a single row of GND and 3V3. I also had to not use GPIO4 and GPIO22, not sure why but they were supplying power in LOW and HIGH states. I changes the code for GPIO4 and 22 to GPIO23 and GPIO24 and that solved my power leak issue.
    Summary: use 3V3(only one row) and if any voltage leak change GPIO to another one.

  • @fireeeflies
    @fireeeflies 8 лет назад +1

    Hi, love your video, Im totally new at this, I have set this up and have a question, I connected led lights to it, but all the lights turn n at the same time, is that whats supposed to happen or should they light up in a sequence, thanks,

    • @skiwithpete
      @skiwithpete  8 лет назад

      impossible to tell what you're asking - can you take a video and post it here?

    • @jamescue7464
      @jamescue7464 4 года назад

      Test your relay board, it may be defective?

  • @ohhchhittt
    @ohhchhittt 5 лет назад

    I followed your video that I must say was very easy to follow. Only thing I am not sure on is the power from the pins on the pi to the relay board. The relay board says it's an output of power not a in put. Does it do both or am I reading wrong.
    I'm running 12 v 1 amp power to the relay board and the 5v pin is powering my pi with no transformer. Please help me understand a little better

  • @caspercorneliuspatontan3645
    @caspercorneliuspatontan3645 4 года назад +1

    im having some issues, with just the connections.
    I'm using a RPI 4 with a 16channel 5V relay board. what I'm having trouble with is that when i do a GPIO.setup all the relays with be switch on and i am unable to switch it off or control it, unless i do a cleanup.
    send help

  • @blakechan09
    @blakechan09 6 лет назад +1

    Hi great vid! How would I go on about if I wanted an input from the relay to the board?
    Case scenario being -- when a light in a room has been switched on, I'd like the relay to send a signal to the board that the light has been switched on? -- Would this be possible? How would I go on about tackling on this matter?
    Thanks!!!

    • @jamescue7464
      @jamescue7464 4 года назад

      The only way it could sense that a light has been turned on is to have light sensor at the source of the light, otherwise all it could tell you is if the relay is working or not. It could not even tell you if there is a short in the wiring to the light.

  • @jheckerman
    @jheckerman 6 лет назад +1

    This video is incredible! Thank you for all your precision and detail!!

    • @skiwithpete
      @skiwithpete  6 лет назад

      thanks for your comment, please share and spread!

  • @jewelrybyjd
    @jewelrybyjd Год назад

    This video series is great. My question is. How can you turn on more than one relay at a time? Then turn them off at different times? That way they're not so patterned. They could be more random, or sync to music? Thanks for any help that you can provide.

  • @AnanFakheraldin
    @AnanFakheraldin 8 лет назад +4

    Hi skiwithpete, I'm trying to connect the relay to control my home light.
    I use the relay to turn off/on the light from my Pi with no problems.
    But how can get the input from the physical switch light buttons and update the status of relay in Pi?
    In addition, what is the best way to add more gpio to Pi for example, I need to control 32 relays (outputs) , which means I need 60 gpios ( input + output) , Can I use a chip like this - mcp23017 ?

    • @ernsthaeckel5276
      @ernsthaeckel5276 5 лет назад

      Anan My thoughts exactly!
      It will make the wiring, easy enough here, even more easier.
      What do we rate I2C or SPI? SPI Bus has great range and extendability in space.
      uk.farnell.com/microchip/mcp23017-e-sp/ic-io-expander-16bit-i2c-28dip/dp/1332088?CAWELAID=120173390001317605&CMP=KNC-GUK-GEN-KWL&mckv=PpFlXUmR_dc|pcrid|186409721995|&gclid=Cj0KCQiA8_PfBRC3ARIsAOzJ2up7DjZxOCZL_Cen37JrHBbdhxoFt6XbTe6iTy3dBNfTw0NxUHGfOmAaAjgKEALw_wcB

  • @spawn666reaper
    @spawn666reaper 6 лет назад

    I am planning out a project and I think this video is going to be pretty useful. Thank you so much for making it. My plan is to power some 12v 2amp devices, only, one at a time. My question. If the board uses 12v, what power supply would I need to power: the pi, relay board, and 1 relay output 12v 2 amp? Or do I need to split a separate 12v 2amp power supply into 12 outputs and wire each relay separately? (p.s. just starting out, sorry if its a noob question.)

    • @skiwithpete
      @skiwithpete  6 лет назад

      The pi and the relay need separate power since it operates on 5V. There is a way to step down - but I don't do it. The question you asked though is can 12V power the relay, and power something on the other side too? Yeah, it can. Take a look at my "outdoor light setup" video, you'll see how I split the power.

  • @srfrg9707
    @srfrg9707 4 года назад

    I retrofited an old washing machine with this board. It came with a broken mechanical programmer. The only issue was when runing the motor at full speed the relay burned after a few uses because it was arcing (the motor turns into a generator when speeding down). I needed to add an anti arcing circuit to avoid that so it was not a big issue since I had a few spare relays to use.

  • @ronaldfernandes5697
    @ronaldfernandes5697 4 года назад

    After connecting 5v to relay throu the pie and latter you programmed the pie. After programming tte pie did you connect 12 v to relay when the 5v was connected. While programming. I would like to know

  • @dennischang5296
    @dennischang5296 4 года назад

    Learn a lot from this video. I do have one question. If I was going to wire in some water pumps to this relay. Does the positive wire from my pump go into the center of the relay? The ground for my pump does it go into the relay or should it go back to the power supply?

    • @skiwithpete
      @skiwithpete  4 года назад

      Yeah this only interrupts one wire in the circuit. Positive or neutral it doesn't really matter. But in your example, yes interrupt the positive and the neutral goes straight back to power.

    • @dennischang5296
      @dennischang5296 4 года назад

      But I can ground back to relay also right?

    • @skiwithpete
      @skiwithpete  4 года назад

      @@dennischang5296 No, it's like a light switch. You only interupt one side of the circuit. Both sides don't terminate back.

  • @Ed19601
    @Ed19601 6 лет назад +2

    The problems that various people describe here that all the relays immediately turn on all together isquite explainable when you know the anatomy of this board: It isnt really made for 3v3.
    The input consists of an optocoupler that has its anode tied to +5Volt via a 1k resistor.
    The GPIO of the Raspberry then connects to the cathode of the optocoupler.
    On the secundary side of the optocoupler the collector is tied to 5Volt and the emitter is pulled to earth via a 10k resistor. The emitter then drives an ULN2803 which is an open collector, so it has the relay between the output and the 12 Volt.
    So here is what happens with the signal:
    Raspberry LOW -> optocoupler +serieresistor get 3V3 ->optocoupler opens ->emitter goes HIGH -> INPUT ULN2803 goes HIGH ->OUTPUT ULN2803 goes LOW -> Relay activated.
    So, as you can see from this, and which is clear from the script, you need a LOW to activate the relays and a HIGH to deactivate the relays.
    Now that is where the problem is. The 3V3 RASPI has no problems creating a LOW to activate the relay, but what happens if you send a HIGH.
    For arguments sake lets say that a HIGH on the raspi is 3Volt. That means that the optocoupler + serieresistor will still see 2 Volt.Not much, but it might be enough to open up the optocoupler, which will activate the relay, just as a LOW signal did.
    So why did not everybody have that problem, why did it work for Pete and not for others? Simply because of variation in components.
    So, what to do? Well, the easiest is to add 16 transistor leveladapters that have their collectors connected to the input of the board. added bonus is that they also invert the signal so you get an active HIGH contraption
    another solution is to bypass the LM2576 and feed the primary optocoupler with 3V3.
    Though adding the 16 resistors is a good solution, it is kinda ironic that those 16 resistors by itself already are capable of driving 16 relays

    • @matthewdornfeld2126
      @matthewdornfeld2126 6 лет назад

      Do you have a model/part number that would be good for testing?

    • @Ed19601
      @Ed19601 6 лет назад

      @@matthewdornfeld2126 it is about the one in the link in the discription. Further discussed here: arduinodiy.wordpress.com/2018/09/04/the-16-relay-module-and-the-raspberry-pi-not-an-ideal-marriage/

  • @HuaweiBaru
    @HuaweiBaru 6 лет назад

    good teacher and this good video for whom need detail instruction ... keep educate

  • @garryhartlin2504
    @garryhartlin2504 9 месяцев назад

    In order for the relay board to work for a Raspberry Pi 4 you must ensure the inputs are active HIGH. Most boards out there are active or trigger LOW. If you have a active LOW board you will need to place a Darlington sink drive ahead of the relay board inputs. Use something like a ULN2803. You will need two of them, cost about $1.25 each.

  • @funnyvlog9331
    @funnyvlog9331 Год назад

    Hi Sir pete I found your Channel it's so great,I hope I can learn your program and how use the raspberry board.God bless. I am also a new subscribers of yours . Thanks

  • @bakerpmp00
    @bakerpmp00 7 лет назад

    Is the common wire connected only to the outlets and the relay, also how did you ground the outlets?

  • @insfnds7471
    @insfnds7471 3 года назад

    Nice intro to this 16channel board. One thing I question is why you would set the GPIOs to outputs before setting their state to high. Is this just a limitation of the RPi.GPIO library i.e. it won't let you set the state before it is set to an output? I've not done any gpio work with the RPI yet but I've always set the state first then enable the output that way there is no quick spike on the output.

    • @skiwithpete
      @skiwithpete  3 года назад

      I don't remember why I did this. I think it's because I had two types of relay. One that started high one that started low, so this set them all to same state... But I'm not 100%

  • @jackfernald8823
    @jackfernald8823 8 лет назад +5

    Alright, I have no idea what I'm doing and I've been at it for the last 3 hours. When I run the first program you have all the relays turn on but when it runs through each one individually nothing happens. I've done some testing out found if I set the pin on the board to output the relay activates but when set to input the relay deactivates. I can't control the relay by setting the pin high or low just by changing the mode of the pin to in vs out. Why is it doing this? and how can I fix it?

    • @lukasweishaupt2708
      @lukasweishaupt2708 5 лет назад

      I know your comment is already three years old, but did you fix this issue? And if yes... how?

    • @turke6756
      @turke6756 4 года назад

      Lukas Weishaupt this is the issue I’m working on now let me know if you have a solution

    • @SnowPuffKing
      @SnowPuffKing 4 года назад

      @@turke6756 same issue here

    • @turke6756
      @turke6756 4 года назад +1

      Okay I got it to work with the raspberry pi. My particular relay board and probably yours too works on 5v logic and the pi is 3.3v logic. All you need is a logic level converter can be bought for dirt cheap. (Relays requires the 5v to signal off position so you can turn it on but not off)

    • @turke6756
      @turke6756 4 года назад +1

      Tim Neeley I think I figured it out check my comment below

  • @pgoldstein
    @pgoldstein 8 лет назад

    Hey Mate!! Do you have any project, an idea to make it or even indicate a project including a simple wall light switch that can change the relay status. This way I could monitor, in real time and save into a database, the way I on or off lights and I also could show the real status on a webPage. Cheers

  • @VertZwify
    @VertZwify 8 лет назад

    Hi, First of all thank you for the very interesting video. Then, just a newbie question. The 12V power supply you're linking is 12V and 6A. On the other hand, the 16 channel relay states "12V 16-Channel Relay interface board, and each one needs 15-20mA Driver Current". So I was wondering if this big current discrepancy (6A vs 15-20mA) wasn't a problem or if I'm missing something?

    • @skiwithpete
      @skiwithpete  8 лет назад

      I couldn't find a cheaper power supply that offered less.

    • @skiwithpete
      @skiwithpete  8 лет назад

      SSH. Look it up, it will help you connect.

  • @esteed71
    @esteed71 8 лет назад

    Great tutorial!! Very clear. I have a few questions though. I'm doing this on a pi zero so I don't know if that makes a difference. Whether I have only a few GPIO pins connected to the relay channels or all 16, when it steps through the loop to turn on the first relay, All of the relays that are wired to the Pi turn on for some reason. Also I was wondering what is the reason to have both 5v and both grounds hooked up? I tried several combinations and the only one that seemed to work as expected (partially) was when I didn't have any power or ground hooked up to the Pi. However when I try to turn on more than two relays in this configuration, the board makes a buzzing noise as if it's being underpowered. But- the relays come on one at a time as I expected them to. Any ideas?

    • @skiwithpete
      @skiwithpete  8 лет назад

      +Eric Steed No, that's some unusual behavior. Are there shorts between your GPIOs? Are you sure you have an optocoupler relay? Are you supplying enough power to the Pi Zero (you should still use at least 1A)?

  • @johnlayman2836
    @johnlayman2836 6 лет назад

    Your python programming is absolutely wonderful. I learned so much. Thank you. In the first script, I learned how you designated the pins as output pins using a "for" loop. I wonder why you couldn't do the same thing for the long section where you used "try:" I'm a beginner with python and was just wondering.

    • @skiwithpete
      @skiwithpete  6 лет назад

      John Layman just wanted to show different ways.

  • @dennischang5296
    @dennischang5296 4 года назад

    I went ahead and weirded everything the way you have but when I go to run the script all the relay will kick on same time they will turn off when the run time is over. I also try your other script and same thing. All the relay will power on. Any idea on what I may have done wrong.

  • @GregorySchwartzkopf
    @GregorySchwartzkopf 4 года назад

    According to Sainsmart the 5v pins are powered by the connected 12v power supply (courtesy 5v power according to them). According to RPi docs the USB power supply also delivers 5v on the RPi 5v pins. Can you explain why you've connected these all together?

    • @petergosselin1180
      @petergosselin1180 4 года назад

      On the 8-channel relays there is a VCC and JD-VCC jumper connection which links pins for the 5V power to the board, to the 5V power for the optocouplers. On the 16 channel, there is no connection linking them. And when powered only 5V there is not sufficient power to run all 16 relays (as you'll find through experimentation). When running on 12V alone, the optocouplers do not trip (as you'll find through experimentation). So it is my assumption that the 12V runs the power for the relays, while the 5V is the power for the optocouplers - though I don't have any documentation to back up this finding.

    • @GregorySchwartzkopf
      @GregorySchwartzkopf 2 года назад

      @@petergosselin1180 Actually the voltage regulator on the board (LM2576) can supply up to 3A on the 5V rail, which is more than enough to drive the 16 optocouplers and other ICs on the board, and even has power left over to power a small pi (Zero W takes max 370ma). The 12V rail drives the relay coils, and when they're all on it draws a little under 500ma according to my experimentation. You cannot run this board on a 5V supply alone, as it won't drive the relay coils reliably. Furthermore connecting the 5V or 3.3V rail from the Raspberry Pi to the 5V rail on the Sainsmart board as shown in this video (with the USB power attached to the PI) is a bad idea and will likely end up killing the PI, and even if it doesn't it's bad practice. I found a really easy solution to this in the amazon reviews for this board of all places, which I posted in another comment.

    • @GregorySchwartzkopf
      @GregorySchwartzkopf 2 года назад

      ==Credit to AJ in Amazon reviews for this method... it works great and gives you the ability to have led indicators for the relays external to the board. Scripts provided here will work as is==
      ====DO NOT CONNECT THE POWER PINS TOGETHER ON THE PI AND RELAY BOARD (Unless you are not using a USB to power the PI and want to use the 5v rail on the board to power a low power Pi-- I wouldn't do anything larger than a Zero W as other PIs draw a lot more power)====
      For those that need help this is the easiest way to connect them to the Raspberry PI:
      The relays are triggered on when the pin of the relay is pulled LOW (0) volts. the pins are made for an Arduino but will work with the PI if you connect a 3V LED between the relay board and the PI
      GND pin on relay board ----------> GND pin on Raspberry PI
      Relay Board Pin------> LED Anode (Long Wire) / LED Cathode (Short Wire) -------> GPIO of Raspberry PI
      you will have to do this 16 times.
      This has the added benefits of;
      Indicator if relay is supposed to be on to mount in project box side/top (Unused just leave inside)
      Relays do not trigger ON when rebooting the PI
      Relays do not trigger ON when PI is off
      all parts are cheap and comparable with using resistors.
      How this works:
      When the LED is used this way it is essentially a device that drops the voltage by 3V. converting any excess power to light. The PI requires 3.3v maximum to its pins. This method reduces the 5v to 2v for the PI. (You can check with a multi-meter)
      When the PI GPIO is HIGH (ON) there is 3.3v at the PI and 5v at the relay board. Because the LED requires 3v to operate and there is only 1.7v the led does not conduct power and the opto-coupler in the relay board stays deactivated.
      When the PI GPIO is LOW (off) there is 0v at the PI and 2v at the relay board. Because the PI is forcing the pin low the LED begins to conduct, turning on, The current limiting resistors in the relay board keep the LED from conducting too much power (and burning out) and still provides enough to activate the opto-coupler causing the relay to activate.

  • @vladagrigoroae1767
    @vladagrigoroae1767 2 года назад

    super nice video, i got the same relay board but it's either damaged or there is something I cant't get right. I am using an esp32 as controller, but the relays are activated as soon as i connect the board to my esp, no matter if i set the IO high or low. Now the esp32 outputs 3.3 for high ... i suppose the PI outputs 5v. Also i have noticed on your video you are setting the I/O to LOW for the relay to actuate ? ... should it be a HIGH to actuate? Also I noticed on my board that even without the 12v (only 5 v from the esp board) the leds still light up ... the LED should be ipto-isolated from 5v (they are on the 12v circuit) ... is my board broken or there is a flaw in the design of these boards ?

    • @skiwithpete
      @skiwithpete  2 года назад +1

      I just had someone else say the same thing on another video. Take a look to see if you can find a recent comment here that mentions the same

    • @vladagrigoroae1767
      @vladagrigoroae1767 2 года назад

      @@skiwithpete Found the issue, first of all the board works at 5v so for esp you need a 3v to 5v convertor (there are logical convertors for this). The relays requires a LOW state to activate and a high state to be off. The 3.3v from esp is not enough to be considered HIGH this is why the relay see 3.3v as LOW .. you need 5v to shut them off. Hope this helps other in this situation. After this implementation the integration works perfect

  • @nevinmcginnis9509
    @nevinmcginnis9509 4 года назад

    I am using a raspberry pi 3b+ and the same 16 relay module, When I try to run the first script16_1.py it lights all the relays up and turn off when its done counting to 16. If I try to run the script16_2.py it lights up all the relays until I hit CTRL C.

  • @spawn666reaper
    @spawn666reaper 6 лет назад

    I got my setup in the mail. Tried to reproduce your setup. Seems to work partially. At relay 11 all red leds dim, 12 does switches but does not click and after that the board resets or the pi reboots.
    I have a 2amp 12v power adapter connected, possible thats not enough? (pi is also powered by the relay board.)

  • @rogerbailey3416
    @rogerbailey3416 7 лет назад +2

    Greetings all
    I have the Sainsmart 16 channel board. I have watched the video which is very good. I have hooked my pi up the same way. But I can't seem to get it working right. When I power the pi and run the script, some of the relays come on and stay on. I have loaded your script and it still does the same thing. I wish someone could come up with the answer. I have read the comments from other folks and not really seeing the right answer to get it working. I have a 12V 3 A power supply hooked to the relay board. I have disconnected the ground wires and tried it. Still not working. I have disconnected the 5v wires and even moved them over to the 3 V side. Still not working right. I do see that your running the raspberry pi 2. Could that be the whole problem? I have seen that a few folks have got it running with the raspberry pi 3. I could use some help. Thanks everyone.

  • @balgruufthegreater9072
    @balgruufthegreater9072 8 лет назад

    I want to make a home automation and i bought a 16 channel relay like that for switcking a few things like the gate opening and so on. Everything should be controlled by a server application which i am doing installed and hosted on a raspberry pi. Here's the question: how can I get inputs like checking if the doorway is open?

    • @skiwithpete
      @skiwithpete  8 лет назад

      +Balgruuf The Greater I'd use this: amzn.to/1Jrihjt and poll it for status every 2 seconds or something.

    • @balgruufthegreater9072
      @balgruufthegreater9072 8 лет назад

      Thanks

  • @cuchuoisalay9263
    @cuchuoisalay9263 6 лет назад +4

    I have a trouble when I turn off the relay.
    The code I used is the same as you but I debugged it, when it run to "GPIO.setup([PIN_NUMBER], GPIO.OUT]", the relay of this PIN_NUMBER is turned on.
    Can anybody help me for it?
    THANKS

    • @skiwithpete
      @skiwithpete  4 года назад

      turning off that pin, will turn it off. You will find that in the code as well.

  • @cylycious
    @cylycious 5 лет назад

    Hi Pete,
    Great tutorial, especially for beginners like me! I must be doing something wrong, though. I used a rp3 and python 3.5 so I added parentheses to your script. I tried to run 16_1 and 16_2 and in both of them at start all relay diodes light up and only switch off when I ctrl+C the process. Any idea what I could be doing wrong? Thanks so much, I love the way you explain things! :)

    • @skiwithpete
      @skiwithpete  5 лет назад

      They're activating on the low setting

  • @ninoinreno
    @ninoinreno 7 лет назад

    Great video!! If I wanted to connect (4) 16 channel SainSmart relays, could a single raspberry pi run all four relays? Thank you!

    • @xmetrix
      @xmetrix 4 года назад

      3 years later nobody answered your question, how sad. yea you could but you would need a way to control 64 pins. think multiplexers. shift registers, etc. it is possible to control hundreds of gpio pins with only a few.

    • @joshuamontalbano1875
      @joshuamontalbano1875 4 года назад

      (yes this is 3 years later but 3 years ago i was not into tech) it is possible using MCP23017 chips with IC2 controlling them, you're in for a long ride if you want 16 individual relays working though its a steep learning curve but there are several tutorials on this chipset

  • @dennischang5296
    @dennischang5296 4 года назад

    I notice when the GPIO is set to "output" doesn't matter if it's true/high or false/low, there is some voltage coming out of that GPIO pin. Very low .179volts, this is why I think the relay stays on, and doesn't turn off for me.

  • @thifabri
    @thifabri 6 лет назад

    Hi skiwithpete, I followed all steps with all attention, but when I tried to execute wich one code, all relay was activated.
    Do you know how can I solve it?
    Thank you and congrats for the great video.

    • @skiwithpete
      @skiwithpete  6 лет назад

      Thiago Fabri this is likely caused by a non-optocoupler relay.

  • @dexterweb
    @dexterweb 7 лет назад

    i've tryed with my PI3B with a 12v 2.5A power adapter and pins connected to 3.3 v on the PI side and...surprise surprise, the PI turns on without his power adapter.
    In some way electricity from the relay board flows to the PI and keeps it running.
    is this ok? should i still power the PI with its adapter?

  • @xmetrix
    @xmetrix 4 года назад

    Your description links to the 12v version of the relay board. I have the exact same board and these scripts do not work. Can you confirm you have the same board as you linked to because somethings wrong on my end.

    • @skiwithpete
      @skiwithpete  4 года назад

      I just went and looked, and I can confirm that I have the 12V version of this board, exactly as linked, and that I'm powering with a 12V power supply and driving the relays with with the Raspberry Pi.

    • @xmetrix
      @xmetrix 4 года назад

      @@skiwithpete ok thanks for the confirmation. clearly there's an issue with my relay board or difference in raspberry pi's, maybe the rpi a has more driving current than the 3? Either way none of your scripts work for me. I mainly write all my code in javascript and it works fine with my 2 channel 5v relay boards when i have a handful of them connected. Gotta find my multimeter to debug the problem =( Figured i'd just follow someone elses known working code to rule out any issue with my software side.

  • @yumaxbox
    @yumaxbox 8 лет назад +4

    Having a problem, following your great video. Every script i ran turns all the relays on at once and the only way to turn them off is by exiting the script with Ctrl-X Any ideas ?

    • @yumaxbox
      @yumaxbox 8 лет назад

      BTW I am using a raspberry pi 3

    • @yumaxbox
      @yumaxbox 8 лет назад

      Also, my 12V supply is 2A is that a problem ?

    • @bobbyhill3740
      @bobbyhill3740 8 лет назад +1

      I am having this same issue. Did you find a solution?

    • @Excess-qn7qh
      @Excess-qn7qh 7 лет назад +1

      same for me :(
      raspberry pi 3

    • @bobbyhill3740
      @bobbyhill3740 7 лет назад +5

      I figured out a solution to this issue. Connect the 5v Constant pins on the Relay to the 3.3v pins on the Raspberry Pi.

  • @ryanhebron4287
    @ryanhebron4287 8 лет назад +2

    I like how they used optocouplers on-board it makes it less worrisome about buffering the GPIO's. I did unfortunately have a death in my Raspberry Pi family. This is the cost of not checking your GPIO wiring.

  • @RbrtWlkr
    @RbrtWlkr 7 лет назад

    Why did you need to plug in the 5v if you are taking 12v from the power supply?

  • @bubba1984
    @bubba1984 8 лет назад +1

    so are those inputs on the board pulled up to 5v?

  • @Lurxyboy
    @Lurxyboy 8 лет назад

    Hi mate,
    really nice video!
    I almost have the same setup at home (I am waiting for my powersupply, I run with 12V 0.6A atm and a RPi B+)
    the problem that I struggle with is that all the 16 channels turn on at once as soon as I change the GPIO state from IN to OUT.
    It doesnt matter how much I change from LOW to HIGH the relays stay turned on forever.
    the relayboard that I have is an ebay kina version could it be that the relayboard is faulty and how can I test this out? what do you think is the problem? if anyone here have any ideas that might help that would be great.

    • @fasihzafar7423
      @fasihzafar7423 8 лет назад

      i have also the same problem, 2 channel relay works perfectly,when i connect 16 channel, the relays stay turned on forever.i am using 12v 2 amp power-supply for relay.

  • @louisstacey8060
    @louisstacey8060 8 лет назад

    thank you so much you make the best pi projects always work thank you so much

  • @isaacfainsod1986
    @isaacfainsod1986 7 лет назад

    Do you know if I can use a computer power supply (12v cable) to give energy to the relays

  • @howardpinsky6946
    @howardpinsky6946 7 лет назад

    Thanks for putting this video together. I am using a Raspberry Pi 3 b+ and copied your script and wiring to the letter. When I run the script all of the relays turn on at once, stay on and then all turn off at the end of the script. I have tried it with all the GPIO wires connected and with removing the GND GPIO wires and get the same results. Any suggestions?
    Thanks

    • @douglaslight4489
      @douglaslight4489 7 лет назад

      Howard I have the same problem and the same setup as you. Did you ever get it resolved?

    • @howardpinsky6946
      @howardpinsky6946 7 лет назад

      I ended up disconnecting the ground wires from the PI to the controller and then connecting the 3.3 V pins on PI to the 5V pins on the relay board. Seems to be working perfectly now.

    • @douglaslight4489
      @douglaslight4489 7 лет назад

      Thanks. will give it a try.

    • @douglaslight4489
      @douglaslight4489 7 лет назад

      Well Mr. Pinsky. It works!!! Thank You Sir...

    • @howardpinsky6946
      @howardpinsky6946 7 лет назад

      Douglas Light excellent! Glad it worked. I found this solution somewhere online and tried it. I think the problem was that the 5V in was backfeeding to the PI. Removing the ground wires and switching to the 3.3 v solved the problem for me. Glad it worked for you as well!!

  • @igormenin
    @igormenin 8 лет назад

    Hi skiwithpete! I have a project to start automating the lights of my house. I have this board of 16 channels, and bought a plate with network interface RJ45 style the SaintSmart. I'm just doubt with the module supply to the relay because of the 16 relays will use at least initially 14 and do not know what the correct amperage to use this module with all this capacity?

    • @skiwithpete
      @skiwithpete  8 лет назад +1

      do not play with mains electricity. wiring lights is dangerous! and must be left to professionals!

    • @igormenin
      @igormenin 8 лет назад +1

      Exactly. Was I who made all the electrical network from my home.

  • @stevenfrazier7959
    @stevenfrazier7959 6 лет назад

    Have you done anything with mqtt with any of your relays?

  • @dvdgmz
    @dvdgmz 6 лет назад

    Can the raspberry take inputs and translate them into a specific sequence of outputs?

  • @smartassist9700
    @smartassist9700 4 года назад

    I am disabled and have 8 switch and raspberry pi 3b+. I need it to read a capacitive moisture sensor.....if dry start water pump until sensor says “wet” then turn off small pump. Continuous moisture monitoring . 4 plants = 4 sensors and 4 pumps. I think 8 switch. Wiring. I need very long wires for sensors and pumps. PI will be in garage with switch on wall. Wires for sensors and water pumps ran outside to each plant. Can you help with detail video? And is there code written already?
    I can have vegetables then. I cannot care for them by myself due to disability.
    Please help or direct me to a source. You can leave message here. We go from there.
    Most Humble Appreciation! Alton

  • @johnisler560
    @johnisler560 8 лет назад +1

    HELP
    I have a problem...
    I have all the same things as him except when I try to run the code, instead of turning relay 1 on then relay 2, ect, all relays turn on. The code is still saying that it is turning on the relays but they are all on. They are wired the same as his i have checked many times. I need help!!

    • @Darry86mike
      @Darry86mike 6 лет назад

      i have same issue. any solution?

  • @ProDesigneHd
    @ProDesigneHd 8 лет назад

    what wire gauge did you use to connect the channel relay to the power source? For my own project I used 14 awg and was really hard to put in since it was too big

    • @skiwithpete
      @skiwithpete  8 лет назад +1

      +ProDesignHd I'm using just 24AWG for the 12V.

    • @ProDesigneHd
      @ProDesigneHd 8 лет назад

      thanks for specifying :)

    • @ahmedalzayani8883
      @ahmedalzayani8883 8 лет назад

      +skiwithpete
      I received these relay shield from amazon and tested it but something
      weird, when I connect the relays to the raspberry pi 3and run the program all leds automatically turn on. I'm using the
      same python code you use it, please any one advise what I should I do
      Link for the relay I have it
      www.amazon.com/SainSmart-101-70-103-16-Channel-Relay-Module/dp/B0057OC66U?ie=UTF8&psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s00

  • @Jexjo
    @Jexjo 3 года назад

    Exacly what i'm searching for, thank you very much!

  • @daveofyorkshire301
    @daveofyorkshire301 2 года назад

    For christmas lights you wouldn't want all that clicking, you'd use a MOSFET OR SSR (solid state relay)... They use less power, are silent in operation of and can switch at significantly faster rates. Plus a bank if them would take up significantly less space...

  • @ValentinScarevnea
    @ValentinScarevnea 5 лет назад

    Hi, is it necessary to use both 5V pins?

  • @eric_7761
    @eric_7761 6 лет назад

    I´m curios. Why 12V supply if the realy partnumber says 5vdc? is there a regulator on this board

  • @ahmadtauhid2807
    @ahmadtauhid2807 4 года назад

    hi.. it possible to add 8 channel relay again to single raspi board?

  • @nickwall2288
    @nickwall2288 3 года назад +1

    Awesome thanks for the very helpful video

  • @adiasbr
    @adiasbr 7 лет назад

    Great project. Useful videos for beginners. Can you explain how safely i work with 110 volts?

    • @skiwithpete
      @skiwithpete  7 лет назад

      Take some electrician courses. They're typically offered at local community colleges and you can do the basics in just a couple of hours.

    • @adiasbr
      @adiasbr 7 лет назад

      Thank you. I have other question: it´s necessary to use a resistor in each relay?

    • @AndrewMurphy8383
      @AndrewMurphy8383 7 лет назад

      I am trying to write a script that would turn on one relay and it stays on while using ur script how would add or mod ur script to leave on one while the others are off if u could help you could give me would welcome

    • @AndrewMurphy8383
      @AndrewMurphy8383 7 лет назад

      I am trying to write a script that would turn on one relay and it stays on while using ur script how would add or mod ur script to leave on one while the others are off if u could help you could give me would welcome

  • @yvesdev386
    @yvesdev386 8 лет назад +1

    This was very informing. keep it up, these are great!

  • @kitajima_e
    @kitajima_e 7 лет назад

    good project, but its good to stick to color codes especially on the power side

  • @jeremycaudill6916
    @jeremycaudill6916 6 лет назад

    Any tutorials on what to do with the relay afterwards ?

  • @Brounds24ify
    @Brounds24ify 3 года назад +1

    When I plug my relay all the channels light up, even with out our attached. Can someone help?

  • @mohdasifmoulvi3854
    @mohdasifmoulvi3854 6 лет назад

    thank you
    i learnt very much from u r videos

  • @timothyphan3959
    @timothyphan3959 7 лет назад

    will the Pi have enough 5V power to control two 8-channels relays to make a 16-relays solution?

    • @xmetrix
      @xmetrix 4 года назад

      if you're using relays with external power to trigger the relays you should be fine since the 5v is simply there to trigger the optocoupler to send the external power to energize the relay

  • @Darwinion
    @Darwinion 2 года назад

    Those are NOT 5V input pins on the relay board. This is the second video I have seen where this is stated. Those are 5V OUTPUT pins used for things like Arduino if the user wanted to piggy back their Arduino off the back of the relay board. There is even a chip that regulates that 5V output supply from the 12V supply you add under those screw sockets. I dunno if the Pi has separate 5V input pins though. The Arduino does. It is a poorish design placing those 5V and GND pins alongside the low level inputs. It is confusing. Those 5V and GND pins should be separated elsewhere on the board.

  • @sahilharit7736
    @sahilharit7736 8 лет назад

    Can I give my relay ,the 5V power through VCC through any external 5V supply without connecting it to my raspberry pi's 5V GPIO (and ground GPIO)?But only connecting the commanding GPIO between pi and Relay.

    • @skiwithpete
      @skiwithpete  8 лет назад

      +Sahil Harit Yes, but you will still need to connect it to the Raspberry Pi's GND as you need the 3V3 from the GPIOs to ground on the Pi.

    • @sahilharit7736
      @sahilharit7736 8 лет назад

      +skiwithpete ok, thanks!

  • @alextadeo8455
    @alextadeo8455 7 лет назад

    Could i wire up 2 16-channel relays to the Pi's 40 pins?

  • @forklift385
    @forklift385 8 лет назад

    any way to have some sort of graphical interface that could be renamed through the graphics? Im trying for something like this for my vehicle to control lights and have a gauge display from the OBD. Id like the lights to be dimmable and color changing, then I might incorporate GPS as well

    • @skiwithpete
      @skiwithpete  8 лет назад

      +forklift385 I'd use HTML/PHP because I'm most familiar with that as a language, but I'm sure you could just use Python if you wanted.

  • @apbesieged
    @apbesieged 6 лет назад

    Is there something like this with a silent alternative. I'm noticing in the video they each make a click when turning on. My goal is to add lighting to a Lego city i am making and would like to have software turn on and off lights at random intervals. I would prefer there isn't a constant clicking sound being emitting from under the table.

    • @skiwithpete
      @skiwithpete  6 лет назад

      Solid state relays might be a possibility, but they require higher voltages passing through them in order to operate.

  • @SaeedAhmed-ix8nm
    @SaeedAhmed-ix8nm 6 лет назад

    Thanks for the Video. I have the question.I want to turn ON and Turn OFF in 24 Hours (Means scheduler for every day for 30 days). I need some help with the code. I want to include the Time stamp and also which relay are Turn ON.

    • @skiwithpete
      @skiwithpete  6 лет назад

      please look in the About Section for the example code.

    • @SaeedAhmed-ix8nm
      @SaeedAhmed-ix8nm 6 лет назад

      Thanks for the Answer. But where to find? can you send me link. Please

    • @skiwithpete
      @skiwithpete  6 лет назад +1

      The video description. The code is on this page.

    • @SaeedAhmed-ix8nm
      @SaeedAhmed-ix8nm 6 лет назад

      Thanks for the answer. I check the code and it is working for me. I got the following code. it is working fine for me.
      github.com/skiwithpete/relaypi/blob/master/16port/script16_5.py
      But i also want to include the time stamps every hour and also the pin numbers which were active? What i have to include in the code.

  • @henryfitzthum7563
    @henryfitzthum7563 7 лет назад

    Hi do you know if one Can run RGB lights from this relay

  • @dbweathe
    @dbweathe 8 лет назад +2

    I get that the relay board needs 12v on it's own, but why did you connect the 5v wires and grounds from the pi?

    • @skiwithpete
      @skiwithpete  8 лет назад

      +Darren Weatherall without the grounds, the 3v3 of the GPIOs wouldn't flow. The 5V is a different question. I never thought to disconnect that, might be worth a try...

    • @dbweathe
      @dbweathe 8 лет назад

      +skiwithpete Thanks for the quick reply. I took another look at my relay (I have the sainsmart ssr 8 channel board), and it's a 5v board with only one power source. I followed your video and everything works great. Thanks, you've helped me get on my way to building my xmas light project.

    • @CloverGao
      @CloverGao 7 лет назад +1

      Hi. I had my raspberry pi 2 connected to a 2 channel relay for a while and yesterday I upgraded to 16 following your tutorial. My raspberry pi shut itself off today and was much warmer than usual. I wasn't sure why so I unplugged the raspberry pi. To my surprise the still had power which made me confused. I googled and I found out its possible to power the raspberry pi through the pins.
      I used a volt meter to test the two 5 volt pins on the board relay board. With my raspberry pi unplugged and the Relay plugged it, it shows there's 5 volts outputted to the 2 pins.
      I unplugged the 3.3 volt from the raspberry pi to the board and it works fine for now.
      If someone else has the time, can they confirm this.

    • @johnlayman2836
      @johnlayman2836 6 лет назад

      The sainsmart 16 channel relay board produces its own 5 volt through a transformer. If you hook up 3.3 volt from the Pi, you risk ruining your Pi. Some say it will work without the Pi 3.3 or 5 volt from the Pi. I believe this relay board has been modified since this video was produced.

    • @adamqwan7628
      @adamqwan7628 6 лет назад

      This may have happened to me. Pi no longer boots and shows a red LED after switching to the 3.3 pins. Maybe a good warning for others

  • @fuzzywuzzy9550
    @fuzzywuzzy9550 6 лет назад

    would you use a relay and a motor controller

  • @fireeeflies
    @fireeeflies 8 лет назад

    Sorry, disregard, I figured it out, , now can you tell me how to run all the scripts one after another or how do I make one script out of all of tuem?
    Thanks,Milton

    • @skiwithpete
      @skiwithpete  8 лет назад

      :) Don't want you to rely on me. You can do it!

    • @fireeeflies
      @fireeeflies 8 лет назад

      Lol. I'm trying. Thanks

  • @martinbaptiste4276
    @martinbaptiste4276 4 года назад

    But there is a safety problem for the Pi right ? because the relay board send a 5v signal to the Pi and the GPIO pins can only sustain 3.3v... Am I missing something ?

    • @skiwithpete
      @skiwithpete  4 года назад

      It's so weird that people keep saying this weird stuff about 5V and 3.3V - where are you getting this information from? Since the very first Raspberry Pi, GPIO's have ALWAYS had 3.3V and 5V rails. Are you talking about the Optocoupler? It needs a tiny voltage (like under 1.6V) signal to operate, as long as it's powered by 5V. Again, I'd love to know where the source of this misinformation is, so I can cut it off at the source... over the years, sooooo many people have commented about this.

    • @martinbaptiste4276
      @martinbaptiste4276 4 года назад

      @@skiwithpete The forums are crowded of people saying their GPIO pins do not work anymore, and almost every time it is because of the relays... Here is a link of how to safely do it (I showed your video in it btw) : www.raspberrypi.org/forums/viewtopic.php?f=91&t=270153&start=25 (read from page 2)

  • @peterlewis7859
    @peterlewis7859 6 лет назад

    Thanks Pete Great video this kind of setup was almost exactly what i was looking for on my current project. Quick question, can you or have you seen anyone operate they boards over a CAN bus style system. I working this into an automotive application and it would be easier to integrate than running 15 feet of wire off the GPIOs.

    • @skiwithpete
      @skiwithpete  6 лет назад

      I have no idea... What's a CAN bus?

    • @peterlewis7859
      @peterlewis7859 6 лет назад

      Bosch CAN bus is a 2 wire communication system commonly used in automotive and industrial systems that allows multiple ECUs to network information. www.hackster.io/juanespj/canbus-vesc-psoc-4m-5lp-0fc3cb I was reading about making an SPI to CAN adapter with a MCP2515 chip but I can't have an open bread board rattling around in a dashboard.

  • @cydoniaoutlaw
    @cydoniaoutlaw 6 лет назад

    After switching from 5V to 3.3V from the raspberry pi 3 it worked!!! Thanks for the info. Now a question... is anyone having trouble with gpio 11 &16 switching relay #1 on and off? This is driving me crazy!

    • @DFEUERMAN
      @DFEUERMAN 5 лет назад

      I tried using the 3.3v and it destroyed my Pi :(

  • @IstiaqueAhamed
    @IstiaqueAhamed 7 лет назад

    Can I use 12V, 5A power supply ?

  • @lex.alzate
    @lex.alzate 7 лет назад

    Didn't you need to add a transitor, so you can trigger the relay? Since pi pins are 3v3 , I'm having that issue so my relay is being activated

    • @skiwithpete
      @skiwithpete  7 лет назад

      Alex A Octocoupler relays.

    • @lex.alzate
      @lex.alzate 7 лет назад

      I'm using the very same you did, I wonder what I'm doing wrong, I read on the comments that the 3.3 v should be used instead of the 5v from the pi to the relay

    • @skiwithpete
      @skiwithpete  7 лет назад

      Alex A follow my instructions exactly. I have other relay videos. Watch those.

  • @brianf21
    @brianf21 8 лет назад

    When I change the pin from IN to OUT the led comes on and I hear the relay click, but I cannot turn the led off by changing it from HIGH to LOW or LOW to HIGH. Can you think of anything that I might be doing wrong?

    • @brianf21
      @brianf21 8 лет назад +1

      +Brian Faris I solved it. I accidentally the connected one of the 5v on the relay to the 3.3v on the pi and everything started to work. Right now I have the pins for each relay conneced to the pi, the 12v connect to the external power supply, and one of the 5v on the relay connected to the 3.3v on the pi. I hope this helps someone else.

    • @coedshowers
      @coedshowers 8 лет назад +1

      +Brian Faris when i tried this is killed my pi :/

    • @brianf21
      @brianf21 8 лет назад

      +coedshowers Shouldn't have fried your pi. The pin should be able to handle 5v. You are only putting in 3.3v.

    • @coedshowers
      @coedshowers 8 лет назад +1

      +Brian Faris the relay spits out 5v when i plug it in. the 5v goes back into the 3.3v and fried pi

    • @sjabbie88
      @sjabbie88 8 лет назад

      +coedshowers I have had the same incident, but it only occured when the Pi was OFF, when I turned on the Relay Panel.....I`m now creating a circuit with an additional small relay to ensure that the relay panel can only be turned on when the small relay is switched on by a designated GPIO port....

  • @masehacker
    @masehacker 8 лет назад +1

    This worked for me finally with a SainSmart 16-Way Level Conversion Module for Raspberry Pi.
    I made a template for a php menu system that has on/off menu and a status red/green light to see which one is on atm.
    If you are interested msg me. Very simple to install just unzip and run a sudo cp command to get the files in the right directory.

    • @pranavjgangani
      @pranavjgangani 8 лет назад

      I just bought a Sainsmart 16 way Level converter after reading the comments here. Could u guide me how to connect the pins between Pi, 16-way level converter and 12v 16-Ch Relay?

  • @noelgarcia7578
    @noelgarcia7578 8 лет назад

    Hi, skiwithpete, i have a problem, when GPIO.LOW, open, but when GPIO.HIGH, not closed. You know which will is my problem?

    • @skiwithpete
      @skiwithpete  8 лет назад

      +Noel Garcia No, I don't I'm afraid. Hopefully someone else spots this and can chip in.

  • @miteshpatel5483
    @miteshpatel5483 8 лет назад

    As raspberry gpio gives 3.3v and relay requires 5v, will it work without any extra hardware? sorry in advance if my question is silly.

    • @skiwithpete
      @skiwithpete  8 лет назад

      +mitesh patel Take a look at pins 2 & 4. i.stack.imgur.com/Ct2JG.png

    • @sjabbie88
      @sjabbie88 8 лет назад +1

      +skiwithpete Those pins are indeed 5V, but the GPIO pins work at 3.3V: A voltage near 3.3 V is interpreted as a logic one while a voltage near zero volts is a logic zero. The maximum voltage allowed to be put on a GPIO pin is 3.3V. If the low-level-input pins of the relay board measure 5+V, then this might become tricky for the PI....max I=0.5 mA.

    • @skiwithpete
      @skiwithpete  8 лет назад

      +sjabbie88 Nope, the relay is triggered by the GPIO voltage being reduced to zero.

    • @matthewdornfeld2126
      @matthewdornfeld2126 6 лет назад

      +skiwithpete I am having issues that seem to be related to the GPIO using 3.3V logic.

  • @AskShahzad
    @AskShahzad 7 лет назад

    how much AMP load we can pass through each port of relay ? for example we have routers, lights, fans, tv,
    can we connect all of them with these without Burnout ?

    • @skiwithpete
      @skiwithpete  7 лет назад

      Shahzad Khan you should refer to your specific relay model

    • @AskShahzad
      @AskShahzad 7 лет назад

      skiwithpete it's same. Like one 16 channel I have 4 channel powered from raspberry pi 3

    • @skiwithpete
      @skiwithpete  7 лет назад

      Shahzad Khan then refer to each relays specs.

    • @AskShahzad
      @AskShahzad 7 лет назад

      skiwithpete these blue ones have written 10A on them. So can we pass upto 10Amp load ?

    • @skiwithpete
      @skiwithpete  7 лет назад

      Shahzad Khan yes. but don't play with mains electricity. it is very dangerous. contact a professional before every attempting that.

  • @matthewpferchy5298
    @matthewpferchy5298 8 лет назад

    I received these relay shield from amazon and tested it but something
    weird, when I connect the relays to the raspberry pi 3and run the program all leds and relays automatically turn on. I'm using the
    same python code you use it, please any one advise what I should I do???

  • @JhelumNet
    @JhelumNet 7 лет назад +1

    You can be a good teacher 👨‍🏫

    • @daveklebt7732
      @daveklebt7732 7 лет назад

      yes, grasshopper, after your toil in the garden of Herculean Code Edit and clean the Augean Stables of Rewire then you will eventually discover that 3.3v is correct and 5V will make you head spin for an interminable time. Only then can you pass the test and walk gently across the rice paper to brand your arms with the Rasperian logo.

  • @siamakmojdeh
    @siamakmojdeh 8 лет назад

    Thank you so much for your video. very help helpful.

  • @darrellnull5090
    @darrellnull5090 8 лет назад +2

    When I run the script16_1.py on a Raspberry Pi 2 all of the relays turn on simultaneously like some of the others have posted here. I have tested from one of the grounds on the relay to any of the 16 channels while the script is not running on the PI and the voltage shows about 4.6V. When the script is running the same test shows about .13V. When the script is finished looping and prints goodbye, all of the relays go off simultaneously as expected. The same thing happens when pressing CTRL + C as expected. I have checked all of the wiring multiple times, have both 5V connectors and two of the grounds from the PI to the 5V connectors and both grounds on the relay. I have not tried connecting the 3.3V connectors on the PI to the 5V connectors on the relay out of fear of frying the PI. I also tried changing HIGH to LOW and LOW to HIGH in the script with no change either. Any help would be greatly appreciated. Thanks in advance.
    Another observation that I made is that if I just hookup both 5V and ground connections along with just a few channels, but do not power on the PI with its 5V adapter, when I plug in the power for the relay, 5V flows back into the PI and powers it on too. Not sure if that is supposed to happen or not.

    • @steelwolf411
      @steelwolf411 8 лет назад

      I am having the exact same problem as you, have you found a solution?

    • @steelwolf411
      @steelwolf411 8 лет назад

      I found a solution. Remove the connection from ground to the relay. this will fix the problem.

    • @Lavisher1
      @Lavisher1 8 лет назад

      I am having something similar to this problem and removing the connection from ground to the relay did NOT fix the problem. I have tried this on both RPi 2 model B and a RPi 3 model B with the 16 channel relay that requires 12V power supply, and my issue is when I set the pin to be an output pin it goes HIGH, but then when trying to set the pin LOW the relay will not switch open. This happens no matter what I'm using i.e. python, wiringPi, or BCM2835.
      example from terminal (wiringPi):
      gpio -g mode 17 output (sets the pin to output and is instantly HIGH)
      gpio -g write 17 0 (pulls the pin LOW and is suppose to turn off the relay, but does not work)
      #even using gpio readall says the pin is set to 0, but the relay is still stuck in the closed position.
      example from python script:
      import RPi.GPIO as INOUT, time
      INOUT.setmode(INOUT.BCM)
      pin = 17
      INOUT.setup(pin, INOUT.OUT)
      try:
      while True:
      INOUT.output(pin, INOUT.HIGH)
      time.sleep(0.2)
      INOUT.output(pin, INOUT.LOW)
      time.sleep(0.2)
      except KeyboardInterrupt:
      print ("Program Interrupted")
      INOUT.cleanup()
      If anyone knows what I'm doing wrong I'd love to hear back as I'm out of ideas to try.

    • @darrellnull5090
      @darrellnull5090 8 лет назад

      I am thinking that he just got lucky. I have it working fine with an Arduino that puts out 5v on the gpio instead of the 3.3v on the gpio for the PI and am thinking that a transistor is needed for each gpio to increase the voltage to 5volt to trigger each relay. I would be interested to know what voltage Pete is getting from his PI gpio pins to see if perhaps his is putting out more voltage.

    • @skiwithpete
      @skiwithpete  8 лет назад

      Got lucky? No. Try to watch my other 8channel videos. You should be able to set it up the same way then add the 12V power. The problem Ryan is facing, is likely to do with the GND power returning to the Pi.