Building a Smart UVC LED Water Disinfection System with Flow Sensors and Embedded Control

Engineering overview supplied by YOYO UV. The online edition includes AI-assisted formatting and technical clarifications.

UV water disinfection is usually described in a very simple way:

Water flows through a chamber, UV light turns on, microorganisms are exposed to UVC radiation, and treated water leaves the system.

The optical part is important, but for an embedded engineer, the interesting part is everything around it.

A practical UVC LED water system may also need:

Flow detection

LED driver control

Temperature monitoring

Fault detection

Runtime tracking

Status LEDs

Automatic shutdown

Power management

This article looks at how these parts can work together in a small point-of-use UVC LED water treatment system.

This article is an engineering overview for qualified product teams. The flow, timing, and temperature examples illustrate firmware behavior. A prototype must stay out of potable service until the complete reactor has demonstrated the required performance under the intended conditions and has met applicable safety and regulatory requirements.

1. Basic System Architecture

A compact UVC LED water treatment device combines a flow sensor, an enclosed reactor, a controller, a driver, and monitoring hardware. The water path also needs a way to keep off-specification flow out of the treated outlet.

Water Inlet
    ↓
Flow Sensor
    ↓
UV Treatment Chamber
    ↓
Treated Water Outlet (held closed or diverted until release criteria are met)
             ┌───────────────────┐
             │ Microcontroller   │
             └───────────────────┘
                ↓     ↓      ↓
             Driver  Temp   Status
                ↓    Sensor   LED
             UVC LED

The basic control sequence is simple:

Water starts flowing.

The flow sensor sends a signal.

The microcontroller confirms that the flow rate is within the allowed range.

The controller enables the UVC LED driver.

Allow water to reach the treated outlet only while validated operating conditions are confirmed.

If water demand ends, the controller returns the system to standby.

If a monitored value leaves the validated range, block or divert the water, report the fault, and put the UV driver in the system's safe state.

This architecture is especially useful for point-of-use systems because the UVC LED does not need to remain continuously powered when there is no water demand.

2. Choosing the UVC LED Wavelength

Flow-through reactor studies have evaluated UVC LEDs in the 260–280 nm range. The wavelengths below are examples to assess against the actual water, optics, and treatment objective.

Common engineering choices include:

265 nm

270 nm

275 nm

280 nm

The wavelength should not be selected only by asking which number has the highest theoretical germicidal effectiveness.

The real system also depends on:

LED radiant power

Electrical efficiency

Thermal performance

Optical geometry

Water transmittance

Flow rate

Chamber length

LED cost

Lifetime requirements

For example, a higher-output 275 nm LED module may sometimes be more useful in a practical product than a lower-output LED at a theoretically more favorable wavelength.

For prototyping or OEM integration, engineers can also start with a preassembled UVC LED module rather than designing the UV LED PCB, thermal interface, and wiring from zero.

That can simplify early-stage mechanical and electrical development.

3. Flow Detection Is the Key Trigger

A small UVC water treatment unit can use demand-based control.

Instead, a flow sensor can tell the controller when water is actually moving.

Common options include:

Hall-effect flow sensors

Turbine flow meters

Reed-switch flow sensors

Pressure-based detection

Optical flow sensors

For a low-cost embedded design, a Hall-effect flow meter is often practical.

The output may look like a pulse train:

Flow → Sensor Pulses → MCU Interrupt → Calculated Flow Rate

The microcontroller counts pulses over time and estimates flow.

A simplified formula might be:

Flow Rate = Pulse Frequency / Calibration Factor

The exact calibration factor depends on the sensor.

The controller can then compare the measured flow against a defined operating range.

Illustrative firmware states using limits established through reactor validation

No demand                    → Treated outlet closed; LED standby
Flow inside validated range  → Confirm UV output and all release criteria
Flow outside validated range → Block or divert flow and signal a fault

Release limits must come from validation of the actual reactor and operating conditions.

4. Why Flow Rate Matters So Much

UV treatment depends on exposure.

If water moves too quickly through the chamber, exposure time decreases.

A simple relationship is:

Nominal Residence Time ≈ Wetted Chamber Volume / Flow Rate

If the chamber volume stays fixed:

Lower flow means longer exposure.

Higher flow means shorter exposure.

But this does not mean that simply slowing the water always solves the problem.

For a constant irradiance at a point, the simple fluence relationship is:

UV Fluence ≈ Irradiance × Exposure Time

And irradiance inside a real chamber is affected by:

Distance from the LED

Optical losses

Chamber material

Reflection

