Voltage drops on digital pin when switching a relay

Hey community,

I am not an expert in electronics, so I hope you can help me out here a bit.
I use an Arduino MKR 1010 Wifi which is running smoothly and well connected to the Arduino Cloud (fingers crossed after weeks of struggling).
I want to turn small 12V peristaltic pumps on / off using a 3V relay (cheap stuff from Amazon, but that should not be the root cause) and the digital I/O Pins of the Arduino (hereafter referred to as "D4").

The following picture shows you the approximate circuit diagram:


EDIT: wrong picture uploaded, Relay VCC is supplied with 3.3V

My Problem:
I measured the voltage between Arduino D4 HIGH and GND with exactly 3.291V. As soon as I connect D4 to the relay, it does not switch and the voltage between Relay IN and GND drops to 2.59V.
Now it gets confusing for me: I also tried VCC from the Arduino, which also has 3.3V. By connecting this to the relay, it switches and works as expected. The voltage can then be measured between Relay IN and GND with 3.3V. No voltage drop in this case.
Do the I/O pins not deliver a stable voltage that I can use to switch relays or SSDs?

What are you using to switch higher loads with your SAMD board (3.3V on the Pins)?

The Relay from amazon: [https://www.amazon.de/gp/product/B083KGRRX6/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1]
The datasheet is only partially in english..


Thanks in advance!

What kind of relay are you using ? (post link or picture)
The output pins of the MCU have a limited current they can provide. Normally higher loads are switched using a transistor or an Opto-coupler.

Do your relays require 5v to switch them?

OP claim

By connecting [3,3V] to the relay, it switches and works as expected.

And what explain the voltage drop?

@riffelblech are you using a relay or a relay module?

a7

My mistake, I have wired it correctly with the 3.3V but I did the drawing wrong. I edited the post with the correct drawing and additional information about the relay.

Working current 65mA... this may be the issue... as the GPIO pins cannot provide this much current.

You may need a transistor switching circuit to use with this relay.

Thanks for the answer, that should be it...

It also says auslösestrom (Trip current) = 3ma... so it's a bit confusing... as I would expect this is the current needed at the IN pin.

I note that the relay has jumpers and saw this note on Amazon...

  • Jumper Caps - You can freely choose whether the relay and signal share the same power supply or not by removing the jumper caps on the pins. It is recommended to use the same power supply as this is more convenient to use.

I'm not sure what this means but you could try changing the jumpers and see what happens?

I removed the jumpers and connected Arduino VCC 3.3V to the relay. The LED, that should tell me whether the relay is aktive or not, is on, but the relay does not switch. Doesn't matter which jumper I remove.
The same happens when connecting 5V to Relay VCC and 3.3V to the Relay IN

I also assumed the 3mA to be the relevant current for switching this thing successfully, but it seems not to be the case. As far as I know the pins should be fine with 7mA on the MKR1010 (that's what the schematics tell me).

Where does the 3.3V, 65mA current for the relay coil come from?

Skimming through the SAMD21 datasheet I noticed the IO pins are highly configurable including "driver strength" which can be set "normal" or "strong". The strong setting is 7mA, don't know the normal setting (may be less than the 3mA the relay opto requires).
No idea how Arduino IDE sets up the pins, OP didn't show code.

Yes, agree with @JCA34F. It looks like the default setting is 2mA (source) and 2.5mA (sink) ... so not enough to drive the relay IN pin.

After a bit of Google looks like the solution is to force it to use the "strong" setting (7mA source, 10mA sink).

as per...

pinMode (pin, OUTPUT);

PORT->Group[g_APinDescription[pin].ulPort].PINCFG[g_APinDescription[pin].ulPin].bit.DRVSTR = 1;

Thanks for this suggestion! I will try it and give you some feedback afterwards.

Big news! @JCA34F and @red_car were right with the point that the current was too low in normal mode. I added the line of code from above and now the relay works without an additional transistor.
Big thanks to you for your effort on this topic :slight_smile:

:+1:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.