Skip to content

Relay and arduino

At charging we had

I = {{V_O } \over {R_r }}(1 - e^{ - {{R_r } \over L}t} )

for t \to \infty we have
\left({{1 \over e}}\right)^{{{R_r } \over L}t} = ({\rm 0}{\rm ,36)}^{{{R_r } \over L}t} = (0,36)(0,36) \ldots (0,36)\mathop \to\limits^{t \to\infty }0

So the neperian part tends at zero so Io=Vo/Rr for t \to \infty

Io in our case is Io=Vo/Rr=5/70=0,07A=70mA
We have seen from the "arduino project to a standalone one" that Arduino have a maximum load rating of 40mA.
So at this point we know that our relay can not be connected directly with arduino !
In order to solve this problem we have to pilot our relay with a common emitter transistor in order to amplify the current needed for the relay.
We will see later in this article how to obtain this result.
So the charging graphic is this :

RL Charging diagram

As you can see after 5(L/Rr) time the inductor is full "charged ."

 

 

It is now time to discharge our RL circuit.

Relay-Discharge-Circuit

When you press the switch off the inductance L tends at any cost to discharge since the electromagnetic field is collapsing.A current is generated by the inductor and the accumulated energy needs an exit way.
So the air becomes "conductive". In fact we can redesign an equivalent circuit. We can replace the T switch with a Rair resistor that has let's say 1 MOhm resistivity.
Rr is connected with Rair in series but Rr<<Rair so we can assume that we have a normal RL circuit with R=Rair discharging.

0 = V_{Rair} + V_L \Rightarrow 0 = IR_{air} + LI' \Rightarrow I'+ {{Rair} \over L}I = 0

The solution of this differential equation is :

I = Ce^{ - {{Rair} \over L}t}

 

Assuming that at t=0 we have I=Io (the current reached at the charge time) we get C=Io

So the solution of the discharging RL circuit is :

I = I_o e^{ - {{Rair} \over L}t}

where Io=Imax=0,07A=70mA in our case as we have seen before.

We know from Ohm's law that Vspike=Imax*Rair=70mA * 1000000Ohm=70000V !!!

Relay-Discharge-Circuit2

This is a huge problem for us, it is called back electromotive force (EMF).
The indutance acts like battery with a short life.

 

 

 

Here is the discharging diagram :

RL Discharging Diagram

As you can see now the discharging time is shorter than the charging time since Rair>>Rr

 

 

To solve this back electromotive force problem we have to place a protection diode in our circuit.
If we place a diode at the relay pilot pins (the red signed ones)
we get the follow circuits for discharging and charging.

Relay discharge and charge circuit

At the discharging phase the diode is in parallel with Rair so Rair is "eliminated" and the only resistance at the circuit is the resistance of the relay (Rr). In this case
Vspike=Imax*Rr=70mA * 70Ohm=5V which is acceptable.

At the charging phase the diode is "not present" at all as you can see from the circuit at the left.

In the next page we will see how to connect the relay at arduino.