Getting Started With Relays | Examples with Raspberry Pi Pico

Hi everyone, I’ve just posted a new guide that’s all about Relays! → “Getting Started With Relays | Examples with Raspberry Pi Pico”




Read more

2 Likes

The relay module shown is NOT suitable for a 3.3V device.
In addition the data for the module continues to state " A versatile relay board with opto-isolated input" - it has a PNP transistor with Emitter connected to 5V.
I bought one 2 years ago and had correspondence with Graham Mitchell from Core Electronics who replied “PS - genuinely surprised that a 20-year Engineering vet saw a SOT23 package on the board and was confused why it wasn’t opto-isolated! I’ve added a sentence to the product page, just in case someone else finds themselves with the same uncertainty.

The product page still has the misleading claim.

Hi Ian,

Good catch - looks like the short description at the top (which is a separate field) wasn’t updated with the long one.

image

I’ve fixed that now. I can see how the larger relay modules from the same supplier being opto-isolated and the smaller one not could have caused this issue.

Thanks again for chasing this one up!

1 Like

Thanks for the whole description thread and update. Users are always confused about which relay to chose and which not for Raspberry Pi Pico.

I don’t undertand. There is still a 5V relay getting power from the Pico’s 3.3 V pin. How can that be?

Also How can the pico send a 5V signal from the GPIO? It’s a 3.3 V pin. I followed the tutorial and measured. The pico sends 3.3V on the GPIO.

Can you clarify? This was the best video on youtube, but it seems to be glossing over the 3.3 V bits.

Thanks

1 Like

Hi James,

Welcome to the forum!!

Through the power of tolerances and some diving through datasheets, note that we found that this works for most of the relays - they are a cheap and cheerful part.

From the relay datasheet.

To get the relay to fire correctly we are after a few key specs and have to make a couple of assumptions (applicable for Makers, this isn’t engineering advice!)
The rated pull-in voltage of the relay is 5V, though the magnetic strength of the field depends on the coil, with a 10% tolerance on the impedance.
The minimum switching voltage is 75% of the rated (3.75V)
If the impedance spec lines up then a voltage of 3.3V will toggle the relay, this is great for makers looking to get something cheap to experiment with or make some hobby projects.

If you need something reliable Core stocks a range of other relays and MOSFET breakouts that are verified to run at 3.3V

If theres something you’d like clarified we’re more than happy to answer!
Liam

1 Like

hi Liam,

Thank you very much for the reply and apologies for the delay. I understand what you’re saying with respect to tolerances now. That makes sense.

What wasn’t making sense for me is that I set up a system precisely the way the video had it but my experience was significantly different. I never got it to work be with a 5 volt relay being connected up with the five power pin number 39 or pin 40 with the Pico at all. In fact that produced The Magic Smoke. I realize that my relay might be significantly different from yours even though it literally looks exactly like the one in the video and has literally the same markings as you have on this post.

I was able to get the Pico running with a relay using the 3.3 volt power however no matter what I did Thonny always disconnected the serial port

After having doing some research on stack exchange and so forth I did stumble on to the Raspberry Pi FAQ which goes into some depth on relays. So it appears that you have done a really good job in working with tolerances and the specific type of hardware that will lend itself to the proper working and that’s really great!

As I said this was one of the best videos I’ve seen on the internet explaining relays so thank you for that. For what it’s worth I ultimately got my thermostat working with a transistor and I’m going to come back to a relay but try it with a 3.3 volt relay and setting my expectations in line with the Pi FAQ:

https://forums.raspberrypi.com//viewtopic.php?f=91&t=83372&p=1225448#p1225448

Thanks again!

2 Likes

Hi James,

Can you send through a photo of how you have everything connected? The serial port disconnecting sounds like something is short circuiting (and might damage your computer).

Update: I got a 3V relay and all is well.

Here’s how I wire(d) it though (pic of the 3V but the 5V was exactly the same):

  • VCC to Pi Pico 3.3V/pin 36

  • GND to GND

  • input pin to GPIO 15

  • COM to negative side of power supply

  • Red fan wire to to positive side of power supply

  • Black fan wire to NO

In the end I don’t fully understand all the terms in the forums FAQ, but I take away that one’s mileage will vary with pico and relays.

1 Like