Water UV transmittance

Scaling or fouling

LED aging

Temperature

Geometry

A chamber has a distribution of flow paths and exposures. The nominal residence time and simple fluence calculation help with design estimates. Microbial performance and the validated operating limits must be established for the complete reactor.

Flow is one input to the release decision.

5. Driving the UVC LED

High-power UVC LEDs should normally use a proper constant-current driver.

Avoid treating them like ordinary indicator LEDs.

A basic structure is:

12V or 24V Input
       ↓
Protection Circuit
       ↓
Constant-Current Driver
       ↓
UVC LED Module

Useful driver features may include:

Current regulation

PWM or enable input

Overtemperature protection

Short-circuit protection

Overvoltage protection

Soft start

The microcontroller normally controls the driver's enable pin rather than switching the full LED current directly through an MCU GPIO.

For example:

if (flow_ok && temperature_ok && driver_ok && uv_output_ok) {
    permit_treated_outlet();
} else {
    block_or_divert_flow();
}

This example describes the outlet permissive after startup. The real controller also needs filtering, timeouts, independent fault handling, and sensor validation.

6. Add a Short Flow Confirmation Delay

Flow sensors can produce unstable signals when a faucet first opens.

Debounce the demand signal while keeping the treated outlet closed or diverting start-up flow. In a system that needs flow to confirm startup, provide a separate demand signal or a safe diversion path.

For example:

Flow detected
     ↓
Confirm stable demand and required hydraulic conditions
     ↓
Enable UV and verify validated output
     ↓
Allow treated flow only when all release criteria are met

This helps prevent rapid switching caused by:

Pressure changes

Water hammer

Sensor noise

Partial valve opening

An off-delay can keep the LED on briefly after demand ends while the treated outlet remains closed.

Validate timing, diversion or flushing, and restart behavior on the complete system so startup and shutdown cannot send off-specification water to the treated outlet.

7. Temperature Monitoring

Thermal management is one of the biggest differences between traditional mercury UV lamps and UVC LEDs.

LED performance depends strongly on junction temperature.

A practical design may include:

Aluminum PCB

Aluminum housing

Thermal pad

Heat sink

NTC thermistor

Digital temperature sensor

The sensor should be located close enough to the heat-generating area to provide useful information.

Example control logic using limits established for the assembly

Temperature inside validated limits
    → Normal operation if all release criteria are met
Temperature approaching limit
    → Warn; any power adjustment must keep the reactor inside its validated envelope
Temperature outside validated limits
    → Block or divert flow and put the driver in its safe state

Determine the assembly limits from the manufacturer's data, thermal tests, and validation of the reactor.

The correct limits depend on the LED manufacturer's specifications and the thermal resistance of the complete assembly.

8. Detecting LED Failure

A system becomes much safer and easier to maintain when it can detect that the UVC LED is not operating correctly.

Possible methods include:

Current Monitoring

Measure driver current with:

Shunt resistor

Current-sense amplifier

Smart LED driver

If current is outside the expected range, generate a fault.

Voltage Monitoring

Unexpected forward voltage can indicate:

Open circuit

Wiring failure

LED damage

Optical Monitoring

A UV-sensitive photodiode can provide more direct confirmation that UV radiation is present.

This is more complex, but it can detect failures that electrical monitoring alone may miss.

A more advanced system might combine:

Flow OK
+
Current OK
+
Temperature OK
+
UV Sensor OK
=
One set of permissives for treated flow, subject to all other validated limits

9. A Simple State Machine

Instead of writing the firmware as many independent if statements, it is often cleaner to use a state machine.

For example:

IDLE
 ↓
FLOW_DETECTED
 ↓
UV_ACTIVE
 ↓
IDLE

Additional states can include:

OVER_TEMP

FLOW_TOO_HIGH

LED_FAULT

SENSOR_FAULT

SERVICE_REQUIRED

Pseudo-code:

switch (state) {
case IDLE:
    block_treated_outlet();
    if (demand_detected()) state = STARTUP;
    break;
case STARTUP:
    block_or_divert_flow();
    if (startup_fault_or_timeout()) state = FAULT;
    else if (validated_conditions_ok()) state = UV_ACTIVE;
    break;
case UV_ACTIVE:
    if (!validated_conditions_ok()) {
        block_or_divert_flow();
        state = FAULT;
    } else if (!demand_detected()) {
        block_treated_outlet();
        state = IDLE;
    } else {
        permit_treated_outlet();
    }
    break;
case FAULT:
    block_or_divert_flow();
    disable_uv_if_required_by_safe_state();
    show_fault();
    if (qualified_reset()) state = IDLE;
    break;
}

