toggling a relay off with MCU

Status
Not open for further replies.

Scarr

Member
Hi all,

I have a latching relay, there is a constant positive supply to the + side of the coil, and normally the negatice side is floating, I want to pull down the negative side to switch off the relay can I do this directly with a pin of a MCU (AVR / PIC) that can sink tens of mA?

Because I was unsure I tried using a BCR148 with the MCU feeding the base and the emitter to ground, but this does not appear to work?

I know your probably laughing but any help will be great.....
 
Was I Clear?

Hi all,

Was I clear? or have I made it a confusing question or not given enough information?

Thx
 
How much current does it take to operate the relay? Normally, a latching relay requires reverse current to open the contacts or else there are two coils. If you pull the negative side down with enuf current, it will close the contacts but then, to open the contacts, you need to swap ends of the coil or pull the negative side higher than the positive side. It might be easier to use a regular relay with an extra set of contacts which can latch the relay on, then all you have to do to unlatch it is to remove the power.
 
THats right

Yes its got two coils but the other one is operated via a jumper, I think I understand what your saying about using a normal relay but this is battery powered so that’s why a latching relay is used so as to save power once toggled.

The relay coil is rated at 5v, 125R it looks like using the BCR148 is why it's not working as it has a 47k base resistor AND THATS TOO HIGH.

Anyone advise me on the correct sot23 transistor and resistor combination? (replay is a Omron G6AK-234P 5VDC)

Ideally a NPN transistor with built in resistor as then it's just a part replacement.

Thx

Thx
 
Your transistor needs to deliver at least the current the relay coil will draw.

Compute relay coil current using ohms law V=IR. re-arrange, I = V/R = 5/125 = 40 mA. Just about any transistor with a minimum current gain (Hfe) of, say, 30 will work. which is to say just about any transistor. 2n3904, 2n2222. sot23 variants are mmbt3904, mmbt2222 and so on. (Note: I am ignoring the collector to emitter voltage drop. It doesn't matter in this case but you would subract that from the voltage value used - typically .7V)

Compute base current needs. Collector current = 40 mA = Hfe * Base_current. rearrange, substitute: Base_current = 40mA/30 = 1.33 mA

Compute base resistor using ohms law. V = IR. Voh = .00133 * R. rearrange R = Voh/.00133. Voh is your logic's output voltage high (i.e. output pin high). Lets call it 4.5V for argument's sake. R = 4.5/.00133 = 3383. closest standard 5% value is 3.3K but you could probably go a lot lower. A 1K based resistor would give you 4.5 mA which is probably well within the current limits of your logic. It is ok if your transistor is set up to deliver more current that your relay needs since the relay's coil resistance will limit the current anyway.

using 47K from your posting, your transistor is delivering something less than 10mA. Much to low current. Just try relacing the 47K resistor with a 3.3K or smaller resistor.

do you have back EMF supression diode in place?

phil
 
A mosfet would be the simplist to use, you can drive it direct from the microcontroller. I use ZXMN3A01FTA, 30 V, 2 A max. You will need a diode across the coil to protect against the back emf.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…