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.


  1. How can I best protect my ADC readings from prolonged changes in voltage when my valve is opening?
  2. How can I best protect my AC/DC converter or its output from being affected by the AC pump?

Attached is a wiring diagram Wiring Diagram

  • 2
    \$\begingroup\$ Without more information about how everything wired together it will be hard for anyone to give a specific answer. Some general comments: 1. Make sure all inductive loads have catch diodes. 2. Consider your grounding scheme. 3. Consider TVS devices if you're getting large transient voltages. 4. Consider lots of local bypass capacitance. \$\endgroup\$
    – John D
    Commented Sep 1, 2023 at 20:27
  • \$\begingroup\$ Is the PLC connected to AC mains through its own power supply system that develops its internal supplies for operation? Or does it directly connect to some DC rail/supply and has no access to AC mains for self-powering? Where I'm headed is the idea of using a 1:1 isolation transformer to see if that helps mitigate the issue... I've been able to remove many kV spikes that were being tossed into the mains supply circuit by an x-ray machine using one. Annoying to have to do that -- would have preferred isolating the x-ray machine. But I didn't own it. \$\endgroup\$ Commented Sep 1, 2023 at 23:05
  • 1
    \$\begingroup\$ What PLC is it? \$\endgroup\$ Commented Sep 2, 2023 at 5:03
  • \$\begingroup\$ Could you please provide a diagram? \$\endgroup\$
    – bardulia
    Commented Sep 2, 2023 at 13:37
  • \$\begingroup\$ I've attached a wiring diagram \$\endgroup\$
    – Jman
    Commented Sep 13, 2023 at 22:27

2 Answers 2

  1. How can I best protect my AC/DC converter or its output from being effected by the AC pump?

Put them on different breakers, perhaps different phases even, if it's possible. If that doesn't cut it, you might wanna have an electrician check for any underdimensioned wirings and / or faults in connections etc.

  • \$\begingroup\$ Unfortunately I only have one outlet in my backyard \$\endgroup\$
    – Jman
    Commented Sep 13, 2023 at 22:28

It is standard practice to suppress transient voltages at source by connecting flyback diodes across DC coils and RC snubbers / MOVs across AC coils.

RC snubbers / MOVs are also connected across induction motor terminals.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.