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)?
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.
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.
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.
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