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.
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
| Property | Why it helps |
|---|---|
| Small messages | Works on slow or metered mobile links |
| Low overhead | Battery sensors can sleep between readings |
| One outbound connection | No need to open ports on the farm’s router |
| Widely supported | Almost 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.
| Setting | Value |
|---|---|
| Port | 1883, or 8883 with TLS |
| User name | The device ID |
| Password | The device token (starts with urv_) |
| Topic | urvara/v1/<device id>/… |
The exact topic names and message formats are in the documentation: Connect a device over MQTT.
What happens to a reading
- The broker checks the device’s token.
- The reading is stored against a channel, which is created the first time it is seen.
- The latest value appears on the component you linked the channel to.
- 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: .