What it is used for
- Activate a 12 V electric lock from a safe 5 V wall push button.
- Isolate the control circuit (low voltage) from the power circuit (12 V and higher current).
- Simulate a DIY door phone to open a door or gate remotely.
- Measure and verify the behavior of a relay (coil current, timing, click) before connecting it to a microcontroller.
- Replace a mechanical switch that was switching 12 V/high current with a control circuit using low button current.
Expected result
- When pressing the button, the relay coil is energized with about 70–80 mA (current measured in series with a multimeter).
- The voltage across the relay coil remains close to 5 V during activation.
- The lock receives a voltage close to 12 V only while the relay is activated and ≈0 V when it is deactivated.
- You can clearly hear the relay “click” when activating and deactivating the circuit.
- Success criterion: the lock only activates while the push button is pressed; when released, the relay drops out and the lock is de‑energized.
Target audience: Electronics hobbyists, makers, and engineering students who want to practice load control with relays; Level: beginner–intermediate (basic handling of power supplies, relays, and multimeters).
Architecture/flow: 5 V supply powers the push button → when pressed it energizes the relay coil (≈70–80 mA) → relay contacts switch the 12 V line to the lock → the lock is activated only while the relay remains energized, providing galvanic isolation between the 5 V control circuit and the 12 V power circuit.
Materials
- 1 × 5 V relay with changeover contacts (for example SRD-05VDC-SL-C or similar, 5 V coil, minimum 2 A contact at 12 V).
- 1 × 5 V DC power supply (can be a stable USB charger ≥ 500 mA).
- 1 × 12 V DC power supply (12 V/1 A adapter or similar) for the lock.
- 1 × 12 V DC electric lock (small electric latch for testing or equivalent).
- 1 × Normally open (NO) push button, doorbell-type.
- 1 × Flyback/freewheel diode (for example 1N4007 or similar).
- 1 × 1 kΩ resistor (for indicator LED).
- 1 × LED (any color, typical 5 mm) to indicate activation.
- 1 × Breadboard or prototyping board.
- Several jumper wires (male–male or according to the breadboard).
- 1 × Digital multimeter (to measure voltages and currents).
Wiring guide
- Control power supply (5 V):
- Connect the positive terminal of the 5 V supply to the +5V node on the breadboard.
- Connect the negative terminal (return) of the 5 V supply to the GND node on the breadboard.
- Power supply (12 V) for the lock:
- Connect the positive terminal of the 12 V supply to the +12V node.
- Also connect the negative terminal of the 12 V supply to the common GND node (ground shared with the 5 V supply).
- Relay coil:
- Identify the relay coil pins (marked as COIL+, COIL− or equivalent).
- Connect one coil pin of the relay to the COIL+ node.
- Connect the other coil pin of the relay to the COIL- node.
- Activation push button:
- Connect one terminal of the push button to the +5V node.
- Connect the other terminal of the push button to the COIL+ node (this node is the 5 V input to the coil when the button is pressed).
- Coil return to ground:
- Connect the COIL- node to the GND node.
- Flyback diode (coil protection):
- Connect the cathode of diode [D1] (marked with the band) to the COIL+ node.
- Connect the anode of diode [D1] to the COIL- node.
- Be sure to respect the polarity: cathode on the side going to +5 V, anode on the side going to GND.
- Activation indicator LED (in parallel with the coil, but with resistor):
- Connect one end of resistor [R1] 1 kΩ to the COIL+ node.
- Connect the other end of [R1] to the anode of LED [LED1].
- Connect the cathode of LED [LED1] to the COIL- node.
- Relay contacts (12 V lock side):
- Identify the relay contacts: COM (common), NO (normally open), and NC (normally closed). For this case we will only use COM and NO.
- Connect the COM terminal of the relay to the LOCK_COM node.
- Connect the NO terminal of the relay to the LOCK_NO node.
- Leave the NC terminal unconnected.
- Electric lock:
- Connect one of the lock terminals to the LOCK_LOAD node.
- Connect the other terminal of the lock to GND.
- Powering the lock through the relay:
- Connect the +12V node to the LOCK_COM node (supply entering the common contact).
- Connect the LOCK_NO node to the LOCK_LOAD node (output to the lock when the relay is activated).
Schematic
+5V
|
o +5V
|
[PULS] Pulsador
|
o COIL+ node
|------------------------------+
| |
[R1] 1kΩ [D1] 1N4007
| |
[LED1] LED |
| |
o COIL- node-------------------+
|
GND
Bobina relé:
+5V ---[PULS]---o COIL+ node
|
[COIL] Bobina relé
|
o COIL- node
|
GND
Lado potencia (cerradura 12 V):
+12V
|
o +12V
|
[COM] Relé contacto
|
o LOCK_COM node
|
(interno relé)
|
[NO] Relé contacto
|
o LOCK_NO node
|
o LOCK_LOAD node
|
[LOCK] Cerradura
|
GND
Measurements and tests
- Verification of control power (5 V):
- Measure the voltage between +5V and GND with the multimeter in DC voltmeter mode: it should be approximately 5 V.
- Check that the polarity is correct (red probe to +5V, black probe to GND).
- Verification of power supply (12 V):
- Measure the voltage between +12V and GND: it should be approximately 12 V DC.
- Make sure the 12 V supply is properly connected and polarized.
- Measuring voltage across the relay coil (V_COIL):
- V_COIL is the voltage applied to the relay coil.
- Set the multimeter to DC volts, red probe on the COIL+ node and black probe on the COIL- node.
- Without pressing the button, V_COIL ≈ 0 V.
- When pressing the button, V_COIL should approach 5 V; if it drops significantly (below ~4 V), the coil might not activate correctly.
- Measuring relay coil current (I_COIL):
- I_COIL is the current flowing through the relay coil.
- Put the multimeter in DC ammeter mode (200 mA range or similar).
- Disconnect the wire that connects the COIL- node to GND.
- Connect the red probe of the multimeter to the COIL- node and the black probe to GND, so that the multimeter is in series between the COIL- node and GND.
- When pressing the button, read the current I_COIL (typically between 60 and 100 mA depending on the relay).
- Measuring voltage at the lock (V_LOCK):
- V_LOCK is the voltage reaching the lock.
- Set the multimeter to DC volts, red probe on the LOCK_LOAD node (side coming from the relay to the lock) and black probe on GND.
- Without pressing the button, V_LOCK should be ≈ 0 V (relay open).
- When pressing the button, V_LOCK should approach 12 V, indicating that the relay is closing the circuit to the lock.
- Checking the indicator LED (V_LED):
- V_LED is the voltage drop across LED [LED1].
- To measure it, place the red probe on the LED anode (junction between R1 and LED1) and the black probe on the COIL- node.
- When pressing the button, you should typically measure between 1.8 V and 3 V depending on the LED color; this confirms that the LED is correctly polarized and on when the relay is activated.
Common mistakes and how to avoid them
- Reversing the flyback diode [D1]:
- If you connect the diode the wrong way around (anode to +5V and cathode to GND), you will create a short circuit when pressing the button; the power supply will either go into protection or be damaged.
- Remember: cathode (band) on the side going to +5V (COIL+ node), anode on the side going to GND (COIL- node).
- Not sharing GND between 5 V and 12 V:
- Although the voltage levels are different, both returns must go to the same common GND so that the reference circuit is coherent.
- If you do not share GND, the measurements will be inconsistent and you may not see correct operation of the lock.
- Accidentally connecting the lock to the NC contact:
- If you connect the lock to NC (normally closed), it will be activated while the relay is at rest and will turn off when you press the button, exactly the opposite of what we want.
- Make sure to use the COM and NO terminals.
- Overloading the relay contacts:
- Check that the lock current (I_LOCK) does not exceed the relay contact rated current.
- If the lock draws more current than the relay can handle, use another relay model with higher capacity.
Safety and good practices
- Always work with the power supplies disconnected while you make or modify connections.
- First wire everything with the power supplies turned off; then power the 5 V circuit first and afterwards the 12 V circuit.
- Avoid allowing +12V and GND wires to touch directly: use a tidy breadboard and short wires.
- If you notice excessive heating in the lock, in the relay, or in the wires, cut the power and check:
- Lock current.
- Wire gauge.
- Current capacity specified on the relay.
Possible improvements
- Replace the push button with a microcontroller (Arduino, ESP32, etc.) using an NPN transistor to drive the relay coil from a digital output.
- Add a timer (for example, with a 555) so that the lock is activated only for a few seconds regardless of how long the button is held.
- Add a main cutoff switch for the 12 V line in series with the lock for extra safety.
- Implement an additional LED in parallel with the lock (with suitable 12 V resistor) to show when the lock is powered even if the latch cannot be heard.
More Practical Cases at Prometeo.blog
Find this product and/or books on this topic on Amazon
As an Amazon affiliate, I earn from qualifying purchases. If you buy through this link, you help keep this project running.
Quick Quiz
More Practical Cases on Prometeo.blog



