Page 1 of 1

Help with Relays and GPIO

Posted: Thu May 30, 2019 11:30 pm
by TheLittleDoc
Hiya there,

This is my first post, but I'm a little desperate for help as I'm working toward a deadline, but I've been working on a device that, using Google's voice stuff, toggles a relay that controls mains power to the light fixture in the room. Basically, everything but the relay is worked out. See, I, of course, realize that 3v3 does not toggle a 5v relay, so I feel like I have a few options, but I wanted to run it by someone before I go ahead. Firstly, and this seems really silly but would function, is a low voltage relay that will, when toggled by the 3v, deliver 5 volts to my mains relay.

[Facepalm]

Or a more simple solution, but one that my little knowledge of ICs and transistors can't seem to figure out, is to use some widely available IC/transistor to supply the 5v to the relay when toggled. Any ideas?

Please let me know!

Thanks,
TheLittleDoc

Re: Help with Relays and GPIO

Posted: Fri May 31, 2019 12:46 am
by dl324
I'd have the GPIO drive an NPN transistor that switches the relay low side. Any common transistor in your locale would be sufficient (2N3904, BC547, etc).

EDIT: Here's a schematic.
relayNPN.jpg
relayNPN.jpg (16.98 KiB) Viewed 446 times
R1 should be sized to provide Ib=0.1Ic (0.05Ic if you use a high beta transistor like BC547). D1 should be able to tolerate full coil current.

Re: Help with Relays and GPIO

Posted: Fri May 31, 2019 1:19 pm
by Icosagon
Hiya too,

Use Arduino via Serial Communication, its easier and safe. You didn't specify the programming language you used :| .

Hope this helps, Icosagon

Re: Help with Relays and GPIO

Posted: Sat Jun 01, 2019 10:55 am
by ankith26
You could go for a 3.3v to 5V bi directional level shifter .. these things are available online at low cost and will work

Re: Help with Relays and GPIO

Posted: Sat Jun 01, 2019 11:17 am
by pcmanbob
ankith26 wrote:
Sat Jun 01, 2019 10:55 am
You could go for a 3.3v to 5V bi directional level shifter .. these things are available online at low cost and will work
The problem with using a level shifter in this situation is that the OP is driving the coil of the relay directly, its very possible that a level shifter will not be able to supply sufficient current to drive the relay coil, level shifters are meant for signalling level shifting not driving current loads.