Killing an Arduino and I2C device with a relay?

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.


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.


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.