Darlington Confusion......

jsmanson

Member
HI folks - I need a hand on a problem I'm having.

I'm trying to drive a series of 8 single coil 12V latching relays from a 40x2. As I'm somewhat short on digital outs, I stuck a MCP23017 I2c digital output in there to allow the picaxe to separatley control all 16 (2x8) coil leads through I2c. As the relays are 12v coils, I can't control the relays directly from the I/O expander - so I thought that I would stick in some darlington drivers (ULN2803AN), and drive them from the I/O outout ports from the MCP. The 8 output darlington IC (I need 2 of them) is hooked up to 12v on pin 10, ground on pin 9, and pins 1-8 are the I/O outputs 0/5v, and pins 11-18 are the darlington outputs, which I thought would cycle between 12v and 0v depending on the input status.

But I can't get 12volts on any of the outputs of the two darlington chips, no matter what the input voltage is (it's cycling properly between 0 and 5 volts). I'm guessing that I'm not using the darlingtons properly. Can someone steer me in the right direction?? Thanks!

John Manson
 

premelec

Senior Member
You need 2 x Vbe + the actuation voltage from the emitter to V- to turn on the darlington [I've not got the schematic of the particular unit you are using...] you'd likely do better with just some transistors with relay from collector to V+ and reverse catch diode across the relay coils - 500 ohms or whatever to transistor base which then the 5v drive only has to overcome Vbe for the transistor to conduct.... hope this helps... check manual 3 as well...
 

jsmanson

Member
darlington confusion....

OK - I found the answer elsewhere on the forum - I was thinking that the darlington would output 12 volts, which it won't.

Does anyone know if there is an IC that would switch on/off a 12V supply based on a 5v logic input? I can do this with a bunch of relays, but I'm wondering if there is a solid state soulution.

John
 

premelec

Senior Member
sure a bunch of logic level FETs of approriate current carrying rating - there are also transistor arrays in DIP packages - or there used to be :) possibly 2n7000s would work - depending on your current needs - I've used them though the Vgsth is a bit high on some.
 

boriz

Senior Member
A Darlington made using NPN transistors is a low side switch. That is it behaves a little bit like a relay/switch with one terminal connected to 0v. So to switch power on/off to a load, the load must be connected between the Darlington and +V.

The reverse can be achieved using PNP type transistors. So you connect the load between the Darlington and 0v. I think this is what you are asking for. However this comes with a serious drawback.

High side switching using a PNP Darlington requires that when it’s off, the base (control input) needs to be at the same +V potential as the Darlington emitter terminal, and be driven low to switch the Darlington on. Unfortunately, with 5v logic systems, such as the Picaxe, the maximum voltage available on an output is 5v. So if your Darlington emitter is connected to a 12v supply, with the load between it and ground, if the Darlington’s base (control input) is provided by the Picaxe, it will never switch off. The input will always be lower than 12v.

High side switching is possible, but only when the load voltage you are switching is no higher than the control voltage, IE 5v, or by using additional NPN transistors to invert the logic.

So for 12v, and other voltages, low side switching using NPN Darlington’s is preferred.
 

jsmanson

Member
Great!

Thanks Premelec and Boriz for your quick answers - now I get it.

As this single coil latching relay is really the same as a bi-directional 12v motor (1 watt btw) I guess I can use a series of L293D quad motor drivers. I'd need 4 of those for 16 leads. Looks like I can fire them up with 12 volts, drive them with logic levels, and I'll be off to the races.

Right? :)

John
 

BeanieBots

Moderator
As you correctly state, you require full bi-directional drive (eg H-Bridge) to change the state of a single coil latching relay. Hence ULN2803 is no good.
The L293D driver is an option.

However, as long as your drive is a good solid bi-directional switch with the ability to properly source and sink, then you can switch the relay with just ONE drive line.

Simply put a capacitor in series with the drive and the coil.

The cap value depends on coil resistance but 100uF or so is usually enough.
Try it.
 

jsmanson

Member
One drive line idea....

The one drive line is intriguing, but I need the picaxe to know what the states of the relays are at all times, and I need the ability for the relays to function in their last state when the picaxe is turned off, so I’m thinking of using two outputs per relay – in that way, if the picaxe is powered down, the relays wouldn’t change state. I will store the relay state in an eeprom, and when the picaxe is powered up, it will know the state of all of the relays from the previous session.
 

hippy

Ex-Staff (retired)
Not sure I completely understand the one wire drive but it seems possible to have a single "enable" which can control all relays and individual single lines to set / reset each relay. The remembering relay states in Eeprom idea will still work, and you can set the drive lines as appropriate to set / reset each relay; a set relay being set again won't change its state, same for already reset being given a further reset. While enable isn't asserted - running or powered off - the relays won't change state.
 

BeanieBots

Moderator
The one wire method is actually quite simple. In one direction it energises the coil while the cap charges, in the other direction it uses the charge to energise the coil in opposite direction.

