NIELIT ECC study materials
NIELIT ECC study resources

Pump controller: relay switching, a 4 m float switch, and welded contacts

NIELIT ECC · Put your knowledge to work in context.

All case studies

Pump controller: relay switching, a 4 m float switch, and welded contacts

A pump controller uses a 3.3 V microcontroller on a two-layer board. A GPIO drives an NPN transistor that switches a 5 V relay coil drawing 80 mA, and a flyback diode is fitted across the coil. The relay contacts switch a 230 V single-phase pump motor. A float switch four metres away connects to another GPIO through unshielded two-core cable that shares trunking with the mains feed to the pump; that input has a 10 kohm pull-up to 3.3 V and no other conditioning. Symptoms reported: the controller occasionally resets and reads wrong ADC values at the instant the relay drops out; the firmware logs 30 to 50 false float-switch transitions a day, mostly while the pump is running; and after about eight months in the field several relay contacts have welded closed. The 5 V rail for the relay comes from the same LDO that feeds the microcontroller.

1. Diagnose each of the three symptoms, naming the coupling mechanism for each.

Read the worked answer

1. Resets and bad ADC reads at relay dropout. This is conducted and common-impedance coupling. When the transistor turns off, the coil inductance forces current to keep flowing through the flyback diode, so the coil node sits about one diode drop below ground and the 80 mA coil current commutates abruptly. If the diode is physically far from the coil, or if the coil return shares the microcontroller's ground trace, the resulting di/dt and ground bounce appear as a voltage step on the LDO's ground reference and on the analogue reference. With both loads on one LDO, the MCU sees a supply and ground disturbance at exactly the dropout instant, which explains the correlation. A flyback diode fitted but wired to the board rather than to the coil terminals leaves a radiating loop and does not cure common-impedance coupling.

2. False float-switch transitions. Capacitive coupling from the mains cable sharing the trunking injects 50 Hz and switching transients onto a 4 m unshielded pair. The 10 kohm pull-up gives roughly 0.33 mA and a high source impedance, so a few tens of picofarads of coupling is enough to move the pin. There is no series resistance, no capacitance to ground and, from the count pattern, no firmware debounce. Contact bounce adds to the problem.

3. Welded contacts. The relay is almost certainly an AC-1 rated part switching an AC-3 inductive motor load: motor inrush is several times rated current, and breaking an inductive load draws an arc that erodes and eventually welds contacts. No snubber or varistor is fitted, so the contact is doing all the work.

2. Propose a fix for each symptom with concrete component values, and say which fix is essential rather than optional.

Read the worked answer

Coil and supply (essential):

  • Move the flyback diode to the coil terminals, use a fast part such as 1N5819 or at minimum 1N4007, and add 100 nF / 100 V across the coil to damp the switching edge.
  • Give the coil its own return to the star point at the LDO output and keep it off the MCU ground. Add 100 microfarad local bulk plus 100 nF at the MCU supply pin.
  • Consider an optocoupler or a dedicated low-side driver so the coil current never shares the MCU return.

Float switch input (essential):

  • Take the signal out of the mains trunking, or replace with shielded twisted pair with the shield grounded at one end only.
  • Change the pull-up to 1 kohm and add 100 nF from pin to ground, giving a 100 microsecond time constant, plus 1 kohm in series at the pin with a clamp diode to the rails.
  • Better still, run a 24 V wetting loop at about 10 mA through the float switch into an optocoupler. Dry 3.3 V contacts at microamps suffer oxide film build-up as well as noise.
  • In firmware, require three consecutive agreeing samples at 20 ms intervals (40-60 ms debounce) and apply hysteresis, so a single noise spike cannot toggle the state.

Motor contacts (essential):

  • Fit an RC snubber across the contacts, typically 100 ohm in series with 0.1 microfarad X2 rated, or a 275 V AC varistor across the motor terminals, ideally both.
  • Replace the relay with an AC-3 rated device, a contactor, or a solid-state relay with proper heatsinking. The relay rating must be chosen for the motor's AC-3 duty, not for its resistive current.

Nothing here is optional; each addresses a distinct mechanism, and removing only the noise while leaving the contacts unprotected simply moves the failure to the relay.

3. Describe how you would verify the fixes and what you would record before releasing the unit to the field.

Read the worked answer

Bench verification.

  • Scope the 5 V rail, the MCU 3.3 V rail and the coil node with a short-ground-lead probe while cycling the relay at least 100 times. Look for rail excursions beyond the MCU's absolute maximum and for any ground bounce at the analogue reference.
  • Inject a burst on the float-switch cable (for example a contact-bounce simulator plus a mains-coupled noise source) and count false transitions in the firmware log with the debounce enabled and disabled, to show the debounce is doing real work.

Load verification.

  • Run the pump through 200 start/stop cycles and measure contact resistance across the relay before and after. Any measurable rise indicates arcing is still occurring.
  • Thermally image the relay and snubber after a run to confirm the snubber is not self-heating excessively.

Field acceptance record.

  • A 72-hour soak with the pump running on its normal duty, logging reset count (must be zero), false float transitions (must be zero or explained), and cabinet temperature.
  • The as-built wiring note showing the signal cable separated from the mains trunking, the shield grounding point and the snubber part numbers.
  • A signed statement that the relay part is rated for the measured motor current at AC-3 duty, with the inrush value measured rather than assumed.