Guide · 5 minute read

MQTT for farm sensors

MQTT is the most common way for small devices to send data. It is simple, light on power and data, and tolerant of poor connections, which is why it is everywhere on farms.

In short

MQTT is a messaging protocol in which a device publishes small messages to a named topic on a server called a broker. For farm sensors it means a reading is one short message, sent over Wi-Fi or mobile data, to a broker that passes it on to the software that needs it.

How MQTT works

  • A broker is a server that receives and forwards messages.
  • A device publishes a message to a topic, which is a name like a file path.
  • Anything that has subscribed to that topic receives the message.
  • Devices keep one connection open and send only a few bytes per reading.

Why it suits farms

PropertyWhy it helps
Small messagesWorks on slow or metered mobile links
Low overheadBattery sensors can sleep between readings
One outbound connectionNo need to open ports on the farm’s router
Widely supportedAlmost every microcontroller and gateway speaks it

Sending readings to Urvara

Urvara’s server includes an MQTT broker, so there is nothing else to install. In the app you add a device and receive its ID and a token. The device connects with the device ID as the user name and the token as the password.

SettingValue
Port1883, or 8883 with TLS
User nameThe device ID
PasswordThe device token (starts with urv_)
Topicurvara/v1/<device id>/…

The exact topic names and message formats are in the documentation: Connect a device over MQTT.

What happens to a reading

  1. The broker checks the device’s token.
  2. The reading is stored against a channel, which is created the first time it is seen.
  3. The latest value appears on the component you linked the channel to.
  4. Alert rules for that channel are checked.

When MQTT is not the answer

  • Industrial meters and controllers usually speak Modbus. Use the Urvara gateway to read them.
  • Long-range battery sensors often use LoRaWAN. The gateway listens to a LoRaWAN network server.
  • A script or a cloud service may find a plain HTTP request simpler.

Questions people ask

What is an MQTT broker?

An MQTT broker is the server in the middle of an MQTT system. Devices send messages to it, and it forwards each message to everything subscribed to that topic.

Is MQTT secure?

MQTT can be secured with a user name and password for each device and with TLS encryption of the connection. Without TLS the messages, including the password, travel unencrypted, so use TLS over any network you do not control.

Do I need my own MQTT broker to use Urvara?

No. The Urvara server has an MQTT broker built in. Devices connect to it directly.

Last checked against the product: .

Design your farm before you build it.

Open Urvara in your browser. Lay out the land, connect the water and the power, and see what the checks say.