I've not thought it through fully with respect to ensuring that no relays change state on power but I can't see an issue off hand.

To be honest, this application is much better suited to dual coil relays especially if you want to dedicate two outputs to each relay. However, if single coil relays must be used (because you have them?) then give the series cap idea some thought. I'm quite sure it could be done without having relays changing state at power down but care would be required to ensure they did not change at power down due to parasitic powering of the PICAXE via the caps.
(bring the power rails down slower than the dV/dt required to energise the relay by using large reservoir caps)
 

premelec

Senior Member
pseudo H

I'm not clear what your coil resisitance and switching current are... you can often make a pseudo H bridge with 2 resistors and 2 transistors with the tops of the resistors to V+ and bottoms to NPN collector and coil between the the resistor/collector junctions. This presumes that you have enough voltage and transistor current capability - i.e. the latch coil must work OK with a resistor in series with available voltage... pulsing one NPN will then put current through the coil one way and pulsing the other NPN reverse the coil. Since the set / reset pulse is usually very brief and you leave the NPNs off this can work out. If you want to add extra kick you put a capacitor across each resistor - as has been referred to by other posts. If the coil power required isn't much this solution can be economical. I have used it for small latching relays. Time to try stuff out... :)
 
Last edited:

jsmanson

Member
1 wire....

You guys are all great by the way - this is more more, and better feedback that I ever expected when I posted my original query!
For more background - this is my continuing project to build a lead acid battery bank 'maintainer' which manages 4 banks of 220AH 12 volt batteries. I'm using 8 - 60A single coil latching relays to switch each battery bank either into the main cabin (invertor) circuit, or into a secondary circuit which I can do 'offline' testing on - load testing, desulfation, equalization charging, all while the other battery banks are on-line and being used. The Picaxe will run all of this, will keep track of each banks performance (i.e. 20h A-H load ratings), and can connect each battery bank in and out of the repsective circuits as need be. By design, I want the user to only be able to switch battery banks in and out by making a 'request', using an interrupt circuit, through the picaxe, which will in turn will switch the relays in and out if voltages are OK for that action. It will, for example, make sure that a battery bank is reasonably fully charged before switching it into the cabin circuit. This design also allows me to fully charge and equalize each battery
bank offline, using a relatively low charging amperage (10-20 amps), otherwise I need a huge charger to get the batteries fully charged (The cabin is not on mains power). I want to have the ability for the battery bank system to run in any particular relay state with the picaxe turned off.

Ok - so I want the picaxe to fully control the 8 60A relays for the reasons above. Looking at the 1-wire idea, where one output wire turns the relay both on and off using a cap in series, it looks like one of the 'states' will be maintained as long as the picaxe is powered up. If the picaxe is turned off, voltages will be lost, the Cap will discharge, and the relay will change state. However, as the picaxe isn't on, it won't know that the relay has changed state, so that when it is turned on the next time, and it reads the EEPROM to determine relays current state, it won't correspond to reality. Alternatively, I could program the picaxe to only turn off on an interrupt request, and I could proramatically turn off all of the relays, but I may not want to leave the relay in that state when the picaxe is powered down. Using the one wire approach, I don't see how I can leave a relay in the 'charged' state without having to leave a circuit on all the time, which I wish to avoid.

This thing will be left in an unsupervised state for months at a time, so I am uncomfortable leaving the picaxe on in that situation.

The 60Amp single coil relays were purchased off ebay for less than $5 each, I couldn't afford dual coil versions as they were more than $50 each. I'm using Sanyou SMAE-112DM1 relays.
 

moxhamj

New Member
Re reading the eprom to get the relay's state, that may not be 100% reliable. I've got a picaxe driving a latching circuit and for some reason the picaxe sometimes gives spurious pulses when it is powered down. So sometimes the state changes and you don't know till it powers up again.

One answer is to dedicate a picaxe input pin to detecting the state of the relay. This might be easy or harder depending on what you are switching, and it might be as simple as a voltage divider, or it might be more complex with an optocoupler.

The other option is to leave the picaxe on all the time. Picaxes use tiny amounts of power - far less than the self discharge rate of lead acid batteries. Though even if you did this, it still might be safer to still sense the actual relay position somehow - both for the picaxe and also a visual indicator with a led or something.
 

jsmanson

Member
Options Options....

hhhmmmmmm. I hadn't thought about reliability of the picaxe on shut-down - but I could get around that by running the 12v power source for the latching relays through a non-latching relay, and shut that off before the picaxe powers down. I'm not really short on digital i/o's with probably 25 i/o's available between the picaxe, lcd expansion, and 2 - 8 bit expansion IC's - so another one to control relay power would be fine.

