---
title: "MQTT Broker for Smart Agriculture & Irrigation | ConnectMQ"
description: "Connect soil probes, weather stations and irrigation valves over LTE-M, NB-IoT or LoRaWAN to a managed MQTT broker — small data plans, reliable valve commands."
url: "https://connectmq.com/smart-agriculture/"
language: "en"
---

Smart Agriculture

# MQTT for Smart Agriculture

Soil-moisture probes, weather stations, valves and greenhouse controllers publish to one MQTT broker over LTE-M, NB-IoT or a LoRaWAN gateway. Your irrigation controller, farm dashboard and phone app subscribe, and valve commands still reach the field when the rural link drops for a while.

[Try it free](https://app.connectmq.com/signup) [Quickstart](https://connectmq.com/developers/)

No card required

What you can build

## Build your farm monitoring and irrigation on ConnectMQ

You build the applications, ConnectMQ moves the data. Probes, weather stations and valve controllers publish once over MQTT; the farm dashboard, irrigation controller, phone app and agronomy analytics you build each subscribe to the topics they need — add a new field or greenhouse without touching the others.

Your fields

**Soil-moisture probe**farm/{field}/soil-{id}/moisture

**Weather station**farm/{field}/weather

**Irrigation valve & pump**farm/{field}/valve-{id}/state

**Greenhouse climate**farm/greenhouse-{id}/climate

**ConnectMQ**

-   TLS on 8883
-   persistent sessions
-   retained messages
-   QoS 0, 1 and 2

What you build on top

**Farm dashboard**

**Irrigation controller**

**Farmer’s phone app**

**Agronomy analytics**

What you get

## Smart Agriculture on ConnectMQ

-   Probes, weather stations, valves and pumps on one broker
-   Persistent sessions for rural links that come and go
-   Retained last state for every valve, pump and sensor
-   QoS 1 delivery for valve and pump commands

example topic design

```
farm/field-7/soil-03/moisture
farm/field-7/valve-2/set
farm/field-7/valve-2/state           (retained)
```

**Cellular data** per soil sensor / month

**MQTT over TLS**0.9 MB

one session, tiny frames

**HTTPS polling (keep-alive)**2.6 MB

headers on every request

**HTTPS, new connection per reading**15.6 MB

TLS handshake every time

Estimate per sensor and month: one small reading every 15 minutes (2,880 a month) over TLS, including TCP/IP and TLS overhead — about 300 bytes per reading with MQTT QoS 1, 900 bytes with HTTPS keep-alive and 5.4 kB with a new HTTPS connection. Illustrative values, not measurements.

Data plans

## Up to 3× less cellular data per sensor

A soil reading is only a few bytes. With MQTT the frame around it stays small too; with HTTPS, headers and handshakes make up most of what goes over the air. Fewer bytes means a smaller IoT data plan and less radio time on a battery-powered probe.

Real-life example

## Dry soil at dawn — valve 2 opens before the crop is stressed

A common irrigation setup with MQTT: soil probes and valve controllers in the field publish over LTE-M, the irrigation controller in the farm office subscribes, and its commands travel back to the valves the same way.

Field 7 → ConnectMQ → Farm office. Publishes soil moisture every 15 minutes over LTE-M. After a dry, windy night the reading at root depth falls to 18 %. Subscribed to farm/field-7/+/moisture through ConnectMQ: below 22 % its rule schedules 40 minutes and sends the open command to valve 2 with QoS 1. Opens the valve for 40 minutes — it closes on its own afterwards — and publishes its new state as a retained message, so every dashboard shows it at once. Gets a notification from the farm app, which subscribes to the valve state — no drive out to the field to check.ConnectMQMQTT broker · TLS 8883Rule: soil below 22 %FIELD 731 %18 % ▼V2 ▸ 40 minvalve-2: openFarm officeIrrigation controller · subscribedSOIL-0331 %24 %18 %Soil moistureValve 2Valve 2: open · 40 minField 7Soil probe & valve 2 · LTE-Mfarm/field-7/soil-03/moisture {"pct":18}farm/field-7/soil-03/moisture {"pct":18}farm/field-7/valve-2/set {"state":"open"}farm/field-7/valve-2/set {"state":"open"}farm/field-7/valve-2/state {"state":"open"}Farm app · nowField 7 irrigating — valve 2 open for 40 minField 7 → ConnectMQ → Farm office. Publishes soil moisture every 15 minutes over LTE-M. After a dry, windy night the reading at root depth falls to 18 %. Subscribed to farm/field-7/+/moisture through ConnectMQ: below 22 % its rule schedules 40 minutes and sends the open command to valve 2 with QoS 1. Opens the valve for 40 minutes — it closes on its own afterwards — and publishes its new state as a retained message, so every dashboard shows it at once. Gets a notification from the farm app, which subscribes to the valve state — no drive out to the field to check.ConnectMQMQTT broker · TLS 8883Rule: soil below 22 %FIELD 731 %18 % ▼V2 ▸ 40 minvalve-2: openFarm officeIrrigation controller · subscribedSOIL-0331 %24 %18 %Soil moistureValve 2Valve 2: open · 40 minField 7Soil probe & valve 2 · LTE-Mfarm/field-7/soil-03/moisture {"pct":18}farm/field-7/soil-03/moisture {"pct":18}farm/field-7/valve-2/set {"state":"open"}farm/field-7/valve-2/set {"state":"open"}farm/field-7/valve-2/state {"state":"open"}Farm app · nowField 7 irrigating — valve 2 open for 40 min

1.  05:45 **Soil probe in field 7**
    
    Publishes soil moisture every 15 minutes over LTE-M. After a dry, windy night the reading at root depth falls to 18 %.
    
    `farm/field-7/soil-03/moisture → {"pct":18,"depth_cm":30}`
    
2.  05:45 **Irrigation controller**
    
    Subscribed to farm/field-7/+/moisture through ConnectMQ: below 22 % its rule schedules 40 minutes and sends the open command to valve 2 with QoS 1.
    
    `farm/field-7/valve-2/set → {"state":"open","minutes":40} · QoS 1`
    
3.  05:46 **Valve controller 2**
    
    Opens the valve for 40 minutes — it closes on its own afterwards — and publishes its new state as a retained message, so every dashboard shows it at once.
    
    `farm/field-7/valve-2/state → {"state":"open","until":"06:26"} · retained`
    
4.  05:46 **Farmer**
    
    Gets a notification from the farm app, which subscribes to the valve state — no drive out to the field to check.
    

**If the rural LTE-M link drops,** the open command waits in the valve controller’s persistent session on ConnectMQ and is delivered with QoS 1 as soon as it reconnects (`QoS 1 · persistent session`).

[ESP32 code sample](https://connectmq.com/code-samples/esp32/) [Node-RED flow](https://connectmq.com/code-samples/node-red/)

Platform

## Features that help with Smart Agriculture

[

### Dashboard & monitoring

Live topic cards, signals and ISA-95 workspace

Learn more](https://connectmq.com/monitoring/)[

### Rules & alerts

Threshold rules, alert log and notifications

Learn more](https://connectmq.com/rules-alerts/)[

### Connectivity

MQTT 3.1.1 and 5 over TCP, TLS, WS and WSS

Learn more](https://connectmq.com/connectivity/)

Solutions

## Other ways teams use ConnectMQ

[

### Industrial IoT & Smart Manufacturing

Machines, PLC gateways, OEE and quality data

](https://connectmq.com/industrial-iot/)[

### Smart Home

Hubs, sensors and Home Assistant setups

](https://connectmq.com/smart-home/)[

### Fleet Telematics

Vehicle tracking, telematics and cold chain

](https://connectmq.com/fleet-logistics/)[

### Smart Energy

Meters, EV chargers, solar and batteries

](https://connectmq.com/energy-utilities/)[

### Connected Products & Smart Hardware

Smart devices you ship to your own customers

](https://connectmq.com/connected-products/)[

### Connected Robots & Physical AI

Robot fleets talking to fleet managers and AI pipelines

](https://connectmq.com/robotics/)[

### Data Center Monitoring

Power, cooling and rack environment

](https://connectmq.com/data-centers/)[

### Smart City

Streetlights, parking, air and waste sensors

](https://connectmq.com/smart-city/)[

### Prototyping & Education

From first ESP32 to classroom labs

](https://connectmq.com/prototyping-education/)

Industries & use cases

## Where teams use Smart Agriculture

### Industries

-   [Agriculture](https://connectmq.com/industries/agriculture/)

### Use cases

-   [Tank Level Monitoring](https://connectmq.com/use-cases/tank-level-monitoring/)
-   [Agricultural Drones](https://connectmq.com/use-cases/agricultural-drones/)
-   [Greenhouse IoT Sensors](https://connectmq.com/use-cases/greenhouse-iot-sensors/)

Pilot

## Pilot one field this week

Start on the Free plan with no card. Basic covers up to 100 concurrent connections — enough for the probes, valves and weather station of a pilot field or greenhouse. Move to Scale when more fields, barns and cold stores come online.

[Start for free](https://app.connectmq.com/signup) [See pricing](https://connectmq.com/pricing/)

## Articles

[All articles](https://connectmq.com/blog/)

MQTT Fundamentals

### [MQTT QoS Levels Explained: QoS 0, 1 and 2 with Packet Flows and Examples](https://connectmq.com/blog/mqtt-qos-levels-explained/)

A practical guide to MQTT QoS: how QoS 0, 1 and 2 work on the wire, why the delivered QoS can be lower than you asked for, how sessions queue messages and which level to choose for each use case.

August 20, 20269 min read

IoT Tutorials

### [ESP32 MQTT Tutorial: Publish Sensor Data and Control an LED with Arduino IDE](https://connectmq.com/blog/esp32-mqtt-tutorial/)

Connect an ESP32 to an MQTT broker with Arduino IDE and PubSubClient, publish JSON temperature readings, control the onboard LED from the command line and upgrade to TLS with portal credentials.

August 23, 20269 min read

Managed MQTT Cloud

### [How to Choose an IoT MQTT Broker: 12 Criteria and the Questions to Ask Your Vendor](https://connectmq.com/blog/how-to-choose-an-iot-mqtt-broker/)

A practical 12-point checklist for choosing an IoT MQTT broker, a table of questions to ask every vendor, and a five-minute hands-on test you can run against broker.connectmq.com.

September 21, 20269 min read
