Relay module wiring

I'm using a WPM400 relay module, the schematic is here:

I will be using this to switch 230V solenoid valves, but I have an Arduino Nano ESP32, which is a 3.3V MCU, and this relay needs 5V. I just want to make sure my wiring is correct:

Relay VCC - ESP32 VCC
Relay GND - ESP32 GND
IN1-IN4 - ESP32 GPIO
(Remove jumper between COM-GND)
COM - External 5V supply
GND - shared GND between 5V supply GND and ESP32 GND

The ESP32 GPIO are connected to S8050 transistors, which I will be using to drive the relays IN pins.

Does this seem correct?

EDIT: ChatGPT is confusing me a lot with this- it keeps contradicting itself and forgetting the schematic, which is why I said relay VCC - ESP32 VCC (ChatGPT said to do this), which is most likely wrong

Far from it.

Relay VCC <- 5V
Realy GND to ESP GND AND 5V GND
Keep jumper ON
Connect relay IN pins to ESP GPIO

If that does not work then you will need to add a 74ACT244N between the ESP outputs and the relay inputs (IN1, etc)

The part number of the relays (SRD-12VDC-SL-C) indicate that they are 12V relays.
Are these what is fitted to your relay module?
If so then you will need a 12V supply which you would connect to VCC and GND.

The schematic is from Whadda or Velleman.
Velleman quote " * control input voltage: 5 – 12 VDC" and the operating manual also gives 5V DC as the module input voltage.

Confusingly, there are images of the module showing 5V and 12V relays.

I would agree, if I saw 12VDC printed on a relay, I would be using 12V. Chances are, it might work at 5V DC.

That optocoupler circuit doesn't leave much room for guessing. You connect ESP gpio-pins to IN and ESP gnd to COM.
Only doubt is if 3.3V is sufficient to turn on the optocoupler (at ~2mA). It's safe to try .


And If the nameplate of the relay says 12V, that's what you need for VCC.

But how do you deal with this? Solenoid is definitely inductive load.
"relay output: 250 VAC, 10 A; 30 VDC, 10 A (non-inductive)"

If you have further questions just ask.

I got it working, I just needed to add 5.1K pull-up resistors for each external S8050 to 5V. Ran into another fun issue after that (one of the transistors was faulty but was fine in diode testing etc). Thanks for confirming that the wiring was incorrect!

I'm using my own S8050's to switch the relays. It says 12V there for some reason but they are 5V (it says on the actual relay SRD-05VDC-SL-C).

But how do you deal with this? Solenoid is definitely inductive load.

I'm using 8W solenoid valves, which means (at 230V) they are about 35mA each. I'm staggering the relay switching so I'm not switching all 3 at the same time, and I have an RC snubber on each relay contact. I have a 2A anti-surge fuse in my mains plug too. Max inrush I'll get is about 350mA per solenoid.

The actual relays say 05VDC on them so I'm assuming they are what they say they are!

Weirdly enough, they aren't 12V relays. I have no idea why whadda/velleman have 12V in their schematic, when they say "SRD-05VDC-SL-C" on them.

That will not work!

See post#2

what do you mean not work? All the solenoids open and close now- the relays do switch with my current setup.

Is the base of the transistor connected through a single resistor to the ESP with no other connections to the base?

Hope you are not still using chat for schematics.

ESP32 -> 2K -> Base
Collector connected to IN pins and 5.1K pullup to 5V supply
Emitter GND

I see what you are doing. A little backwards but if it works it works.
Have a nice day!

it it ain’t broken don’t fix it! You too

Thanks for the schematic. What do you use to create schematics?

  • For this example, I used the graphics editor Techsmith Snagit.
    Simply coping and pasting elements from elsewhere.

  • Kicad and EasyEDA are two FREE online versions of real schematic drawing packages.