Relay

Hello!

I am quite new to relays. I bought this relay: https://nl.aliexpress.com/item/32708600505.html?spm=a2g0s.9042311.0.0.6af74c4dNfQSRB

Now I read "Trigger Model: low level, voltage values between 0-1.2V". If I connect an arduino output directly to the trigger, it will give 5V. Isn't this too much for a relay like I bought? Should I use resistors?

Kind Regards and thank you for the help.

5V is probably OK but you never know when you buy cheap stuff from aliexpress, eBay, Alibaba, or 3rd-party Amazon suppliers, etc. If you buy from a reliable supplier you should get full specs/documentation.

Do I understand it well:

0-1.2V = relay off

1.2V = relay on

Thank you for your response. I understand that Aliexpress is not a reliable partner :slight_smile:

Your Aliexpress link corrected: https://nl.aliexpress.com/item/32708600505.html

OK, this module has "Low level trigger" printed underneath.

This is a well-known module and no reason to believe it to be in any way unreliable. Note the protective cutout around the common terminal. Here is the circuit for it:

The relay will actuate if you pull the input down to something like 2.5 V or less, that is LOW with an Arduino pin set to pinMode of OUTPUT. Set to HIGH (or INPUT), the relay will not actuate.

Note that if your code sets pinMode to OUTPUT before digitalWrite to HIGH in your setup() code, the relay may actuate briefly as your code boots up, you should digitalWrite HIGH first if you do not wish this to possibly happen.

Paul__B: How nice of you giving me all that information. I am really glad with it. I am very unsure, so I would like to have some additional information.

One Arduino UNO R3 will control 3 separate relays:

My concern: I think that I am dealing with 3 possible AC-devices that can cause voltage spikes. So a diode won't help, I guess...

Question 1: Are voltage spikes a possible problem with the relay I bought and the three devices I am using?
Question 2: What can I do against it?

Then I have some more questions:
Question 3: Do I use a resistor from Arduino to the trigger from the relay? Is that possible, necessary, unnecessary?
Question 4: I read before that I should put a resistor from the digital pin (signal) to the ground if I am dealing with multiple circuits. I read this when I was looking for MOSFET transistors and solenoid valves on 12 V. I don't know if it is a good idea to use it now as well.
Question 5: Is this a so called optocoupler or does it work with a magnet?
Question 6: How many of those can I attach to an Arduino UNO. I know the trigger current is only 5mA, but maybe the overall consumption is much more?

I know I ask many question. I would like to express many thanks to everyone helping me out.

dimi2710:
Question 1: Are voltage spikes a possible problem with the relay I bought and the three devices I am using?

The relay module has a diode across the relay to suppress "voltage spikes" from the relay coil itself. The devices you are controlling however are a potential source of interference as they are switched on and off.

dimi2710:
Question 2: What can I do against it?

It is most important to keep the mains (or other controlled power) wiring to the relay contacts completely separate from any of the microprocessor or control circuitry and always wires to each part of the circuit must be paired together, supply with return or control with return. You may need to fit "snubbers" across the relay contacts or the switched devices themselves.

dimi2710:
Question 3: Do I use a resistor from Arduino to the trigger from the relay? Is that possible, necessary, unnecessary?

Did you notice that such a resistor is already in the circuit I provided?

dimi2710:
Question 4: I read before that I should put a resistor from the digital pin (signal) to the ground if I am dealing with multiple circuits. I read this when I was looking for MOSFET transistors and solenoid valves on 12 V. I don't know if it is a good idea to use it now as well.

Can you tell where you read this? Without context it has no meaning. You do not do things without understanding why you are doing a particular thing, :roll_eyes:

dimi2710:
Question 5: Is this a so called optocoupler or does it work with a magnet?

Is what either of these?

Your relay module does not include an optocoupler. Some do.

dimi2710:
Question 6: How many of those can I attach to an Arduino UNO. I know the trigger current is only 5mA, but maybe the overall consumption is much more?

The UNO, if properly powered can drive a total of 100 mA to one 8-bt port. That would allow you to drive 20 of these relay modules at 5 mA each.

"Properly powered" means by a proper 5 V supply to the "5V" pin or the USB port for prototyping, not the "barrel jack" or "Vin" which you should definitely not attempt to use.

The relay modules themselves must be powered by that same properly regulated 5 V supply, their power supply has nothing to do with the Arduino.

Many thanks for all answers!

Q3: indeed! So that’s why it is only 5 mA

Q4: Controlling a Solenoid Valve from an Arduino. Updated. | Martyn Currey —> section Circuit using IRFZ44N Mosfet

