TheLittleDoc
Posts: 1
Joined: Thu May 30, 2019 11:17 pm

Help with Relays and GPIO

Thu May 30, 2019 11:30 pm

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

dl324
Posts: 122
Joined: Mon May 06, 2019 7:33 pm
Location: Pacific Northwest, USA

Re: Help with Relays and GPIO

Fri May 31, 2019 12:46 am

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 413 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.

Icosagon
Posts: 26
Joined: Sat Apr 13, 2019 12:32 pm

Re: Help with Relays and GPIO

Fri May 31, 2019 1:19 pm

Hiya too,

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

Hope this helps, Icosagon

ankith26
Posts: 103
Joined: Mon Mar 25, 2019 11:08 am
Location: Earth
Contact: Website

Re: Help with Relays and GPIO

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
My website is at https://pratt.ml
Hope it runs (which it wont)

pcmanbob
Posts: 7127
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Help with Relays and GPIO

Sat Jun 01, 2019 11:17 am

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.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Automation, sensing and robotics”