Hi, It is very bad practice to switch the neutral, because when the light is turned off there is still 120 - 240V at the fitting, which can electrocute an unsuspecting person. ALWAYS switch the live wire. An for safety unplug the unit before making adjustments
I know, I cut the wrong wire and just use the neutral but being save made sure there is no power before touching any wires I will probably make a follow up on this rather to make a custom PCB with more protection to control a few different things.
@@NerdCaveYT except when it came time to actually do it i couldn't get more than 3.3v out of the pico gpio and my relay requires 5v... did i just use the wrong gpio or relay... now im confused again...
@@tonymowder I think I got confused, in the video I did use a 3.3V relay, if you are using a 5V relay and you want to turn it on with the VSYS 5V you will have to use a transistor that can act as a switch from the digital pin to turn the relay on and off
Since it is only one relay it doesn't take so much current to magnetize the coil for lot of relay's better to supply from external 5V and switch with pico the state
if the sensor requires a voltage level of 5V and you give less it might not work correctly, for the Relay module I used 5V from the Pico but for the signal trigger pin, to switch it on I used the GPIO pin that is 3.3V which works
I needed to connect the shield to 3.5 volts instead of 5 volts. I had problems with the relay activating when the digital lead was connected to GRD or 3.5 volts. Was OK when I powered it with the 3v3 pin.
thank you for sharing your knowledge I have a query will the pico be able to control the 5v relay as it has only 3.3 volt signal we tried using 5 v SSR and was unable to control the load
So your load will not be able to be powered by the Pico due to current limitations on the Pico, but to control the relay and if I understand it used 5V signal to trigger then I would suggest using a transistor. The you can use the Vsys which is 5V with a gpio pin to trigger the relay.
@@NerdCaveYT I actually got it! For future reference for anybody else: (Pico W -> Relay) 3v3 -> VCC GND -> GND VSYS -> RY-VCC (This is also JDVCC on some models) GPIO Pin (Doesn't Matter which one is used) -> IN1. The reason it didn't turn off was the VSYS was connected incorrectly.
I had the same problem, the thing is that some relays (like FL-3FF-S-Z) can't be powered on 5v and triggered with 3.3v so what you can do is power the relay module with 3.3v and then you can control it also with 3.3v. (VSYS->VCC, GND->GND, GPIO PIN->IN)
Thanks all - my PicoW works great with connections PicoW to relay: - 3V3(OUT) (pin36) to VCC - GND (eg pin 23) to GND - GP18 (as example, pin24) to IN This ensures the relay VCC and IN high voltages must be the same, as codyrap says.
I will have to check my code hopefully in few days waiting for truck today to bring all my stuff from another city, but in general you want an if which will be your first condition being tested if that is false it goes to elif in some cases you can just use if but bad coding practice if you Google why use elif in python you will see the reason why, I guess that is why I used elif since if first statement is not true try second
yes the 5V will be used to close the coil so it does not draw a lot of current, if you are making it to be power from a battery you can power the pico and the relay are connected in parallel so it won't draw current from the relay
sh*t hope you didn't get a scar or anything that is why I said in beginning do not attend to make this because working with live energy I am also always paranoid and made sure everything was unplugged when connecting wire or working with relay
I soldered the inside of a vaccum cleaner connected to live mains 5 years ago and it made a giant blue spark, smoke, bang. To do this day if genuinely feel sad I may have created an alternate reality where I died on my bedroom floor and my mother found me. I really hope that's not the case but I literally soldered a fucking vacuum cleaner thats like as high voltage as you get in a home. I'm traumatized to this day, zero injuries though all mental
Hi, I do not mention parts because they are bought on Taobao which is what people use in China, but you will be to find similar relays on AliExpress. The main reason not to put link is I can't verify the supplier. I used a 3.3 V relay but 5V should be able to trigger aswell.
Hi, these relay module will be able to switch 220V AC, the maximum rating is 10A 250VAC, some modules will show the maximum DC voltage as well. The LED lamp base I switch on and off with the relay was connected to 220V AC supply voltage and 50Hz (China operating voltage). You just need to make sure about the relay operating voltage since some relay has different operating voltages. This one is 5V DC so it is fine to use with microcontroller.
VBUS is the 5V input from the micro-USB port, which is fed through a Schottky diode to generate VSYS, so for simple applications not using much current the VSYS will be fine to use, because not exceeding the 300mA limit, if however you plan to use multiple relays then having an external power supply and using relays with photocouplers will be recommended to protect and isolate the Pico. I hope it makes sense? If not I can answer other questions you have.
@@NerdCaveYT Why not power the 5V relay from VBUS pin 40? It's 5V - seems simpler to me than 'worrying' about using pin 39 that can be an input. To be clear, I am not saying it's a bad idea, but seems to invite the problem in your last reply.
@@johnouellette1098 The VBUS pin is connected to the VBUS of the micro USB connector. There is an onboard diode connecting VBUS to VSYS, which means that VBUS can be used to power VSYS, but not the other way around. This would internally power VSYS via the onboard diode, but we must be sure that we do not connect another power supply to the USB connector on Raspberry Pi Pico or Raspberry Pi Pico W.
hello, I can't speak English. I'm using google translate. I'd like to ask. I get the message "RPi.GPIO as GPIO no module" what is the solution? I have installed but it didn't work. Please help me 🙏🙏🙏
are you using the raspberry pi computer or the raspberry pi pico, the raspberry pi computer use the RPi.GPIO library, where in this video I used "from machine import pin" which is from micropython firmware
dear god you explain more that was expecting, thank you so much to make this tutorial! i hope you do more, you have a really good speeching
Thank you for the comment, Glad it was helpful! I try my best to upload weekly and more if I have time
Very useful info, thx! Was just thinking I should research relays for my projects.
Glad it helped
Hi, It is very bad practice to switch the neutral, because when the light is turned off there is still 120 - 240V at the fitting, which can electrocute an unsuspecting person. ALWAYS switch the live wire. An for safety unplug the unit before making adjustments
I know, I cut the wrong wire and just use the neutral but being save made sure there is no power before touching any wires I will probably make a follow up on this rather to make a custom PCB with more protection to control a few different things.
Thank you for taking the time to make this video, this is the perfect tutorial for my pico pump project with ir water level sensor thanks man
Glad it was helpful!
@@NerdCaveYT except when it came time to actually do it i couldn't get more than 3.3v out of the pico gpio and my relay requires 5v... did i just use the wrong gpio or relay... now im confused again...
@@tonymowder I think I got confused, in the video I did use a 3.3V relay, if you are using a 5V relay and you want to turn it on with the VSYS 5V you will have to use a transistor that can act as a switch from the digital pin to turn the relay on and off
Awesome, thank you. There were some that said the pico couldn't control a 5v, but it does work. Thank you.
Since it is only one relay it doesn't take so much current to magnetize the coil for lot of relay's better to supply from external 5V and switch with pico the state
great class
thank you
Great instruction
Thank you for the feedback
Well done! Awesome tutorial :)
Thanks a lot!
Can i use it for small sensor with 5v with battery 3.7v ?
if the sensor requires a voltage level of 5V and you give less it might not work correctly, for the Relay module I used 5V from the Pico but for the signal trigger pin, to switch it on I used the GPIO pin that is 3.3V which works
Pico has a 5v output?
Wekk the Vbus here is the 5V it gets from the computer the pico GPIO pins are 3.3V out
I needed to connect the shield to 3.5 volts instead of 5 volts. I had problems with the relay activating when the digital lead was connected to GRD or 3.5 volts. Was OK when I powered it with the 3v3 pin.
I saw a few people struggling with that, I think for the 5V active trigger can use a transistor and VBUS to use a GP pin to open or close relay
thank you for sharing your knowledge I have a query will the pico be able to control the 5v relay as it has only 3.3 volt signal we tried using 5 v SSR and was unable to control the load
So your load will not be able to be powered by the Pico due to current limitations on the Pico, but to control the relay and if I understand it used 5V signal to trigger then I would suggest using a transistor. The you can use the Vsys which is 5V with a gpio pin to trigger the relay.
Great video! I'm trying to set something similar, but my Pico isn't turning the relay off. Do you have any troubleshooting ideas/advice?
How do you have the relay connected to the Pico in which mode or setup?
@@NerdCaveYT I actually got it! For future reference for anybody else:
(Pico W -> Relay)
3v3 -> VCC
GND -> GND
VSYS -> RY-VCC (This is also JDVCC on some models)
GPIO Pin (Doesn't Matter which one is used) -> IN1.
The reason it didn't turn off was the VSYS was connected incorrectly.
I had the same problem, the thing is that some relays (like FL-3FF-S-Z) can't be powered on 5v and triggered with 3.3v so what you can do is power the relay module with 3.3v and then you can control it also with 3.3v. (VSYS->VCC, GND->GND, GPIO PIN->IN)
Thanks all - my PicoW works great with connections PicoW to relay:
- 3V3(OUT) (pin36) to VCC
- GND (eg pin 23) to GND
- GP18 (as example, pin24) to IN
This ensures the relay VCC and IN high voltages must be the same, as codyrap says.
@@fieldjx connecting vcc to 3v3 pin worked for me, thanks.
Cool !!
going to try and make my next apartment I am moving to, to be a "smart" home, having sensors and relays everywhere.
Thanks for the lesson today, brother 😎 one question: why “elif” instead of another “if” for turning off the LED?
I will have to check my code hopefully in few days waiting for truck today to bring all my stuff from another city, but in general you want an if which will be your first condition being tested if that is false it goes to elif in some cases you can just use if but bad coding practice if you Google why use elif in python you will see the reason why, I guess that is why I used elif since if first statement is not true try second
Hi, would it be possible to control exactly 2 5v relay using the vsys pin? Thank you for making the video btw, very informative!
yes the 5V will be used to close the coil so it does not draw a lot of current, if you are making it to be power from a battery you can power the pico and the relay are connected in parallel so it won't draw current from the relay
I connected it all and everything worked fine, until I touched the soldering underneath the relais by accident and got electrocuted...
sh*t hope you didn't get a scar or anything that is why I said in beginning do not attend to make this because working with live energy I am also always paranoid and made sure everything was unplugged when connecting wire or working with relay
I soldered the inside of a vaccum cleaner connected to live mains 5 years ago and it made a giant blue spark, smoke, bang. To do this day if genuinely feel sad I may have created an alternate reality where I died on my bedroom floor and my mother found me. I really hope that's not the case but I literally soldered a fucking vacuum cleaner thats like as high voltage as you get in a home. I'm traumatized to this day, zero injuries though all mental
Plz mention link of the relay or details of the relay
Hi, I do not mention parts because they are bought on Taobao which is what people use in China, but you will be to find similar relays on AliExpress. The main reason not to put link is I can't verify the supplier. I used a 3.3 V relay but 5V should be able to trigger aswell.
Dear,How about 220v relay ?
Can you explain me ?
Hi, these relay module will be able to switch 220V AC, the maximum rating is 10A 250VAC, some modules will show the maximum DC voltage as well. The LED lamp base I switch on and off with the relay was connected to 220V AC supply voltage and 50Hz (China operating voltage).
You just need to make sure about the relay operating voltage since some relay has different operating voltages. This one is 5V DC so it is fine to use with microcontroller.
Tell me you're South African without telling me you're South African :)
Kan jy braaibroodjies maak 😂
I thought you weren't supposed to use the vsys like that?
VBUS is the 5V input from the micro-USB port, which is fed through a Schottky diode to generate VSYS, so for simple applications not using much current the VSYS will be fine to use, because not exceeding the 300mA limit, if however you plan to use multiple relays then having an external power supply and using relays with photocouplers will be recommended to protect and isolate the Pico. I hope it makes sense? If not I can answer other questions you have.
Awesome explanation. Going to go try it! Thanks! Great channel and I'll subscribe to see more:) have fun and keep learning!
@@theadventurousprogrammer6449 Thank you
@@NerdCaveYT Why not power the 5V relay from VBUS pin 40? It's 5V - seems simpler to me than 'worrying' about using pin 39 that can be an input. To be clear, I am not saying it's a bad idea, but seems to invite the problem in your last reply.
@@johnouellette1098 The VBUS pin is connected to the VBUS of the micro USB connector. There is an onboard diode connecting VBUS to
VSYS, which means that VBUS can be used to power VSYS, but not the other way around. This would internally power VSYS via the onboard diode, but we must be sure that we do not connect another power supply to the USB connector on Raspberry Pi Pico or Raspberry Pi Pico W.
hello, I can't speak English. I'm using google translate. I'd like to ask. I get the message "RPi.GPIO as GPIO no module" what is the solution? I have installed but it didn't work. Please help me 🙏🙏🙏
are you using the raspberry pi computer or the raspberry pi pico, the raspberry pi computer use the RPi.GPIO library, where in this video I used "from machine import pin" which is from micropython firmware
@@NerdCaveYT i am using raspberry pi on laptop
Raspberry pi 3 model b 🙏
Dude, you're going to get someone seriously hurt with your botched AC wiring of the common through the relay. Fix it!
Yes, it was pointed out, Thank you I will remove the video and make a new video just to ensure no one gets hurt
1000
1000