Q6: I wanted to use a 9V 1,5A adapter with the barrel jack and hoped I could use the 5V pin from the Arduino to feed the relay, but (A) probably a relay would draw too much mA from my Arduino 5V pin (is max 500mA??) ? (B) How much mA would every single relay draw from arduino (90mA??) ? (C) Is a relay always drawing current even if not used or is the current that it draws neglectable if it's just on, doing almost nothing?

What are the disadvantages using the Barrel Jack of the arduino? I know that arduino regulates power itself, but (D) is this harmful to my project?

(E) Why would USB power through usb only be for prototyping? Aren't you protected for overcurrent in that way?

(F) Good idea? : I could use an iPhone charger (1A) or an iPad Charger (2A). Arduino will ask 500mA max. (G) Could I also feed my relays with the same iPhone/iPad charger: through the 5V pin or directly from charger: would both work?

I found another 5V relay that supports both low and high level (https://nl.aliexpress.com/item/4000356150750.html). I think high level would be better for my project. Thanks to your contribution I understand now high/low level. My question (H): Is this also a well-known module with no reason to believe it to be in any way unreliable. Does it have a similar protective cutout around the common terminal like the first relay i mentioned in this thread? I do see the same components on board, I guess. 102 102 102 (resistors?), diode, transistor? (I) Is this a conventional magnetic relay? Because in the title (Dutch translation) they mention Optocoupler and in the section "Specs" I even read Solid State Relay...

I put letters from A-I, to make it more easy to react.

Kind regards from Belgium. I do appreciate this.

Now I am searching info about snubbers :slight_smile:

Not playing the letters game! :roll_eyes:

Lesson on the useless "barrel jack" below. :grinning:

Nothing wrong with using a "Low level trigger" relay module - most available modules are. You just need to know how to code it as I pointed out

The "selectable" module you cite has an opto-isolator which if wired appropriately using the pins where the jumper is shown, can be an advantage but you have to know how to wire it. It is most certainly not a "Solid State Relay". As you see, it has the safety cutout!

"Stock" explanation:


A very real danger is that the obsolete tutorials on the Arduino site and others misleadingly imply that the largely ornamental "barrel jack" and "Vin" connections to the on-board regulator allow a usable source of 5 V power. This is absolutely not the case. It is essentially only for demonstration use of the bare board back in the very beginning of the Arduino project when "9V" transformer-rectifier-capacitor power packs were common and this was a practical way to power a lone Arduino board for initial demonstration purposes. And even then it was limited because an unloaded 9 V transformer-rectifier-capacitor supply would generally provide over 12 V which the regulator could barely handle.

If you are asking this question, it is highly likely that you will wish to connect something else. In which case, the answer is regulated 5 V.

This is because the on-board regulator is essentially capable of powering only the microcontroller itself and no more than a couple of indicator LEDs. The on-board regulator might be able to power a few other things if it had a heatsink, but on the (older) Arduinos, it does not.

Powering via the "barrel jack" or "Vin" connections is asking for trouble. The "5V" pin is not by any means an output pin, if anything a "reference" pin but most certainly the preferred pin to which to supply a regulated 5 V.

Interesting explanation. I won't use the barrel jack knowing this.

Would the idea of an iPad charger attached to the USB-input of the Arduino be a bad idea as well? This was my favorite, I would use the iPad charger to power the Arduino and the relays.

Would you consider an iPad charger as a regulated 5V source to attach to the 5V pin? I could buy a 5V module on Alibaba, but I have more trust in an Apple charger.

Kind regards and many thanks!

An iPad charger is certainly in the category of "phone charger" and if marketed by Apple, should be considered a quality product. The problem is that many things advertised for the purpose may be of inferior quality, so it is best to use branded products sold by reputable dealers and which have genuine regulatory certification for fitness of purpose.

Mind you, the iPad is - if I am not mistaken - connected by a "Lightning" connector rather than a USB connector. :grinning:

If you power the UNO via the USB port, there is a FET switch and a "polyswitch" between that and the '5V' pin which is actually supplying the microcontroller, so the voltage at the '5V' pin may be a little less and the "polyswitch" will not permit much more than 500 mA to be drawn over time. For systems drawing more current than this, you do need to connect the 5 V directly to the devices to be powered by the 5 V and connect that also to the '5V' pin.

For systems requiring several Amps at 5 V, the supply modules with the perforated metal covers (which must be grounded to the power mains ground) sold by Aliexpress and such are generally going to be satisfactory.

Thank you very much for the answers. This really helps me a lot!

The apple charger hast two parts, so you can put a regular USB cable as well :slight_smile:

Brand chargers: even Samsung charger would do the job :slight_smile: :slight_smile:

Thank you for the remark: common ground. I know this is not common knowledge, but I know at least this :slight_smile: