I have several single coil latching relays, (EC2-5SNU).

I am trying to control them by an MCU; connected directly they work fine, but I am iffy about keeping it this way so I'm trying to power them through a darlington pair array, (ULN2003).

Using the non-latching type, these work fine through the ULN2003, but attempting to interface the code below with the latching type isn't going so well and i can't figure out why:

int right = 12;
int left = 10;

void setup() {                
  pinMode(right, OUTPUT);     
  pinMode(left, OUTPUT);    

void loop() {
  digitalWrite(right, HIGH);  //reset
  digitalWrite(left, LOW);  
  digitalWrite(right, LOW); //set
  digitalWrite(left, HIGH);   

I have four connected with a common pin, but to simplify i've tried and failed to have the code above work on a single relay, as shown below:

enter image description here

enter image description here

Measuring the voltages out of the MCU show the correct levels, keeping in mind the ULN2003 acts an inverter, so i've set the boolean logic accordingly.

The voltages at the output of the ULN seem to stick at 0.6V, I've tried a bunch of permutations, including having one pin (on the common pin setup) connected directly to the MCU.

Does anyone have any ideas?

2 Answers 2


You need to use an h-bridge as if you were driving a motor. For this kind of relay you need to be able to both sink and source current, which a Darlington pair cannot do, it can only sink.

I guess you may be being thrown by the symbol of an inverting buffer used in the schematic symbol for the ULN2803 in your schematic capture package. It's incorrect, since it's not an inverting buffer, it's a Darlington pair:


simulate this circuit – Schematic created using CircuitLab

As you can see, setting the input HIGH will allow the transistor pair to conduct, but setting it to LOW will stop it conducting - so the output is either connected to ground, or is floating.

  • Thanks, that's the lesson i learnt the hard way. FYI to anyone reading, as calculated on page 8, the relays draw 25mA so can be attached directly to the MCU. Commented Sep 27, 2017 at 13:13
  • No, they can't be directly attached to the MCU, or not safely anyway. The back EMF from the switching is liable to damage the MCU. You should separate it with a proper H-bridge.
    – Majenko
    Commented Sep 27, 2017 at 13:15
  • You're right, not the safest option, but connecting them through a bridge rectifier makes it so. i.sstatic.net/Q0uOL.png Commented Sep 27, 2017 at 17:22

I'm sure that you've solved this, given that the post is old, but it would work if you use pull-ups on the ULN2003 outputs. However, you should wire at least two open-drain buffers of the ULN2003 to both endings of the relay coil to ensure enough current when the microcontroller pulls down.

See this 2009 EDN post: https://www.edn.com/drive-a-single-coil-latching-relay-without-an-h-bridge-circuit/

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.