Electronic – ESP8266 loses wifi connection on switching a load

esp8266microcontrolleropto-isolatortroubleshooting

I am trying to switch a roller shutter belt winder (RADEMACHER RolloTron Basic 1100) with an AI-Thinker ESP8266 ESP-12E module. As software ESPhome is used.

Most of the time the ESP8266 loses its wifi connection on triggering the open or close function. Often it does only one action. Sometimes I can open or close 2 – 3 times before the wifi is gone.

I already tried a lot of things and now I am running out of ideas:

  • Ok, probably a overload/interference on GPIO12 or 14 => Disconnected them and pressed the button on the unit instead – same problem
  • Then it is a problem with the power supply => A D-Sun 3Ampere step down regulator should be enough. Just to be sure I also added a 33uF and a 10nF capacitor (the ones visible in the picture.) I even tried 470 uF across the terminals – no effect. Also I could not see any obvious peaks on the little DSO138 oscilloscope (I know, it's not the best for this job.)
  • Sure it's not the power supply? Ok, power the ESP by battery – same effect
  • Is the chip entirely down? – I programmed GPIO13 to also trigger the down button. If the wifi is lost the down button is correctly triggered on adding a pull up resistor to the GPIO13. So it is indeed only the wifi that's gone. Furthermore I added 10nF ceramic capacitors to CH_PD and RESET to ensure this pins are kept high, also without success.
  • Its a bug in ESPHome? No: the same happens with Tasmota
  • The signal is too bad. Moved directly in front of the router and also disabled non-standard temporary – same problem
  • Played around with shielding (aluminum foil wrapped in tape) – did not help.

Update 1:

I did tests with another battery powered ESP-12E that has no connection to the shutter winder. The wifi issues are starting at distances around 5 cm (1.95 inches). 10 centimeters away the second esp is working just fine.
Also i noticed resets around every 10th time a shutter button is pressed (the ESPs led was blinking once)

Furthermore i tested the other way round with the original setup:
If the opto-isolator are disconnected and the wires are just connected to
two leds there are no issues – even that close to the shutter winder. The leds can be switched over wifi without resets or wifi issues.

So it seems to have to do with interference (probably caused by the big relays inside the device or by the motor). But how can such a problem be solved without moving the esp outside of the case?
The rollotron and the ESP are already connected to a shared ground.

Update 2:

Today i wrapped the ESP8266 in isolated but grounded aluminum foil and only left the antenna sticking out on the bottom. That did not make things better but i had the feeling that things improve very much if i have my finger on top of the foil.

Here is the module:

enter image description here

Used components:

  • GPIO12: TLP621 opto isolator with 243Ω resistor on the anode for the up button
  • GPIO14: TLP621 opto isolator with 243Ω resistor on the anode for the down button
  • 9.1kΩ pull-up resistors on RESET, CH_PD and FLASH
  • 9.1kΩ pull-down resistor on MTD0 (GPIO15)
  • The ADC pin has a LDR with 10k resistor as voltage devidor (on 3.3 vcc)

Does anyone have further ideas how to solve or troubleshoot this issue?

Diagram:
enter image description here

Best Answer

I solved the problem by rewiring. Everything is still wired according to the diagram above but with the following changes:

  • Moved the step down regulator further away from the motor. (It is now below the esp due to a lack of space
  • Rotated the esp and moved it into the edge as far as possible. This way it is further away from the motor and the wires to the opto-isolator as well as the wire to the light sensor is not as close to the antenna as before.
  • Reduced the amount of wires by connecting everything (opto-isolators and step down converter) to the nearest ground point of the rollotron board instead of running all wires to the bottom and connect them there

What i don't know is, which measure was the important one.

Tip: Don't waste your time with grounded shielding. It is not worth it.
I stumbled across another topic: If you create a DIY project with a motor ensure that you have a capacitor across the terminals of the motor. You can also add capacitors from both terminals to the case to reduce noise. (The rollotron uses such a technique already)

Here is a picture after rewiring:

enter image description here