---
title: "AI Vision Spraying — Donglin Controls"
description: "We upgraded sensor-activated dairy cooling into a vision-led decision system — so the control layer can tell a cow from a person before opening the corresponding spray valve."
canonical: https://efmc-automation.com/en/cases/ai-vision-precision-spraying-dairy
language: en
---
![AI camera directing targeted spray cooling to an occupied cow position in a dairy barn](/api/media/file/hero-ai-vision-spraying-v2.webp)

Agriculture & Livestock

# AI Vision Spraying System for Dairy Farms

We upgraded sensor-activated dairy cooling into a vision-led decision system — so the control layer can tell a cow from a person before opening the corresponding spray valve.

Cow / person classificationZone-level controlAI + PLC closed loop

IndustryAgriculture & Livestock

99.9%

Daylight recognition accuracy

99.2%

Night accuracy at 35–40 lux

5 sec

Camera-fault response

8 sec

Image sampling interval

01

Client request

## Keep precision cooling. Remove the ambiguity.

“

The system should know whether the object in a spray position is actually a cow — and should not treat people and cattle as the same trigger.

 The client’s core requirement**01 / Classify before spraying**

**01**

### Presence is not identity

A sensing trigger can report activity or occupancy, but it cannot reliably tell a cow from a person.

**02**

### Complex barn conditions

Light, dust, night operation and target orientation all affect the quality of the decision.

**03**

### Limited decision traceability

Without visual evidence, operators have little context for reviewing a trigger, tuning a zone or explaining an event.

02

Control transformation

## From “something is there” to “a cow is in this zone.”

The upgrade changes the quality of the input — not the final actuator. Classification now happens before PLC logic issues the valve command.

Before**Sensor-triggered logic**

![AI vision interface identifying cows inside configured recognition zones](/api/media/file/ai-detection-8-640x480.webp)COW

Cow enters positionPresence signal detected

**Trigger**

_PERSON_

Person enters positionPresence signal detected

**Trigger**

 Same input state**No target classification**

AI

After**AI vision decision**

![AI vision interface identifying cows inside configured recognition zones](/api/media/file/ai-detection-8-1280x720.webp)COW · 0.99ROI · ACTIVE

Classification**Cow**

Zone status**Occupied**

PLC output**Allow spray**

Decision layer

Sensor-triggered logic

AI vision decision

Input signal

Presence state only

Classified target inside a defined zone

Cow vs. person

Same trigger for both

Classified before the valve command

Zone granularity

One sensing point per position

Independent ROI mapped to each spray position

Traceability

State bit in the controller

Image evidence, alarms and event history

03

How the system works

## A six-stage closed loop from camera to field equipment.

A thin data path links visual recognition, control decisions and real equipment status — without a single oversized step dominating the workflow.

01System signal

![Field-mounted camera capturing the feeding zone](/api/media/file/camera-enclosure-8.webp)Capture

**Capture** Cameras acquire live images from each feeding zone.**›**

02System signal

Recognize

**Recognize** The AI model classifies cows and evaluates the defined ROI.**›**

03System signal

Transmit

**Transmit** Recognition results are sent to the PLC and the cloud service.**›**

04System signal

![PLC control cabinet evaluating zone and timing conditions](/api/media/file/plc-panel-8-640x480.webp)Decide

**Decide** PLC logic checks zone, timing, mode and operating conditions.**›**

05System signal

![Solenoid valve actuating the corresponding spray position](/api/media/file/field-valves-8.webp)Actuate

**Actuate** Only the corresponding valve and spray position are activated.**›**

06System signal

![Equipment status returning to the operations layer](/api/media/file/mobile-dashboard-8-640x480.webp)Feedback

**Feedback** Equipment status returns to the AI layer for review and tuning.

![AI vision interface identifying cows inside configured recognition zones](/api/media/file/ai-detection-8-1280x720.webp)

Field evidence · Night recognition view**Recognition zones and detected cattle, seen from the control layer.**

Independent colored areas define the recognition zones. Cattle are detected by the model before the corresponding zone status enters the PLC decision layer.

01 · See → 02 · Classify → 03 · Verify zone → 04 · Actuate

![AI vision precision spraying system in a commercial dairy barn](/api/media/file/hero-barn-8-1280x960.webp)

04

Engineered system

## Four layers designed to operate as one.

The project combines visual acquisition, edge intelligence, deterministic PLC control and operational visibility.

![Field-mounted camera capturing the feeding zone](/api/media/file/camera-enclosure-8.webp)

01 / Vision layer

### Camera + Defined Recognition Zones

Live images cover the feeding line while independent ROIs map visual decisions to individual spray positions.

