Cool miniature 3.3V latching relay circuit

This is the circuit I have been using to implement a latching relay with a Raspberry Pi or a C.H.I.P., using only the 3.3V power supply.

Two logical outputs are used to reset & set the relay, and I’m using one of the two relay contacts to be able to double-check the current relay state.

You should use basic 20ms impulses to drive the relay. Here is a basic python sample code that does this on a Raspberry Pi:

 import RPi.GPIO as GPIO
except RuntimeError:
 print("Error importing RPi.GPIO! This is probably because you need superuser privileges. You can achieve this by using 'sudo' to run your script")
import time

# example of GPIO init
# probe: pin #15, GPIO22
# set/reset: pins #16/18, GPIO 24/23
probe = 15
set = 16
reset = 18
GPIO.setup(probe, GPIO.IN)
GPIO.setup(set, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(reset, GPIO.OUT, initial=GPIO.LOW)

# setting the relay output to LOW
GPIO.output(reset, 1)
GPIO.output(reset, 0)
if GPIO.input(probe):
 # alarm if probe is not LOW
 print("unable to reset the relay, stopping here")
else:"ok, latching relay is now LOW")

The relay is a NEC EE2, and is able to handle main 250Vac power, for a basic 60W load. It’s quite simple, and thus can be easily soldered on a basic breakout board.

Have fun! 🙂

Leave a Comment