0

How does one measure the amount of current a relay is drawing from an Arduino?

Do I connect a multimeter in series with the digital pin to which the relay 'IN1' is connected (in this case pin 7), the 5V pin or GND pin?

Provisional testing gives me the following results (when the relay is ON):

  1. Pin 7: 3.93 mA
  2. 5V pin: 70.2 mA
  3. GND pin: 66.8 mA

Also, assuming I pull more than 40 mA through digital pin 7 for a number of seconds, is the pin likely to fail immediately? Or slowly degrade over time?

2
  • What relay has an "IN1" pin? All mine have two coil pins and three or six switched pins.
    – Majenko
    Commented Nov 7, 2015 at 12:16
  • My guess is you are using a relay (breakout) board, not a bare relay. 70mA sounds about right for a 5v relay. Which is indeed more that a digital pin can handle.
    – Gerben
    Commented Nov 7, 2015 at 12:21

1 Answer 1

1

Have you noticed how the 5V current is, give or take a little inaccuracy on the part of your ammeter, the sum of the other two currents?

Without knowing what relay you are talking about, my guess is it is one of the SainSmart 5V relay modules with opto-coupler. Those, by default, use a common 5V input and split it between the opto-coupler (and then into your digital pin to be sunk through ground) and the relay to ground. Therefore the 70mA is split between 66mA through the relay and 4mA through the digital IO pin.

So the correct place to measure the total current in this instance is the 5V pin since that is the common point for the circuit.

In answer to your second question, read the datasheet. It quite clearly states:

Although each I/O port can sink more than the test conditions (20 mA at VCC = 5V, 10 mA at V CC = 3V) under steady state conditions (non-transient), the following must be observed:

ATmega48PA/88PA/168PA/328P:

  1. The sum of all I OL , for ports C0 - C5, ADC7, ADC6 should not exceed 100 mA.
  2. The sum of all I OL , for ports B0 - B5, D5 - D7, XTAL1, XTAL2 should not exceed 100 mA.
  3. The sum of all I OL , for ports D0 - D4, RESET should not exceed 100 mA.

If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition.

And also a similar note for sourcing current.

So although they can sink or source more than 20mA, and theoretically up to 40mA, anything more than 20mA is not guaranteed and should be avoided.

Basically overcurrents cause increased heat dissipation in the MOSFETs which causes the internals to break down. Hence the note about under steady state conditions.

So sourcing or sinking more than 20mA for longer than a few ms is asking for trouble. More than 40mA is just being irresponsible.

Furthermore, the MOSFETs in the IO pins act like resistors when turned on. As you should know, according to Ohm's Law, the voltage across a resistor is proportional to the current through the resistor. Increase the current and you increase the voltage across the resistor. Since that resistance is in series with your circuit that voltage gets subtracted from your available voltage on the IO pin - so drawing too much current will cause the voltage to drop (or rise for sinking) below (above) the specifications for the logic voltage for that IO pin. So not only do you risk damage to the IO pin and other parts of the chip through overheating, but you also then operate outside the specifications for the logic levels which can cause things that you are communicating with to not work right.

1
  • You are correct, the relay is a module board identical to that of the SainSmart 5V. Thanks for the detailed reply.
    – Bataleon
    Commented Nov 7, 2015 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.