16 channel relay to esp32

I've been trying to build a home automation system with an esp32 for a while now, but all of my attempts have failed. I saw on YouTube that many people were using a 16 channel analog multiplexer to control 16 relays with an esp32, and I was wondering if I could connect my 16 channel relay directly to my esp32 without the multiplexer.(im also using an ir reciever with it to add ir remote controll)

1 Like

A 16 channel relay module without some kind of other device between it and the ESP32 will require 16 digital pins to control it

How many spare GPIO pins do you have on your ESP32 ?

Can You show some technical documentation for that relay set?

25 gpios

i dont think there is one for the 16 channel relay board i have

How did You get to know about it?

i just bought it from the nearest electronics store from my house .

Did you check the logic level compability between ESP32 and the selected, unknown relais board?

My best guess is you have a 16 channel relay card like this one. Most of these cards use relays like this one. Now if all of that is correct then it comes down to exactly as mentioned:

You will need one pin of digital out for each relay so 16 channels 16 digital out. Your board will need a separate 5.0 VDC supply because the relay coils on the 5.0 volt board draw about 89.3 mA each when the relay is active. Wing it and 16 active relays at let's say 100 mA each will draw about 1.6 amps. :slight_smile: A close look at the board I am guessing you have reveals a pair of ULN2803 Darlington Arrays driving the relay coils. Each is 8 channels.

People like to use a MUX simply to reduce the number of digital out pins required.

So your choice a MUX or 16 digital out channels.

Just as a side note the relays are active low on the link I used.

Ron

well it looks similar to this relay board

in mine the capacitors are missing and I am pretty sure that it is compatible

heres a picture of it

it looks more similar to this

but in mine the capacitors are missing

actually here's a picture of it

Are you saying that you have 25 spare GPIO pins on the ESP32 board that you are using ?

Does that include pins 34, 35,36 and 39 ? Which ESP32 board do you have ?

I have a DOIT ESP32 DEV KIT V1.

You have a ESP32 module with 25 pins that can be used as outputs ?

Which one ?

it has 30 pins and 25 gpios rest are gnd vcc and en

False economy! Do you replace the entire board when one component fails?

nothing has failed yet so i dont know about that

Ah, but you will before too long!

Hope you are testing EACH relay before putting much effort into the final product.

i need the thing to work at first then i will think about that

i have tested all the relays and it worked fine

Most all of the ESP32s I have seen have 26 available IO pins.

34,35,36,39 are input only.
1 and 3 are for the serial upload
0 is for the boot\upload switch
12 is used to select Flash voltage, avoid using if possible

I excluded 6,7,8,9,10,11, these are used by the Flash.