On leaving the picaxe on - I'm not really worried about picaxe circuit loads, but as it will be unattended during the winter, if things went astray, and the picaxe decided for example to leave the batteries on a discharge test - they would be left completly flat over the winter and I'd be into $800 for new batteries - I have no way to monitor the system for months at a time so I thought that I would design the system so it can be gracefully turned off, and the banks left in a state suitable for solar trickle charging over the winter without any reliance on microcomputer's humming away and behaving. In summer, the picaxe could be left on to do it's thing.

On another note - I was toying with the possibility of hooking all this up to a cellular module so I can 'play' with the thing remotely, but it looks like this feature would cost me at least $300/year in cellular account charges just to allow data transfer occasionally - if I could find a way to use cellular for $10/month or so it would be worth pursuing. Has anyone played with these new modules? They're about $180US for a GSM thingy that talks to PIC's. The link for one:
http://www.sparkfun.com/commerce/categories.php?c=68
 

lbenson

Senior Member
>if I could find a way to use cellular for $10/month or so it would be worth pursuing.

I have a T-mobile prepaid account with a Motorola V195S cell phone in the U.S. It costs me about $10 a month and it can access the Rogers network in Canada, at least in Nova Scotia--I'm not sure of the per call or per message costs. I have not fully implemented it, but the V195S supports serial "AT" commands and so can have SMS messages sent via serial (I tested using putty on a PC, but no reason a picaxe couldn't do it). That's outbound. I didn't test inbound--picking up SMS messages and doing something with them. It's on my agenda somewhere, but keeps getting pushed down.
 

Tasp

Member
Whoa, I'm not encouraged my what I've just read!

Guys help me out here, as I understood from the manual 3 I could connect Darlington driver then connect a 12v relay.

So far I have created a program and stripboard that is a 40X2 with all the outputs connected to 4 Darlington drivers (Darlington drivers connected to 12vdc) with the intention to fit relays to the Darlingtons to provide volt free contacts.

But according to what I've read above I cannot do that? Am I incorrectly reading the above posts.

I'm not overly proficient with electronics so layman's terms would be great.
 
Last edited:

Taniwha

Senior Member
Questions about the system

The 60Amp single coil relays were purchased off ebay for less than $5 each, I couldn't afford dual coil versions as they were more than $50 each. I'm using Sanyou SMAE-112DM1 relays.
Looking at the datasheet for these relays, they appear to be single pole single throw?
I am curious to know how you will use these to select between the two loads?
Also why are you only switching one leg of the battery? or will you use two relays per battery?
Will the picaxe schedule unsupervised battery discharge/equalise cycles during the winter months?
Does the Picaxe monitor state of charge before allowing discharge cycles? Does it monitor state of charge during discharge to prevent over discharging?

A little of my background for asking these questions:
I am a product manager specialising in UPS & D.C. systems for a Standby power company in NZ, we carry a large range of D.C. based systems, including Solar, UPS, D.C. rectifiers and batteries and portable and stationary Gensets, so I am always interested in what others are doing out there.

Cheers
Stewart
 

BeanieBots

Moderator

Tasp

Member
I am aware that ULN2803A is a Darlington Transistor Array but from the posts below I was confused as to whether this would work.

But I can't get 12volts on any of the outputs of the two darlington chips, no matter what the input voltage is (it's cycling properly between 0 and 5 volts). I'm guessing that I'm not using the darlingtons properly. Can someone steer me in the right direction??
High side switching using a PNP Darlington requires that when it’s off, the base (control input) needs to be at the same +V potential as the Darlington emitter terminal, and be driven low to switch the Darlington on. Unfortunately, with 5v logic systems, such as the Picaxe, the maximum voltage available on an output is 5v. So if your Darlington emitter is connected to a 12v supply, with the load between it and ground, if the Darlington’s base (control input) is provided by the Picaxe, it will never switch off. The input will always be lower than 12v.

High side switching is possible, but only when the load voltage you are switching is no higher than the control voltage, IE 5v, or by using additional NPN transistors to invert the logic.
 

hippy

Ex-Staff (retired)
I am aware that ULN2803A is a Darlington Transistor Array but from the posts below I was confused as to whether this would work.
I'm a bit confused, not sure in reading "whether this would work" what "this" is.

Darlington arrays ( without getting into deep technicalities and subtleties ) are just a set of transistors in a chip, which usually have their emitters commoned to a single chip leg.

With the emitters connected to the 0V of the circuit, the bases ( ULN2803A 'inputs' ) driven from PICAXE outputs, the collectors ( ULN2803A 'outputs' ) can be used to switch a high-side load, a load between +V and the 'outputs'.
 

Tasp

Member
I thought it was that easy yes, but was confused by posts in this thread saying it wouldn't change state. Seems I was just confused.

Thanks
 

BeanieBots

Moderator
Part of the confusion probably comes from the fact the thread originator was driving latching relays which are totally different in function to the type you are looking at. It would NOT be possible to drive a single coil latching relay with a single darlington driver. However, a simple coil activated regular relay like the one you linked to would be very simple to drive with a single output from a darlinton array.
 
Top