Trigger 5V relay with 3.3V digital outs?

I’ve got a relay that’s triggered by 5V. This has worked fine with an Arduino Uno (since it has 5V outs) but how to pull this off on a 3.3V Photon is stumping me.

So, is there some way to trigger 5V output on a Photo to a relay switch?

you could use a simple transistor as a switch or try a logic level converter

1 Like

you could use a 74HC245 it a logic level converter it comes in dip and smd.

Hi, I was facing the same issue, and I ended up buying 3v3 relays to simplify my life like these ones.
They come in a pcb designed for Wemos but work just fine with Particles since Wemos run at 3v3 too.
Cheers,
Gustavo.

@Shpigford, I strongly recommend either a transistor driver or, as @gusgonnet pointed out, a pre-assembled unit. This one provide a photo-coupler interface providing better isolation between the relays and the photon. Let us know how it goes! :wink:

Hi PK, question to you, since I like your choice.
I read in the description of the relay a "low level triggered".
Does this mean the logic of the relay is inverted somehow? meaning, a low input will engage the relay?
If this is correct, I would prefer to buy "high level triggered" ones...

@gusgonnet, you can find modules that have a programmable trigger level like this one. Since the level can be handled in the software logic, the actual trigger level is not critical. Is there a reason you want high-level triggered relays?

I think I got in trouble before with low level triggered relays when the system starts up.
The reason was something like this:

  • you want to open your garage with a particle and this low level triggered relay
  • you wire the garage opener to the Normally Open contacts of your relay
  • you power up your board and the relay sees a low in it’s input (while the firmware in your particle is loading) then closes the NO contact and your garage suddenly opens.
  • your firmware starts running and turns the Particle’s digital output to high and then the relay is released

I know I can wire the garage opener to the NC contact of the relay and compensate this inverted behaviour in the firmware, but then the relay is always engaged and consuming some power.
Am I thinking this wrong?
thanks
Gustavo.

@gusgonnet, you can set the I/O preemptively with a STARTUP() command. However, get the configurable relay board and that way you can configure it either way. Testing will provide the real-world feedback :wink:

1 Like