I’m trying to follow this guide How To Use A Relay With Raspberry Pi Pico - YouTube from the core electronics team, as a preparation for my bigger project. As a side-note, that project will involve using the Pico to make a relay switch a pump on and off for watering my plants after a given interval of time passes. The pump is this model: pump, the battery will be a 9V Toshiba and all the rest is as depicted in the pictures (relay: relay)
That all aside, I’m trying to follow your guide but my LED simply won’t start. The GND from the pico is all that I’m trying to do differently and the relay does power on (red light is on) and does receive some signal (red dims a bit and green light does turn on and off). The resistor and the LED have worked before well. What could I be missing?
Welcome to the forum
I’ve got a few quick things you can check separately which will help you isolate which part of your circuit has the problem:
The first thing I’d want to check with your circuit is are you able to hear the relay switch? You should hear a small click if you’ve got your power and ground rails connected to the relay then move the signal from either connecting to ground or your signal level. Hook up just the input side of the relay and switch the input signal from power and ground and back a couple of times to make sure you can hear the click, then you’ll know your relay works without having to have the Pico working. FYI, the relay we’ve used in our guide is triggered on an active low signal, which means it actuates when the signal pin is pulled to ground level.
The next part is to check that your LED works if you manually connect and disconnect the wires you’ve got connected to your relay output. If you don’t get the LED changing when you manually complete or break the circuit then you can narrow into troubleshooting that section of your circuit. (Is the LED in backwards etc).
Check your Pico has power and is responding to your code, having the onboard LED toggle when the relay is meant to change state will let you see much better what is and isn’t working.
Check the signal coming out of your Pico that is meant to trigger the relay, having the signal wire go to the relay input and an LED on your breadboard will allow you to see what is happening at the relays input.
Sorry to hear you’re having issues getting the relay going when following the video!
If you’re not hearing the ‘click’ of the Relay then my first suspicion is that 3.3V is not enough voltage to activate it. Checking input voltage is mentioned in the written guide for the video, but it should have been mentioned in the video as well, apologies for that!
The product page you linked only mentions 5V operation, but before you try to drive the Relay with 5V with the Pico, you need to check if the IN terminal is pulled UP or DOWN.
If the IN terminal is pulled UP then it will be resting at 5V, which is not safe to be connected to the GPIO pins of the Pico.
If you have a multimeter handy, try the following to confirm the relay can be operated using 5V VCC and 3.3V logic from the Pico:
- Unplug the Pico from USB to power it down
- Disconnect the IN terminal of the Relay so that the Pico GPIO is no longer connected to IN.
- Move the VCC wire from Pico 3.3V to the 5V VBUS pin, and power up the Pico.
- Set your multimeter to the 20V DC setting
- Hold the negative/black probe of the multimeter to the GND terminal of the relay
- Hold the positive/red probe of the multimeter to the IN terminal of the relay
If the multimeter reads around 5V (it may be as low as 4V), then it is pulled UP, and unfortunately, the Relay should not be used with the 3.3V Pico at 5V.
If the multimeter reads ~0V, then it is pulled DOWN and you’re good to power the Relay with 5V and attempt to drive with 3.3V logic. Unplug the Pico USB, re-attach the IN terminal to the Pico GPIO, plug the USB back in, run your script again and let us know if you hear the relay clicking!
Thanks a lot for the support guys! Sorry to leave you hanging but I had to prioritize some other projects and only recently managed to get some time to work on my electronics.
I will try your suggestions and get back to you on how things are this week.
Quick notes though:
The LED definitely works, tested it in a simpler circuit with just a resistor appropriate for it and it lights up with no problem.
The PICO LED being integrated into the software part is something I already did in my debugging efforts and it’s working as intended (on when the relay should be on, off when it shouldn’t)
@Trent5487676 for your fourth suggestion you mean I should analyze the same signal with a second wire coming from the same signal output? (mediated through a breadboard I assume) Should I be concerned that the signal will be less powerful if it gets divided at some point, too?
@Jacob It hasn’t even crossed my mind the relay could be pulling the signal UP or DOWN but I will definitely proceed with care when testing
Have a fun weekend in the meantime!