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

  Рет қаралды 219,287

skiwithpete

skiwithpete

Күн бұрын

Пікірлер: 394
@highwaywarrior1078
@highwaywarrior1078 6 жыл бұрын
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 :(
@markthrasher5847
@markthrasher5847 7 жыл бұрын
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
@marksonstein2807
@marksonstein2807 8 жыл бұрын
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!
@krasate
@krasate 7 жыл бұрын
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.
@bakerpmp00
@bakerpmp00 8 жыл бұрын
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!
@caspercorneliuspatontan3645
@caspercorneliuspatontan3645 4 жыл бұрын
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
@fireeeflies
@fireeeflies 8 жыл бұрын
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?
@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.
@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
@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%
@xmetrix
@xmetrix 5 жыл бұрын
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 5 жыл бұрын
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 5 жыл бұрын
@@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.
@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.
@blakechan09
@blakechan09 7 жыл бұрын
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.
@ohhchhittt
@ohhchhittt 6 жыл бұрын
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
@fireeeflies
@fireeeflies 8 жыл бұрын
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?
@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.
@jackfernald8823
@jackfernald8823 8 жыл бұрын
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 жыл бұрын
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 жыл бұрын
Tim Neeley I think I figured it out check my comment below
@johnisler560
@johnisler560 8 жыл бұрын
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?
@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 жыл бұрын
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
@AnanFakheraldin
@AnanFakheraldin 8 жыл бұрын
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 6 жыл бұрын
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
@ericcarrozzo5846
@ericcarrozzo5846 5 жыл бұрын
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.
@forklift385
@forklift385 9 жыл бұрын
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 9 жыл бұрын
+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.
@bakerpmp00
@bakerpmp00 8 жыл бұрын
Is the common wire connected only to the outlets and the relay, also how did you ground the outlets?
@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.
@Ed19601
@Ed19601 6 жыл бұрын
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/
@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!
@bubba1984
@bubba1984 8 жыл бұрын
so are those inputs on the board pulled up to 5v?
@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 жыл бұрын
do not play with mains electricity. wiring lights is dangerous! and must be left to professionals!
@igormenin
@igormenin 8 жыл бұрын
Exactly. Was I who made all the electrical network from my home.
@balgruufthegreater9072
@balgruufthegreater9072 9 жыл бұрын
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 9 жыл бұрын
+Balgruuf The Greater I'd use this: amzn.to/1Jrihjt and poll it for status every 2 seconds or something.
@balgruufthegreater9072
@balgruufthegreater9072 9 жыл бұрын
Thanks
@ProDesigneHd
@ProDesigneHd 9 жыл бұрын
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 9 жыл бұрын
+ProDesignHd I'm using just 24AWG for the 12V.
@ProDesigneHd
@ProDesigneHd 9 жыл бұрын
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
@howardpinsky6946
@howardpinsky6946 8 жыл бұрын
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!!
@jewelrybyjd
@jewelrybyjd 2 жыл бұрын
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.
@cuchuoisalay9263
@cuchuoisalay9263 6 жыл бұрын
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.
@apbesieged
@apbesieged 7 жыл бұрын
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 7 жыл бұрын
Solid state relays might be a possibility, but they require higher voltages passing through them in order to operate.
@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.
@Brounds24ify
@Brounds24ify 4 жыл бұрын
When I plug my relay all the channels light up, even with out our attached. Can someone help?
@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.)
@dbweathe
@dbweathe 8 жыл бұрын
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 8 жыл бұрын
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
@garryhartlin2504
@garryhartlin2504 11 ай бұрын
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.
@mspaniel
@mspaniel 8 жыл бұрын
I have everything hooked up the same as you but when I run the script that I copied and pasted all it does is turn all of the relays on at once. Please help I do not know why I cant get them to cycle on and off.
@skiwithpete
@skiwithpete 8 жыл бұрын
Do you have the Pi3? Aethereon wrote a script for the Pi3 that I haven't tested yet. It's in the comments section below.
@mspaniel
@mspaniel 8 жыл бұрын
I am using a Pi2B
@psykox
@psykox 8 жыл бұрын
I have the same issue. I have spent so much time with this issue. I have yet to find a solution. I have come to the conclusion that the relay picks up the very low current from the Pi even when its on 0 because my test LED doesn't light up. I have the Pi2B as well. Its hard to blame the pi or the relay. Its a little bit of both.
@esteed71
@esteed71 9 жыл бұрын
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 9 жыл бұрын
+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)?
@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.
@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.
@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?
@yumaxbox
@yumaxbox 8 жыл бұрын
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 жыл бұрын
I am having this same issue. Did you find a solution?
@Excess-qn7qh
@Excess-qn7qh 8 жыл бұрын
same for me :( raspberry pi 3
@bobbyhill3740
@bobbyhill3740 8 жыл бұрын
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.
@RbrtWlkr
@RbrtWlkr 7 жыл бұрын
Why did you need to plug in the 5v if you are taking 12v from the power supply?
@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)
@berwahid
@berwahid 4 жыл бұрын
hi.. it possible to add 8 channel relay again to single raspi board?
@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.
@AndrewMurphy8383
@AndrewMurphy8383 7 жыл бұрын
@skiwithpete 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
@skiwithpete
@skiwithpete 7 жыл бұрын
Watch my 4 channel relay video to see more script examples
@spawn666reaper
@spawn666reaper 7 жыл бұрын
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 7 жыл бұрын
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.
@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
@isaacfainsod1986
@isaacfainsod1986 7 жыл бұрын
Do you know if I can use a computer power supply (12v cable) to give energy to the relays
@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!
@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.
@brianlynch3627
@brianlynch3627 4 жыл бұрын
Have you made an updated video using the pi 4?
@skiwithpete
@skiwithpete 4 жыл бұрын
I have not updated the video. But the code works.
@rogerbailey3416
@rogerbailey3416 7 жыл бұрын
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.
@dvdgmz
@dvdgmz 6 жыл бұрын
Can the raspberry take inputs and translate them into a specific sequence of outputs?
@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.
@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 жыл бұрын
+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 жыл бұрын
+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 жыл бұрын
+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....
@eric_7761
@eric_7761 6 жыл бұрын
I´m curios. Why 12V supply if the realy partnumber says 5vdc? is there a regulator on this board
@darrellnull5090
@darrellnull5090 8 жыл бұрын
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.
@juanbolivar35
@juanbolivar35 5 жыл бұрын
how do you add a lot more channels to the raspberry?
@ninoinreno
@ninoinreno 8 жыл бұрын
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 5 жыл бұрын
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
@ValentinScarevnea
@ValentinScarevnea 5 жыл бұрын
Hi, is it necessary to use both 5V pins?
@henryfitzthum7563
@henryfitzthum7563 7 жыл бұрын
Hi do you know if one Can run RGB lights from this relay
@stevenfrazier7959
@stevenfrazier7959 7 жыл бұрын
Have you done anything with mqtt with any of your relays?
@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 жыл бұрын
+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.
@alextadeo8455
@alextadeo8455 8 жыл бұрын
Could i wire up 2 16-channel relays to the Pi's 40 pins?
@fuzzywuzzy9550
@fuzzywuzzy9550 6 жыл бұрын
would you use a relay and a motor controller
@jeremycaudill6916
@jeremycaudill6916 6 жыл бұрын
Any tutorials on what to do with the relay afterwards ?
@carlosarias9191
@carlosarias9191 8 жыл бұрын
Hi I want to that but with a NFC controller my idea is when I leave to the home 🏡 put the card #1in the NFC and the home loss all the energy. And close the door and.. when arrived to the home open the door with other card #2 and put the card #1 in the NFC and the home have energy again and when put the card #3.. six lights in the home turn on ,,, so you know how to do a remote control for the smartphone
@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
@Thomasz-Tech-Innovations
@Thomasz-Tech-Innovations 8 жыл бұрын
can you make a RCA audio replay switch?
@skiwithpete
@skiwithpete 8 жыл бұрын
I don't know what that is.
@Thomasz-Tech-Innovations
@Thomasz-Tech-Innovations 8 жыл бұрын
you know if you go to radio shack and RCA audio is plugged in to switch audio like red and white in one input. I was wondering can you set a input as 1input relay. then set other sources as other relays inputs to switch audio inputs.
@skiwithpete
@skiwithpete 8 жыл бұрын
Each channel would need it's own relay, but yes.
@Thomasz-Tech-Innovations
@Thomasz-Tech-Innovations 8 жыл бұрын
example but with replays www.google.com/search?q=radio+shack+a/v+audio+switch&sa=X&biw=412&bih=604&noj=1&tbs=vw:l,ss:9&tbm=shop&srpd=16676959007976440285&prds=num:1,of:1,paur:ClkAsKraX5Njv74j76WwEyNbkGmwwlKkOl2NI9ui8l07FSWeBP3CKEB7T2OiDPjWJnOAceENspYak9wm0WSYs3b8oHNxLztivm0Pj10CVLu4R6it6kMfeDDVqxIZAFPVH70T1ZnZiP_eAXyBLCznyrV_0Sz74A&ved=0ahUKEwj7l9TI5N_PAhWDVT4KHUKJAxIQgjYI4gQwCw
@Thomasz-Tech-Innovations
@Thomasz-Tech-Innovations 8 жыл бұрын
How do you make RCA run to each separate replay and select them remotely.
@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.
@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.
@jbird9402
@jbird9402 4 жыл бұрын
Love the vid... I am stuck tho, when I go to the sudo python script16_1.py. It just reads SyntaError: invalid syntax and nothing happens. Super noob here so anything would help... Thank you
@skiwithpete
@skiwithpete 4 жыл бұрын
Weird. Have you installed python via sudo apt install python? Or you might need to do "sudo python3 script16_1.py" as the pi might ship with python3 now
@jbird9402
@jbird9402 4 жыл бұрын
Oh man, that is a somewhat of foreign language. I will try these things. Is python and python 3 different things?Thank you!
@timothyphan3959
@timothyphan3959 7 жыл бұрын
will the Pi have enough 5V power to control two 8-channels relays to make a 16-relays solution?
@xmetrix
@xmetrix 5 жыл бұрын
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
@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
@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???
@SaeedAhmed-ix8nm
@SaeedAhmed-ix8nm 7 жыл бұрын
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 7 жыл бұрын
please look in the About Section for the example code.
@SaeedAhmed-ix8nm
@SaeedAhmed-ix8nm 7 жыл бұрын
Thanks for the Answer. But where to find? can you send me link. Please
@skiwithpete
@skiwithpete 7 жыл бұрын
The video description. The code is on this page.
@SaeedAhmed-ix8nm
@SaeedAhmed-ix8nm 7 жыл бұрын
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.
@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.
@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 :-)
@esteed71
@esteed71 9 жыл бұрын
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 жыл бұрын
Thanks man.............You Saved me..............!...........Such a Big Help .......(y)
@sponsjeee
@sponsjeee 7 жыл бұрын
rasp 2b worked for me 2 ! thanks
@TheDmussaw
@TheDmussaw 6 жыл бұрын
do you have a script to turn each relay on off from command line
@skiwithpete
@skiwithpete 6 жыл бұрын
TheDmussaw no. You'll need to make that yourself.
@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.
@goeswest
@goeswest 4 жыл бұрын
When I run the "script16_2.py" it turns all the relay on. May you know why ?
@goeswest
@goeswest 4 жыл бұрын
i mean it turns on all relay at the same time
@skiwithpete
@skiwithpete 4 жыл бұрын
@@goeswest try changing the hi and low order.
@darshitthakkar1439
@darshitthakkar1439 4 жыл бұрын
hi i tried same in my raspberry pi 4 (prog used script16_1)my relay card is not operating can any one help???
@IstiaqueAhamed
@IstiaqueAhamed 7 жыл бұрын
Can I use 12V, 5A power supply ?
@abecoulter18
@abecoulter18 7 жыл бұрын
how do i connect multiple boards together to have 200 relays and have power at each board from a SLA battery and trigger each relay manually from a central location
@skiwithpete
@skiwithpete 7 жыл бұрын
Abe Coulter dunno. But could you let me know when you figure it out
@abecoulter18
@abecoulter18 7 жыл бұрын
skiwithpete track me down on facebook. And I'll keep you posted
@abecoulter18
@abecoulter18 7 жыл бұрын
skiwithpete I have an idea...N channel MOSFETs.... IRFZ44. just need to figure out how to control 200 of them.... Planning on building a fireworks firing system for pyromusical display
@daveofyorkshire301
@daveofyorkshire301 3 жыл бұрын
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...
@ryanhebron4287
@ryanhebron4287 9 жыл бұрын
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.
@sukhee5
@sukhee5 7 жыл бұрын
Hi. Sorry i wanna ask something. What is the programing language using the script?. java or python?.
@skiwithpete
@skiwithpete 7 жыл бұрын
Ch Sukhee Python
@sukhee5
@sukhee5 7 жыл бұрын
thank you. im just starting the learn smart home system. but i dont know which side's to start learn.
@henryfitzthum7563
@henryfitzthum7563 7 жыл бұрын
Hi can one use this relay to control RGB lights
@Swansong16
@Swansong16 3 жыл бұрын
can anybody help me out with a problem I run into when attempting to get this up and running? I manage to successfully make it all the way to where he copies and pastes the script into the pi. However every time I try to run the script, instead of it toggling the relays on and off, they all just turn on simultaneously and stay on until the script ends, or until I "Ctrl C" it. This happens with all the scripts that he provides and even with other programs like Lightshowpi. Does anybody have any suggestions as to what I might be able to do? Any help would be greatly appreciated!!
@skiwithpete
@skiwithpete 3 жыл бұрын
1) Are you sure you have an optocoupler relay? Does it have the same exact appearance to the one in this video? 2) Are you getting enough power to the device? Does it have it's own direct power supply?
@Swansong16
@Swansong16 3 жыл бұрын
@@skiwithpete so I ended up solving the issue. It turns out that plugging the 5v pin from the relay to the 5v pin on the pi was causing the problem. after swapping it to a 3.3v pin on the pi, the relays were working properly. however after completing that hurdle, I ran into another issue. Now whenever I try to run the "sudo python py/synchronized_lights.py --file=/home/pi/lightshowpi/music/sample/ovenrake_deck-the-halls.mp3" code or any other .mp3 file, I have no audio playback whatsoever through the 3.5mm jack. I have attempted to try different audio devices plugged into the jack, unplugged the hdmi, went to my defaults.cfg file and made sure the "fm =" was set to "False". Nothing has improved my situation. Do you have any more tips or suggestions that I might be able to try?? Also I really appreciate you replying back to me to help out!! Update: I had a theory after I typed the above comment that for some reason its pumping the audio out to my hdmi, and sure enough it was. now the only thing I need to do is figure out how to swap the audio over to the 3.5mm jack. I just don't know how to do that lol
@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 7 ай бұрын
Is it a real cave or just a basement?
@AlbertEspinRodriguez
@AlbertEspinRodriguez 8 жыл бұрын
Is it possible to have the same result using raspberry pi 2?
@skiwithpete
@skiwithpete 8 жыл бұрын
+Albert Espín (EA3HSP) yep. same thing.
@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.
@patle8229
@patle8229 4 жыл бұрын
no it not work with raspberry pi 2b+ does it need a 5V pin output ?
@skiwithpete
@skiwithpete 4 жыл бұрын
Raspberry pi 2b+ has a 5v pin.
@johnmariano47
@johnmariano47 8 жыл бұрын
Hello, how much ballpark estimate is this project if starting from nothing for a novice with raspberry pie?
@skiwithpete
@skiwithpete 8 жыл бұрын
If you already have the Pi, you can get a 16 channel relay for $15. The 12V power supply, maybe another $15. The wires are like $10. Then you should get a 12V light so another $10-$20. All told maybe $50-$60?
@johnmariano47
@johnmariano47 8 жыл бұрын
Thanks. I still dont have the pi. What is the latest model applicable to this? I may start from zero knowledge to learning how the pi works and building this project and later expanding to other attachments etc.
@skiwithpete
@skiwithpete 8 жыл бұрын
+Jay Em all pis will work. get the latest
@johnmariano47
@johnmariano47 8 жыл бұрын
Nice. I knew you'd say that. Thanks a many!!!
How many relays can I connect to one Arduino?
9:39
AnotherMaker
Рет қаралды 54 М.
JISOO - ‘꽃(FLOWER)’ M/V
3:05
BLACKPINK
Рет қаралды 137 МЛН
Uitleg PC7MM codeplug voor de Anytone 578 & 878
1:14:48
rundfunkriesjard
Рет қаралды 16
Raspberry Pi Automation #1: Mains Relay HAT
15:03
ExplainingComputers
Рет қаралды 275 М.
RASPBERRY PI - All  About controlling Relay Boards for Home Automation
15:05
DIY Raspberry Pi Racecar Dashboard: The Ultimate Guide
15:11
BEAVIS Motorsport
Рет қаралды 805 М.
Raspberry Pi: Control 100 Relays Python example
12:40
TCTEC
Рет қаралды 46 М.
How To Use A Relay With Raspberry Pi Pico
11:59
Core Electronics
Рет қаралды 30 М.
Beginner's Guide to ESPHome ESP8266, ESP32, Beken Devices and more
33:46