I am using the Arduino Ethernet with POE and I am in trouble when I have to enable my relay by using a digital pin. What I would like to make is to start a motor by using a relay, which relay is switched with a Arduino digital pin.
My relay is the following (3V):
My circuit is the following:
My sketch is as-like the following:
#define pinRelay 5
void setup() {
pinMode(pinRelay, OUTPUT);
...
}
void loop() {
...
digitalWrite(pinRelay, HIGH);
delay(5000);
digitalWrite(pinRelay, LOW);
delay(5000);
...
}
When the digitalWrite(pinRelay, HIGH)
runs then I listen a weak click come from the relay but it doesn't work as expected: the COM/POLE (Common) doesn't switch from NC (Normally Close) to the NO (Normally Open) so the current doesn't pass and the motor doesn't start. However if I connect the wire directly to the 3.3V (or the 5V) power source pin on the Arduino board it works as expected and the motor start moving.
What is the problem? Why the relay doesn't work as expected?
Note I: I also tried with pins other than 5
, but the result is the same.
Note II: By measuring the Voltage between the pinRelay
and the Ground
with my multimeter, the output is around 4V.
Note III: I read a lot of posts on the Web that may be similar to my issue, but I have not yet figured out what the problem really is.
Best Answer
The Arduino pins can only source a small amount of current (40mA per pin, 200mA total). You will want to use a low side switch with a transistor to satisfy the current demand of your relay. My go-to circuit for this problem is as follows (using a 1N4001 diode and a 2N3904 transistor).
simulate this circuit – Schematic created using CircuitLab