Use fail-closed hardware or a validated diversion arrangement so loss of power, a watchdog reset, or a critical fault cannot release untreated water. Validate recovery and any required flush before resuming supply.

10. Status Indicators

Users should not need a multimeter to understand whether the system is working.

A simple three-color indicator can provide useful feedback.

For example:

Green  = Operating within configured treatment limits
Blue   = Standby / no water flow
Red    = Fault

More advanced products can display:

Flow rate

UV runtime

Temperature

LED status

Service warning

  • Estimated water volume delivered while the treatment permissive was active

For connected systems, this information can also be sent through:

UART

RS485

Modbus

CAN

Wi-Fi

Bluetooth

MQTT

That makes the architecture suitable for IoT water-treatment equipment.

11. 12V vs 24V Power

Many compact water-treatment devices use 12V or 24V DC input.

Both are useful.

12V

Good for:

RV systems

Battery-powered applications

Small point-of-use devices

Automotive-style systems

24V

Useful for:

Industrial control cabinets

Longer cable runs

Higher-power systems

PLC-based equipment

If the same product must support both voltages, consider using a driver stage with a wide enough input range.

A reverse-polarity protection stage and input transient protection are also worth adding.

12. Mechanical Design Matters Too

A perfect control circuit cannot compensate for poor chamber design.

Engineers should consider:

Distance between LED and water

Internal reflections

Dead zones

Shadowing

Flow distribution

Chamber material

Seal reliability

Heat transfer

Pressure resistance

Waterproofing

The UV source also needs to be protected from direct user exposure.

Use a shielded enclosure and suitable service interlocks. UVC exposure can injure eyes and skin. FDA guidance on UVC exposure

13. Water Quality Changes the Result

Clear-looking water does not always transmit UVC equally well. Assess transmittance at the reactor's operating wavelength and the measurement path length used for validation.

UV transmission can be affected by:

Suspended particles

Iron

Organic matter

Turbidity

Color

Scaling

Dissolved compounds

This matters because the LED may be operating correctly while less UV energy reaches the target microorganisms.

For commercial products, system validation should therefore include the expected real-world water conditions rather than only testing with ideal laboratory water.

14. Prototype Before Optimizing

A useful development sequence is:

Stage 1 — Optical Prototype

Test:

UVC wavelength

Radiant output

Chamber geometry

Flow rate

Exposure

Stage 2 — Thermal Prototype

Measure:

PCB temperature

Housing temperature

LED operating temperature

Long-duration stability

Stage 3 — Control Prototype

Add:

Flow sensor

MCU

LED driver

Temperature sensor

Status indicator

Stage 4 — Fault Testing

Simulate:

No flow

Excess flow

LED disconnect

Sensor failure

Overtemperature

Low input voltage

Stage 5 — Validation

Measure actual reactor performance across the expected flow, UV transmittance, and temperature range. Include aging and fouling assumptions, relevant organisms or validated surrogates, and tests of startup, shutdown, power loss, and fault diversion. Obtain any validation or certification required for the intended use and jurisdiction before placing a product in potable service.

This order prevents engineers from spending weeks optimizing firmware for a UV chamber that still needs major optical changes.

15. Example Hardware Stack

A compact prototype could use:

MCU:

STM32 / ESP32 / RP2040

Input:

12V or 24V DC

Sensors:

Hall-effect flow sensor

NTC temperature sensor

Output:

Constant-current UVC LED driver

Optional:

UV photodiode

OLED display

Buzzer

RS485

Wi-Fi

For the UV source, engineers can either design their own LED board or integrate an existing UVC LED module.

Manufacturers such as YOYO UV provide UVC LED components and OEM/ODM module options for water-treatment and embedded UV applications, which can be useful during prototyping when wavelength, PCB size, voltage, optical layout, or connector configuration needs to be customized.

The important point is to verify the final module inside the complete system rather than relying only on component specifications.

Final Thoughts

A smart UVC LED water-treatment system is not just a UV LED connected to a power supply.

It is really a small embedded control system.

A robust design combines:

UVC optics

Hydraulics

Constant-current electronics

Thermal management

Flow sensing

Firmware

Fault detection

Safety design

The most useful design principle is simple:

Do not ask only, “Is the UVC LED on?”

Ask:

“Do I have the right flow, UV output, temperature, electrical condition, and operating state at the same time?”

That shift turns a basic UV light source into a much more practical water-treatment platform.

Technical references

readers loved this