Triggering 12v relay is burning out my GPIO's?

Hey guys, I need some advice / help. I've got a pretty simple setup, as I'm in the circuit proof of concept stage.

I've got a 12v power supply, which feeds a 12v to 5v converter to run an Arduino.
I've got a 12v relay, powered by the supply, and passing through 12v on trigger to a 12v solenoid.

I'm triggering the signal wire on the 12v relay (it only requires 3v (tested with bench supply) to trigger the relay), with a GPIO pin. The relay is a "latching" relay, so I just. need a pulse of HIGH and then set back to low on the GPIO pin to put it in the correct state, I don't have to "hold" the relay open with the GPIO.

Here's my diagram.

And the schematic on the relay:

The relay will trigger over and over when signaled from the bench supply...when triggering it from a GPIO, the GPIO is immediately burnt out. Can someone tell me what they think is happening, and how to "measure" and / or "check" for blowback, over draw of current...whatever the case may be, before I keep burning out more GPIO pins.

I should note, that when signaled from the GPIO - the relay never fires, the pin will burn out, and the relay will never trip.

:slight_smile:
Thank you all for your help in advance.

EDIT: I assume I'm burning them out. After a trigger, they will not go back into PIN HIGH state, and measure no (or very tiny) voltage on the pin.

I'm surprised that you didn't fry the complete MCU. When you connect the relay to the GPIO you're putting 12 V on that pin. The absolute max. rating for any I/O pin is Vcc + 0.5 V. See Atmel Data Sheet under Electrical Characteristics. If you're using a 3.3 V MCU that maximum will be 3.3 V + zero comma something.
Apart from exceeding the max. voltage on a GPIO you're most likely also exceeding the max. current which for most GPIO's is between 20 and 40 mA.
What you should do is drive the relay with a transistor (bipolar or FET) which can handle the voltage and current for your relay. In addition put a fly-back diode in (anti-)parallel to the solenoid or the kick-back from cutting the current in the solenoid will most likely fry the whole circuit.
Here is an article that will show you how it's done: https://www.instructables.com/Driving-a-Relay-With-an-Arduino/

Two problems.

  1. As gilbert54 said, you can't drive a relay with a GPIO pin reliably, even though it looks like you're driving the relay coil with 5V, not putting 12V on it, which would be even worse.
  2. The ground on the relay coil should be on the output ground of the DC-DC converter, just in case the input and output grounds are not the same.

I took a peek at the DS for the relay (Geya GRM8). The general idea is to turn a 230V appliance on/off with an impulse relay, which has a COMMON NEUTRAL connection with the mains supply. Do not connect that common neutral with your Arduino. You may get yourself killed!

image

In your case, the "appliance" is a 12 V solenoid, hopefully not galvanically connected to the mains. Hence connecting the "-" of the 12 V PSU input with the "-" of the PSU output should be OK (making assumptions here, I have no Idea where hte 12 V is coming from if you're not working with a bench supply. But you better have a look at the schematic before starting a fire.
Unfortunately the Geya DS is not very clear about what's needed to drive the relay (as is usually the case with Chinese stuff), but from the example drawing it looks like the relay is driven by shorting "S" and "L" for a short time.
image
No idea what's inside the box to drive and hold the relay. You seem to be lucky that feeding the S terminal with 3V does the job. I would try a transistor which feeds the 12 V to the S terminal.

Ok, I'll go through the instructable, thanks for providing that

1.) Thank you for sending me to investigate more. If I measure on the relay:
A1 -> A2 = 12v
A1 -> S = 10.9v
S -> A2 = nill

So I hadn't measured voltage on the Signal Wire before...being a signal I didn't expect it to be carrying voltage, but you're 100% correct.

Is there a reason it's about 1v less than the supply voltage? Something to do with the internal coil?

Here's the diagram on the relay it self - for future people looking into the thread.

I just saw your second response too.
The signal is triggered by providing voltage on the S line. I can provide as little as 3 volts to the S and still trigger the relay, but as you say, I think what it's doing is shorting the L and S - so it trips when there's enough to short it.

I'm not connecting anything to MAINS AC. The relays are rated
AC up to 230v
AC/DC 12-240 volts.

They are only being used in a 12v circuit with the Arduino. I'd send you a picture of the actual prototype, but it's a MESS and I'd be embarrassed.

The relays themselves are nice, because they latch, so you don't have to provide constant "hold" voltage to keep it open or closed, whichever the case may be for a NO or NC version. It flips between 11 -> 12 or 11-> 14 terminals (no idea where 13 went, probably Chinese superstition)

For the record, in case someone else finds this thread. The relay mA power requirement isn't listed anywhere, so I had to measure it. The power consumption of the relay in non-energized state is
8.7 mA measured in series on my Fluke between A1 and A2
during energized state
20 mA - pretty close to exactly, measured between A1 and A2

Ok, so now to my questions: Can I drive the relay with another relay? I have a SRS-05VDC-SL (not the C version) - can I drive a relay that drives a relay? Messy I know, but would it work in this case?

