I designed a controller with the ESP32 devkit board, and after a bit of issues with the TFT display extension cable I managed to get the controller working. Now it was time to wire up the control panel and make sure everything worked out. The idea is to have everything in one place, so the control panel stores the ESP32 board but also a contactor for a 3 phase blower motor and a 1 phase contactor that shuts the whole system down if a maximum temperature is reached. With this in mind I used shielded cable for the components that are not within the board, but while testing I've found that the display and digital outputs fail when both contactors are closed.
Here's a diagram of the system:
Here's a picture of how everything looks installed, it looks nitty when the wire duct is closed of course.
I am thinking that the solution might be filter capacitors, but I am not sure how those would be wired up on the SPI connections of the TFT display and the shift register digital outputs for the solid state relays board. Here's a diagram of the wiring of the controller board.
I did try grounding the shielded wire to the control panel steel enclosure (which is grounded to earth), and sometimes the display and register outputs didn't fizzle when closing the contactors, however I need the system to work reliably.
Also, when I first tested the controller board I couldn't get the TFT display to work because the extension cable was acting like a transmission line, and as such the signal pulses were distorted. Filter capacitors might reverse the work I did with the resistors, so that's something to consider I guess.
As a general comment on your pretty looms: separate power from signal lines and use twisted pair cables for signals. Ribbon cables with every other wire grounded are fine for signals as well.
What are you using for power?
Are there anti kickback diodes across the solenoids? You MUST have them.
Given that I use wire duct, what would be considered a good separation between signal lines and power lines? I guess by using a bigger enclosure I could use different routing for power and signal, but isn't it common that on industrial panels both power and signals are inside the same wire duct? Also, what about shielding for twisted pair cables? The display is using a foil shielded TP and I actually conducted testing with the cable outside from the wire duct, and it still fails when the contactors are actuated.
For power meaning the L1, L2, L3 lines? Those are mains voltage, which is 220V phase to phase in my country (or 127V phase to neutral/ground). For the ESP32 controller I am using a 12VDC meanwell industrial power supply.
I am using a fairly common 8 channel solid state relay board, which apparantely (I hope they aren't knock offs) uses Omron solid state relays, which according to the data sheet include a snubber circuit
The load terminals are internally connected to a snubber
circuit that absorbs noise. However, if wiring from these
terminals is laid with or placed in the same duct as highvoltage or power lines, noise may be induced, causing the
SSR to operate irregularly or malfunction.
I actually had a separate post to see if these relays are adequate for driving solenoid valves, since they are zero-cross and have a snubber circuit, and will also drive low power solenoids (500mA operating current) with the on/off cycle being a minimum of 60 seconds, they should be fine.
Oh, by the way, the testing I've done has been without loads, so no 3 phase motor or solenoids valves are connected. It's the action of closing the contactors that generates EM waves which interfere with the SPI signals of the TFT display and shift registers.
Power lines for the controllers and sensors are not critical. It may help to enclose the controlling modules in a metal (shielded) box with filtered and protected connections to the outer (powerful) world. Professional control systems use 12V or 24V signals for improved signal/noise ratio.
Normally EMF is generated by opening contactors (inductors, solenoids). Closing without load should do no harm unless the power supply is too weak. How much current is required to drive the contactors?
Hi,
No it isn't, also the controllers used are industrial grade devices, with inbuilt EMC and line filtering and isolation devices.
For example, inputs and outputs are usually opto-isolated, this helps remove most noise problems.
You are also using 5V digital devices without any shielding such as metal case or enclosure for the Arduino circuitry.
Tom...
"real" industrial control runs on 24V, not 5V. Also, mount the Arduino and all associated parts in a box INSIDE the panel. This will act as a Faraday cage and shield everything.
Is there a way to use 12V or 24V signals with a ESP32? I've used level shifters for 3.3V to 5V, could 12V level shifters on the ESP32 and the TFT display be a solution? I did think about building a metal box to act as a faraday cage, however one of the reasons of using the ESP32 is it's wireless communication ability. I plan to send data using the built-in antenna...
The contactors coils are 220V and 127V respectively, so they are connected to mains via a start/stop push button setup. I measured 100 mA maximum on both contactors, though they stabilize at around 20 mA.
Did the OP try putting a 47uf tantalum electrolytic cap and a 103 ceramic cap on the 3.3V pin? Make sure to hang the caps as close as possible to the 3.3V pin.
As a note, the ESP32 has 2 SPI busses. Typically each SPI bus can drive 3 CS lines.
SPI Master Driver - ESP32 - — ESP-IDF Programming Guide latest documentation >>>>
"Each bus has three CS lines to drive up to same number of SPI slaves."
The ESP32 has 2 I/O ports. portA and portB. portB is input only. portA is GPIO_NUM_XX where XX is <33. Using GPIO_NUM_33 as an output will not properly work using the GPIO API. Pin33 can be reprogramed to act like a portA pin using the GPIO_RTC API.
As seen in the picture, I have three components outside the perfboard: the TFT display, three pushbuttons and the SSR 8 channel board. The TFT uses SPI communication at 3.3V logic, which I send through the CAT shielded cable. The pushbuttons are input pullup, and I use shielded cable (not twisted pair). The SSR 8 channel is 3.3V logic and I also use shielded cable (but not twisted pair). I don't think the pushbuttons are affected by EMF since they are pulled up, however the SSR board and the TFT display use 3.3V logic, so if I could shift the voltage on both ends to say 12V then perhaps the system would be less susceptible to noise interference?
The ESP32's built in LED is on GPIO_NUM_02. Sometimes the LED can mess with a High signal.
How is CLK, GPIO_NUM_18, being generated?
I will try putting those capacitors. Just to make sure, both have to be in parallel between the 3.3V pin and the GND pin right?
About the SPI busses, I am aware of the recommended amount of CS lines per bus. However while testing in the lab with an oscilloscope, I saw no issue while driving 5 devices on the VSPI bus.
Also, from the online pinouts references of the ESP32 the GPIO_NUM_33 is actually an output, it is from GPIO 34 to 39 that we get input only. From espressif
- GPI: GPIO34-39 can only be set as input mode and do not have software-enabled pullup or pulldown functions.
Thanks for the tip on GPIO_NUM_02. It is used as the DC line for the SPI communication of the TFT display. If I remember correctly, when I used the scope to view the signal, it is square wave with a frequency of some kHz. I'll check if changing that GPIO helps.
Finally, I am using the arduino IDE to code the esp32, with libraries such as TFT_eSPI for the TFT display and SPI.h for the SPI communication. So I don't even have to declare CLK, I think the libraries themselves have it declared from the hardware SPI configuration.
Reads like you got things well in hand. Good luck.
If there are circulating currents in the wire duct, itself, than that may be contributing to the problem.
Both contactors use start/stop push buttons as
The wires that make these connections go through the wire duct, also the power lines for the safety controllers and power lines for pilot lights. So yeah, there are circulating currents inside the wire duct.
If the ducts are metal, there are likely also currents in them!
They are PVC like this one