0
\$\begingroup\$

sorry if this a very beginner question but I'm still quite new to the field of electronics generally.

I have a requirement to connect a Raspberry Pi to an existing electronic lock, and hopefully use a signal from one of the GPIO pins to cause the lock to unlock. I've been advised that the electronic lock is a 1A circuit, at (I think) 12V, and that any time the circuit is closed, the lock is triggered. Meanwhile, the RPi operates at 3.3V, with a 2-20mA output per pin and a 50mA limit.

Given this, what solutions do I have for allowing a logic signal from the RPi to control the much higher-power lock circuit? Initial research seems to suggest simply a transistor or relay of some sort would suffice, but my attempts to understand how I'd wire these together have been spectacularly unsuccessful. All my programming for the RPi is fine, I can drive the pin (or several pins if needed) high or low at the appropriate time - I just can't figure out how to let it control a 1A circuit. Do I need a full circuit of some sort that connects to both, or is there a way to just use a single component here?

\$\endgroup\$
1
  • \$\begingroup\$ This is, in fact, what transistors are made for. \$\endgroup\$
    – Hearth
    Commented Jan 15, 2019 at 2:28

2 Answers 2

1
\$\begingroup\$

This would be one simple solution. Note that the relay contacts should be rated for 2 or 3 times the load current so the contacts will last a long time.

If you use a logic-level MOSFET to drive the load directly be sure the MOSFET is rated for several times the load current and has a heatsink if it gets hot to the touch. Also a snubber or 'flywheel' diode is mandatory.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
2
  • \$\begingroup\$ I'm not sure what the role of the Darlington transistor is in this circuit? Still pretty vague on what they actually do, confused by the many various types. My initial thoughts would have been that the relay could've been used just by itself in this case. \$\endgroup\$
    – Xono
    Commented Jan 15, 2019 at 23:21
  • \$\begingroup\$ The Darlington is used as a switch with a gain of 1,000. The GPIO pin can only source about 15mA, but the relay coil will need at least 30mA to turn it ON. The solenoid you mentioned draws 1 amp of current when ON, far beyond the ratings of any GPIO pin. In this design Vin only draws about 1mA from the pin. \$\endgroup\$
    – user105652
    Commented Jan 16, 2019 at 0:08
0
\$\begingroup\$

At 1 A level, I think relay will be overkill. I think FET will be good for this application and will be cheaper solution. Replace lamp with your lock in this circuit.

schematic diagram showing MOSFET as a switch

(Image source: "An example of using the MOSFET as a switch" at Electronics Tutorials)

\$\endgroup\$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.