I'm building environment control box. One of the functions of this box is to control humidity and temperature using exhaust fan. I'm using ESP32-WROOM-32D devkit and 5v 6-way opto-isolated relay module:
i2c bus is used for RTC and sensors, which are powered by 3.3V voltage regulator. All circuit is powered by 5V meanwell PSU. ESP32 gets it's 3.3V from devkit's voltage regulator (later i'm going to use standalone ESP32 module and power it from voltage reg.).
The problem is that when controller switches on fan, it occasionally resets or even stucks. Watchdog can not handle that. Output on serial monitor is unreadable. If i make it turnining on and off every 5-10 secods, it happens very soon. If it's once in few minutes, it happens once a day or two or even week. When i disconnect fan from relay, problem goes away.
So it's definetely fan. And it seems that it's sort of interference going to MCU.
So my question is how to protect my circuit from that? I've already seen recomendation to use separate PSU, but relay module uses common ground for optocouplers and relay so it seems that cirucuit won't be 100% isolated.
I would highly appreciate any advise on this issue. I'm relatively new to electronics, so probably, the answer is somewhere nearby
Many relay modules are set up to provide 5V to the optos and don't need ground - you turn on a relay by pulling its pin low. Then the relay coils can be powered separately. Which relay board do you have?
The green wire is 5V to one side of the optoisolators and the signal from the ESP32 drives the other side of the optoisolator. I take it the green wire is the power for the optoisolators input side and that's 5V. The ESP32 is a 3.3V device. That is, to me, a not good thing do.
No schematics, but i've checked with tester. There's a 2.2k resistance between ground and cathode. And clearly seen 2.2k resistor on board. There's also zero resistance between anode and control pin (3.3v coming from ESP32 - white wires on photo). Between 5v and optocoupler there's nothing on control side. So ESP drives control side of optoisolator with 3.3 and current goes through it and 2.2k res to common ground.
But the jumpers are in the "High level trigger" mode, so the optoisolator input side references to ground, not 5 V.
Even if it was referenced to 5 V, the voltage drop of the isolator LED would put no more than 3.8 V on the ESP. On the common "Low level trigger" modules, there is a green LED in series with the opto-isolator so you must connect "VCC" to 5 V as it will not work with 3.3 V.
It does not. It has jumper that switches (as described in manual) control voltage from low range (up to 1.8v) to high range (3 to 5v). As I understood from testing, it actually connects opto to 5v instead of ground.
I've made some tests today. Used varistor and snubber made of X2 1uF cap and 60 ohm resistor. Seems, that snubber at least partly solved the issue. I still have to make some tests during the next days.
My question now is how to properly calculate resistor value, power and capacitor's capacitance? Expected load is up to 10A and 230V.
Hello, i am facing same issue, even when I use a 12 v optocoupler relay (GND in common with esp32 power). Did you find a solution please?
Thanks for your hints
A