I have a few transistors around, but the one that comes to mind is S8050 NPN - would that work? I've not worked with transistors much, so I'll go through the video.

Thank you again for all your help.

Thanks for jumping in on this. Even though it's not shown in my terribly quick sketch of the circuit, all grounds are common in this circuit, back to the 220 -> 12v power supply. It's an ALT-1205T , and takes in MAINS current from an outlet, and outputs 12v, that powers the system, and straight onto the DC-DC 12v to 5v board.

EDIT: Correction, all the DC grounds are common, it shouldn't be confused with the L - N and Earth of the 220 line, which is managed internal to the converter.

Driving the S line with a relay should be possible but is just adding cost and consuming space on your PCB. You will still need a transistor or FET to drive that 2nd relay as the GPIO can't do that directly. A simple and cheap NPN transistor like your S8050 should do the job. Be aware of the VCE maximum ratings (12V is OK) and ICE (1.5 Amp). In your current project that shouldn't be an issue. I'm not sure if the S line produces inductive spikes when the relay is switched ON or OFF as I don't know what's inside to do the latching. For safety you may consider to put a diode over CE. If you have a scope you should take a look at the voltage between A1 and S while turning the relay ON/OFF.

I don't have a scope, but I have a FLUKE 289, it's pretty good at catching quick spikes, using the logging and the MIN/MAX - any reason I can't catch this, or its something you can really only see on a scope?

I measured a few of the stats on the 12v relay directly. Holding the coil energized takes 12mA, but don't know what the inrush is, or the collapse.

Sorry, what is the VCE, ICE and CE in this? Brand new to using transistors?

I built a quick circuit on the breadboard that used the negative side to trigger the NPN transistor -> 5v relay ->LED with 1k resistor) -> 12v relay S terminal. I used an LED with a 1k resistor as a down and dirty diode, to make sure power couldn't back feed. It had the added benefit of flashing briefly when the 5v relay was sending power to the S. Since it just needs a pulse to change state on the 12v.

I am really new to transistors. I wanted to remove the 5v relay from the equation. I have a half dozen or so 2n2222 transistors to play with, but removing the 5v relay and trying to wire the transistor to short the + - on the 12v relay signal burned a few out, so I'm doing something wrong.

When I look at the DS for the 2n2222 it seems like a high current resilient little bugger. What is the "gotcha" with them? What is the "don't do this or you burn them out immediately" scenario?

Any quick advice on how to wire it with the 5v relay removed from the setup and firing the 12v S terminal directly? Is it possible? I'm going to get some high current diodes ordered but I'm in the Caribbean, so it takes a "while" sometimes.

Hopefully, you guys aren't tired of my questions yet, but I'm questioning the overall use of the relay all together. If I use that NPN transistor, can I fire the solenoid directly with it, and not use a relay at all?

Solenoid stats are:
12v AIR/LIQUID solenoid
Tested: 2.5amps to hold the valve open
Normally Closed

I doubt it can run it, as everything I see on the DS for the trans is measured in mA not A - but I don't know a lot about them.

Highest I was able to measure was 2.7 during quite fast transition of the valve. If I get my other meter with the inrush measurement, I'll do it again.

You can use a MOSFET such as IRLZ44 or similar (but it must be a "logic level" MOSFET) instead of the relay. Even with a logic level MOSFET, in theory, 3.3V may not be enough to fully switch it on, so keep an eye, or a finger, on the MOSFET during testing to check it doesn't get too hot.

Add a 10K pulldown to the Arduino pin connected to the MOSFET gate, and a current limiting resistor (e.g. 330R) between the Arduino pin and the gate. And don't forget that flyback diode across the solenoid valve terminals.

Sorry, I assumed you had at least some basic knowledge about transistors.
VCE = Collector-Emitter Voltage
ICE = Collector-Emitter Current

Same is true for FETS, but then we use Drain, Source and Gate i.s.o. Collecor, Emitter and Base.

Note that a transistor requires sufficient Base drive current in order to drive the CE (Collector-Emitter) path into saturation. hFE tells you the multiplication factor between Base current and CE current. A Transistor with a hFE of 100 will have an ICE of 100 mA with a Base current of 1 mA, assuming that the resistor beween Vcc and the colector doesn't limit the current to less than 100 mA.
A FET doesn't require current at the GATE, but voltage (VGS) to drive the DS path into saturation (= max. current). Regular FETs require a higher Gate voltage than most micro's can supply. Hence there are special LOGIC FETs, which can control the Gate with less than 3 V. ALthough a Gate is insulated from Drain and Source and thus dosn't draw noticeable current, you still have to use a resistor in the path to drive the Gate. It acts like a capacitor and the inrush current to charge the Gate may have undesirable effects on your micro. Typical values are 5..10 k.

IRLZ44N would be a good choice. It can handle 50A and requires less than 2 V to turn it on. With a RDSon (residual ohmic resistance when fully turned on) of only 0.03 ohms power dissipation @ 2.5 amps is nearly nothing. Price @ Farnell is about 2€.

Thanks, that thing looks AWESOME! Great suggestion guys.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.