![Edge AI computing hardware installed for the upgrade](/api/media/file/hardware-upgrade-8-640x480.webp)

02 / AI computing

### Day / Night Model Logic

The documented system uses an NVIDIA AI computer and switches datasets to match different lighting conditions.

![PLC control cabinet evaluating zone and timing conditions](/api/media/file/plc-panel-8-640x480.webp)

03 / Control layer

### PLC + Independent Sub-Control

PLC logic performs secondary processing and commands field equipment; independent sub-control limits fault impact.

![Smart spraying control system interface with zone and equipment status](/api/media/file/control-ui-8-1280x713.webp)

04 / Operations layer

### Cloud, Alarms and Historical Records

Operators can review device connectivity, zone status, alarms and system history from the visual control layer.

05

Field validation

## Recognition remained above 99% across the recorded light levels.

The source report documents intermittent image sampling at 8-second intervals between April 5 and April 27, using two online lux sensors installed at the same position and angle.

 Daylight / overcastIlluminance > 500 lux

**99.9%**

Reported missed-detection rate 0.01%.

 Night · Level 1Illuminance 45–49 lux

**99.5%**

Reported missed-detection rate 0.03%.

 Night · Level 2Illuminance 35–40 lux

**99.2%**

Reported missed-detection rate 0.05%.

![AI vision interface identifying cows inside configured recognition zones](/api/media/file/ai-detection-8-1280x720.webp)

Low-light test**35–40 lux**

**04.05–04.27** Recorded test window

**8 sec** Intermittent capture interval

**2 units** Online lux sensors

Project-specific results. Recognition performance depends on camera placement, lighting, the barn environment and the quality of the farm-specific training dataset.

06

Operational resilience

## If vision goes offline, cooling does not simply disappear.

The documented configuration treats camera status as part of the control strategy and preserves a local fallback path.

01

Monitor

### Camera connection is checked continuously.

_›_

02

Detect

### Fault or disconnection is identified.

_›_

03

Fallback

### The sub-controller switches to local conventional mode.

_›_

04

Report

### Alarm and event history notify operators.

**5 sec**

Camera fault response documented for the upgraded configuration, compared with 5 minutes in the preceding version.

07

Delivery approach

## Built around the actual barn — not a generic model.

Each stage is executed against this barn — its camera angles, its lighting and its existing control network.

 01

### Survey

Map cameras, feeding positions, lighting and the existing control network.

 02

### Define ROI

Create independent visual recognition zones for each spray position.

 03

### Train

Build a dairy-specific dataset around environment, cattle and camera angle.

 04

### Integrate

Connect AI inference, PLC sub-control, valves and cloud operations.

 05

### Validate

Check day/night recognition, timing, actuation and fault fallback.

 06

### Handover

Open visual review, parameters, alarms and history to the farm team.

Project outcome

## A smarter decision layer for every spray position.

The upgrade retained position-level control while adding target classification, visual review, day/night adaptation and operational fallback. Recognition performance depends on camera placement, lighting, the barn environment and the quality of the farm-specific training dataset. System configuration and field performance vary by barn, environment and operating requirements.

> The project was not about finding a new way to open a valve. It was about making a better decision before the valve opens.

## Products used in this project

[![Siemens S7-1200 PLC Control Cabinet (1)](/api/media/file/01-7-640x480.webp)](/en/products/siemens-s7-1200-plc-control-cabinet)

### [Siemens S7-1200 PLC Control Cabinet](/en/products/siemens-s7-1200-plc-control-cabinet)

Custom-built control cabinets around the Siemens S7-1200 platform, wired, programmed and factory-tested to your process specification.

[Request a Quote →](/en/products/siemens-s7-1200-plc-control-cabinet)

[![IIoT PLC Cloud Monitoring System (1)](/api/media/file/01-1-640x480.webp)](/en/products/iiot-plc-cloud-monitoring-system)

### [IIoT PLC Cloud Monitoring System](/en/products/iiot-plc-cloud-monitoring-system)

Remote monitoring of PLC-controlled plant from phone or browser, with historical data and alarm push.

[Request a Quote →](/en/products/iiot-plc-cloud-monitoring-system)

[![WinCC HMI & SCADA Programming Service (1)](/api/media/file/01-9-640x480.webp)](/en/products/wincc-hmi-scada-programming-service)

### [WinCC HMI & SCADA Programming Service](/en/products/wincc-hmi-scada-programming-service)

HMI and SCADA screen design and programming on WinCC and TIA Portal, delivered with source files.

[Request a Quote →](/en/products/wincc-hmi-scada-programming-service)
