Live monitoring · Connect your hardware

An ESP32 farm sensor with ESPHome

An ESP32 board costs a few dollars, has Wi-Fi, and reads almost any sensor. ESPHome turns it into a working node from one text file.

In short

Add a device in Urvara and download its ESPHome configuration. The file already has the MQTT broker, the device ID and the topics. Add your Wi-Fi name and the device token as secrets, set the pins and calibration values for your sensors, and flash the board.

What Urvara writes for you

For a new device with no readings yet, the file is a starter kit of five common farm sensors:

ReadingSensor in the fileSent every
Water temperatureDS18B20 probe30 seconds
pHAnalogue pH board60 seconds
Water levelJSN-SR04T ultrasonic30 seconds
Pump currentSCT-013 current clamp15 seconds
FlowPulse flow meter15 seconds

For a device that already has readings, the file has a block for each reading it knows how to build, and a placeholder for the rest. An output you marked as switchable becomes a relay that starts in the off state.

Steps

  1. In Live farm, open Devices, add a device and copy its token. It is shown once.
  2. Download the configuration from the device’s row.
  3. Put your Wi-Fi name, Wi-Fi password and the device token in ESPHome’s secrets file.
  4. Go through every line marked SET, CHECK or CALIBRATE and set the pin or the value for your hardware.
  5. Flash the board with ESPHome.
  6. The readings appear on the Now tab by themselves.

The file is written for the esp32dev board and has not been compiled or flashed by us. Pin numbers and calibration values in it are placeholders. Check it against your own board before you rely on it.

How the board talks to Urvara

SettingValue
BrokerThe MQTT host shown in the app, port 1883
User nameThe device ID
PasswordThe device token
TopicsUnder urvara/v1/<device id>/
Online and offlineReported by the board itself on connect and on loss of power

More on topics and message formats in MQTT for farm sensors.

Other firmware works too

ESPHome is the one Urvara writes a file for. Anything that can publish MQTT or send an HTTP request can send readings: Arduino code, MicroPython, a Raspberry Pi script.

Works today
  • A generated ESPHome file for the esp32dev board.
  • MQTT direct to the built-in broker, or to the gateway.
  • Relays that can be switched from the app.

Questions people ask

What is ESPHome?

ESPHome is free, open-source firmware for ESP32 and similar boards. You describe the sensors in a short text file and it builds and flashes the firmware, so you do not write code.

Can an ESP32 run on a battery in a field?

It can, with deep sleep and a solar panel, but Wi-Fi uses a lot of power and has short range. For a battery sensor far from buildings, LoRaWAN is usually the better choice.

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.