I designed a really simple custom PCB which uses an ESP32 to control 4 relays and a Wiznet 5500 LITE to read a sensor values over Ethernet.
1 relay controls a 24V Omron relay which controls a large load (400V+).
1 relay controls a Red and Green LED lights (12V)
1 relay controls a dry contact to activate a sliding door
1 relay controls an overhead light 220VAC. (Straight through)
The board is powered using a 24V power supply which gets step down into 5V using the OKI-78SR-5.
The Red and Green LED lights is powered using the same 24V which gets stepped down into 12V by a separate step down converter (something like this:
https://www.amazon.com/Converter-Reducer-Regulator-Adapter-DC15-40V/dp/B01EFUHFDU).
Initially, the issue I faced was when I turned off the Omron relay, my board may restart. I managed to fix it by powering the board using the 12V step down converter (Powering the LED). I am unsure why this happens even though I have the flyback diode(1N4007) at the relay which should prevent any backward EMF.
Even though the first issue was fixed, is there a way to share the same 24V supply?
The current issue I encounter is with the WIZNET 5500 module. Sometimes after 1-3 cycles or sometimes > 30 times of activating the Omron relay, and overhead lights, the WIZNET 5500 module fails to initialize which prevents me from reading the sensor values. A soft reset of the WIZNET 5500 module doesn't help, but restarting the whole ESP32 module seems to bring the WIZNET 5500 back.
From these signs, I suspect there could be some electromagnetic interference (from the loads) which affected the ESP32.
Another possible issue could be my relays are not isolated. (I read that I should power the relay with an external power source rather than from same power source of the ESP32).
As the PCB is deployed somewhere else, I made a small setup to try replicate the issue. However I didn't manage to replicate the issue. Hence for now I can only come up with all the possible issues and try to implement them when I head down the next time.
I have attached my schematic and PCB layout.
Any suggestions or critics are welcome as I am trying to improve everyday.
Thank you.
Update 1First of all, thank you all for the comments and suggestions. I took sometime to digest all of them and made sure I understood all the suggestions.
I have came up with an updated schematic and PCB board and attached to the same post.
1. Current limiting resistors for BJT transistor base
After reading up, I added a 1Kohm resistor at each I/O pins. Using the formula below I should have a safer current
(ESP32 Pin Voltage - MUR160 Diode forward Voltage) / Resistor = Current
(3.3V- 1.25V)/1Kohm = 2.05/1Kohmz = 0.00205A = 2.05mA
2. 1N4007 are slow diodes
I watched a video on "What is a schottky diode" (youtube.com/watch?v=bXEyCf1P0UU) and at 2:32, he showed a comparison between a slow diode (1N4007) and a faster diode (1N5817). Indeed the 1N4007 had issues with clearing the back emf. Hence I have changed my diodes to the MUR160 as recommended by Manul.
3. Missing grounds
I connected all grounds and added a ground pour on both layers. However, I am not sure if I should cover the whole board or just under the ESP32 portion?
4. Decoupling and Bulk capacitors
Thanks Doctorandus_P, viperidae and DTJ for bringing up adding decoupling and bulk capacitors.
In this round, I have changed the DC-DC converter to a RECOM R-78E5.0-1.0. (
https://www.mouser.sg/datasheet/2/468/R-78E-1.0-1711201.pdf) It's similar to the Murata.
Referring to the datasheet, I see there is 2 sections. The first is "EMC Filter Suggestion according to EN55032" and second "Standard Application".
I followed the "Standard Application" for now. Is there any significant benefits if I follow the "EMC Filter Suggestion"?
The "Standard Application" recommended 10uF and 10uF. I chose 35V for the decoupling capacitor and 10V for the bypass capacitor. I chose those values as 35V>24VIN and 10V>5VIN.
DTJ mentioned that I should add 1nF ceramic, 100nF ceramic and a 10uF 10V in parallel to the Power Pin of the ESP32.
I was thinking if it is really required when I have added the bypass capacitor on the 5V rail.
5. 400V load concerns
I understand the safety issues and concerns with driving high voltage loads.
In the circuit, the "LOAD" is a 24VDC OMRON Relay. This 24VDC OMRON Relay will control a high voltage load (~400V).
Hence it is not the blue squarish relay which is controlling the high voltage load.
All the 5V relay is only controlling voltage <= 24V loads.
Update 2The board finally arrived and I have soldered it together. After testing, it does help prevent the board from crashing when the overhead lights turn off.
However, the W5500 board keeps crashing after the load/light is turned on/off. I will have to reinitialize the W5500 everytime. Now I'm suspecting when the load / lights are turned off, it causes EMI.
This EMI causes my PCB to mess up its signal. Anyone can suggest or advice how to solve this?