Problem
My PLC is getting voltage spikes in the onboard ADC readings when I turn on actuated components elsewhere in my electrical system. I need to protect my PLC from these spikes because they cause errors in my data and can lead to bad logic from the program in my PLC.
More Information
I am watering my yard with a pump and water from a rain barrel. I have an ESP32 breakout board connected to an AC relay, a water level variable resistance sensor, and a DC valve. When my AC relay toggles my pump I get spikes in my ADC readings that can last over a few seconds and the same happens for my valve but these can last for around 5 to 8 seconds.
The ESP32 is powered by 5V from a 5V/12V AC to DC converter with the water level sensor and valve connected to the 12V output, the valve is switched with a MOSFET controlled by the ESP32. My AC pump is connected to the same AC power source as my AC/DC converter.
Question
- How can I best protect my ADC readings from prolonged changes in voltage when my valve is opening?
- How can I best protect my AC/DC converter or its output from being affected by the AC pump?