Connected to multiple relays but only work one at a time

MattCalder
Posts: 1
Joined: Sun Jan 24, 2021 6:39 pm

Connected to multiple relays but only work one at a time

Postby MattCalder » Sun Jan 24, 2021 6:50 pm

I'm connecting an ESP32 to 4 of these relays:

https://www.amazon.com/Onyehn-Channel-O ... op?ie=UTF8

I'm connecting pins 18, 19, 22, and 23 to the logic inputs of the relays.

I'm connecting the relay power to the 3.3V (I've also tried the 5V connection) and ground to a ground pin of the ESP32.

I'm powering the ESP32 using the USB connection.

I've connected the other sides to 110V AC power outlets and plugged lights into the outlets in the normally open configuration.

When I activate the relays one at a time, or two at a time, everything works correctly. However if I try to activate all of the relays at once. invariably one of them doesn't work. If I activate three, mostly they all work, but sometimes only two work. When I say "work" I mean the AC side light does not come on. The relays trigger, I can hear them click, and their leds are on.

The behaviour makes me think that the ESP32 doesn't have the power to keep all the relays energized, but I see several demonstrations online that suggest it is possible. Also from what I can gather about the relays their current demands are pretty small.

Does anyone have a suggestion for me as to what I may be doing wrong, or what I may be missing? Thanks, let me know if I can provide additional information,

Matt

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: Connected to multiple relays but only work one at a time

Postby ESP_Sprite » Mon Jan 25, 2021 1:33 am

Only reason I can think of is that the 3.3V line you feed these boards from is somehow inadequate. Where does that power line originally come from?

becorey
Posts: 92
Joined: Sat Mar 28, 2020 4:18 pm

Re: Connected to multiple relays but only work one at a time

Postby becorey » Mon Jan 25, 2021 6:48 am

The esp32 high level source current rating is 40 mA (typ).

The Songle relay SRD-03VDC-SL-C says the typical coil current is 120 mA. The board you're using with the relay mounted on has one 3 terminal component that is possibly a transistor or mosfet to help you with power. Also an optoisolator. Try to read the component markings and look up the parts. Ideally if that module is made well it's not drawing much current from your input pin.

Running 3 or 4 of those relays then is at least 360 mA draw from your 3.3v supply, fairly significant. That's probably more likely the issue than the esp32 source current rating. Are you using a dev board with an LDO?

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: Connected to multiple relays but only work one at a time

Postby ESP_Sprite » Tue Jan 26, 2021 1:06 am

@becory: I don't think the ESP32 pin current output capability the issue; if you look at the picture of the board, it actually has an optocoupler and a transistor to drive the relay coil itself. Agree that that 3.3V line going to all relay boards probably gets pretty loaded when multiple are switched on, though.

Looplogsend
Posts: 3
Joined: Wed Jan 27, 2021 8:48 pm

Re: Connected to multiple relays but only work one at a time

Postby Looplogsend » Thu Jan 28, 2021 3:25 pm

Hi,

From the spec I found for this board, each relay need 65mA @ 3V to work. The 3.3v pin of the ESP can't provide 4x65mA + some current for the logic pin triggerring.
What you need to do is the following:
1- power the relay with a external 3.3v power supply.
2- limit the logic current provide by each GPIO pin to just a bit higher than the minimum required to trigger the relay. From the spec I found, the relay will turn on if you put >3mA on the trigger pin. A good practice is to put 1k resistor in serie between the esp pin and the trigger pad of the relay to limit the current out from the gpio. 1k should work since 3.3v (your logic level) / 0.003A (the trigger current required) = 1100 ohm (1k), but to be sure it trigger each time, you migth have to go to 470 ohm since each relay may be trigger with slightly more or less current.
3- If this is the only thing you do with the esp power then you can also forget about the 1k resistors (it's more for protecting the gpio pin from excessive drainage). They can supply 40 mA each so the 3-4 mA is far from a lot for them.
4- IMHO you are doom to have an external PSU for this sorry to tell you!
In those situation, I usually buy a relay that work at the same voltage as the load. For example, if I want to turn a 12v motor on and off with the relay, I use a 12v relay. This way you can power the relay triggering electronics from the same PSU as for your load. In that case, just make sure you share the 12v ground with the ESP ground somewhere otherwise the triggering may behave erratically.

Who is online

Users browsing this forum: No registered users and 77 guests