Motorized valve interfering with button?

One hardware solution is to add 100~1000pF at the input port.

and ensure Vdd-Vss has decoupling ~ 0.1uF near the chip.**

Of course, ignoring the switch for a period during activity will work, but the spike noise might in future interfere with something else. ( 20ms settling time?)

The reverse biased diodes ideally are across the switch, not the coil so that the current loop area continues to flow in the same path and direction as it decays rather than an abrupt dI/dt between the switch source and end of pair diode snubber.

The transient in valve current loop is mutually coupled to the high impedance loop area of the switch to internal pullup to gnd. This is a typical EMI issue that may be conducted or radiated or both. When the inductive valve load is released from the high side to a diode normally reverse biased on the opposite Rail. The diode current clamps the voltage spike and dissipates the inductor current slower (T=L/R) where the high side current switches from the contacts now to the forward biased diode on the opposite rail(0v).

This appears to try to shift the ground lower but more likely pulls down high impedance pull-up in the uC port towards the ground rail from wire (1pF/cm) and switch capacitance (1pF) from the negative edge trigger creating a false trigger.

There is also radiated negative EMF field during high side turn off negative voltage spike that can couple to the unshielded switch wire pair.

This suppresses the stray dV/dt noise with a bigger capacitance to bypass the induced current from stray capacitance (~10 pF) or mutual inductance with a larger capacitor ( but not too large) on the switch input either to Vss or Vdd depending on your choice for power-up such as 1nF near the IC.

You may or may not want the switch active during power-on reset, so use the cap from input to Vdd to prevent this.

The electromagnetic solutions would include, Shield twisted pairs (STP cable), orthogonal wire pairs for switch and load, Ferrite beads on both noise offender and receiver with small load capacitance (30pF).

But you aren't looking for high bandwidth here and just want to suppress the glitch so 100pF to 1nF should be plenty across the switch input.

The technical choice is to make pullup RC > L/Rdc where Rdc is now is the diode (<1 Ohm) and this reduces the dV/dt noise spike but not make it too big so that when the switch closes the cap stored energy does not burn the contact surface excessively but just enough to burn off any oxidation if not gold plated or carbon.

ALSO NOTE

Your 2A relay is only rated for 1A @ 30Vdc which means your valve current must not exceed 1A for long life, otherwise the plated burns off and Rs rises into rapid thermal ageing.


Without knowing exactly what's going on, here are things to try:

  • Decouple the 12V to the Arduino, with a series resistor from 12V and a cap from the Arduino's power input to ground. I'd look at the highest current consumption I expect from the Arduino, and choose a resistor that'd drop no more than 2V (1V by preference), and no more than about 220 ohms. Then use a 10\$\mu\$F bypass cap.
  • Use an external pullup on the button, to make it stiffer. The Arduino's internal pullups are intentionally wimpy (to reduce power consumption) and vary (because they're made on silicon).
  • Place the button close to the Arduino. If you can't, shield the wire to the button using some shielded microphone cable or coax.
  • Review your grounding scheme carefully. Ideally, you'll bring the motor power and ground to the power supply separately from the Arduino power and ground.

Tags:

Button

Arduino