# Killing an Arduino and I2C device with a relay?

I destroyed* an 5V 16Mhz Arduino Pro Mini and a PCF8574 I2C port extender and I wonder how. Obviously it can be many things (ESD, overvoltage, etc.). But I suspect the problem lies in my driving a 24V relay, so in order to keep this topic narrow, that's going to be my question.

Background: There's a Pro Mini, powered by one of those XL4005 power supply boards you find all over China. Power supply is dialed to 5V. The Pro Mini is connected using I2C to four PCF5874A extender boards. The boards too are powered from the same source.

I hooked it up to a NPN transistor (2N3904) in order to switch a relay (Fujitsu FTR-K1CK024W). The relay coil is 24V, and according to its specs draws 17mA (1440ohm coil).

Is there a way this schematic could destroy the PCF and connected I2C device?

*) Pro Mini is unresponsive, boot loader LED not blinking on start. On a fresh Pro Mini, all extender boards, except the one destroyed are being recognised.

• Thanks for the many good answers. Too bad I can only 'accept' one. Know that I appreciate all of your inputs! :) – svenema Aug 3 '17 at 17:15

You can also put a zener diode between the transistor collector and emitter. Make sure the zener diode breakdown is greater than the input voltage, but less than the breakdown of the transistor.

A good reference for switching inductive loads is "On Switching Inductive Loads with Power Transistors" by R.E. Locher, published by the IEEE in 1970.

• This will work but make sure the Zener can handle the full load current of the relay. – Trevor_G Aug 3 '17 at 17:21
• Nominal current should be 17mA, according to specs, times ten for over-engineering? Which spec on the Zener datasheet is this? Ifsm perhaps? – svenema Aug 3 '17 at 17:23
• @Trevor, I'm starting to think you were talking about how much power a charged coil can deliver. Unfortunately this is not in the relay data sheet. However, we do know that the coil takes 400mW. Is it safe to assume it cannot store more than that, and as such select a Zener with a power rating of at least 400mW? – svenema Aug 3 '17 at 20:28
• @svenema for power it gets complicated. However the Zener must be able to withstand a max reverse current larger than your driving current. Power should not be an issue is you are not turning it on and off very very quickly..eg. PWM. – Trevor_G Aug 3 '17 at 20:31
• @svenema however, I don't really think a zener is the best solution here. You would be simpler with a standard flyback diode across the coil. – Trevor_G Aug 3 '17 at 20:32

As you switch off the relay, there suddenly is a very high $\left\lvert\frac{d\,i()}{dt}\right\rvert$. Now, the coil of that relay is an inductive device, and inductive devices have a voltage-current relationship of

$$v(t) = L\frac{d\,i()}{dt}\text.$$

Hence, your transistor see a potentially huge (positive) voltage spike, and might fail in the process, taking the IC with it.

The usual way of dealing with that is having a relatively beefy diode antiparallel to the coil.

• Thanks Marcus. It's good to hear it could have very well been the cause of the destruction :). (and I feel a bit stupid, I really should have remembered this) – svenema Aug 3 '17 at 17:27

Relay coils are inductors, and they can produce a pretty large negative kickback voltage when you stop powering them. This can destroy both the transistor and any components farther back.

You need a "flywheel diode" connected in parallel to the relay coil to protect the transistor from this back-current.

Orient this diode pointing up, away from the transistor. It will then block the generated reverse voltage.

• A diode pointing down would be an interesting way of nulling the inductive effects of the relay. – Vladimir Cravero Aug 3 '17 at 16:37
• @VladimirCravero oops, got it mixed up. Thanks for the correction! – Jashaszun Aug 3 '17 at 16:38
• Thanks, although I'm going with a Zener on the transistor, because of how my circuit is physically constructed. – svenema Aug 3 '17 at 17:28