Build · Sketch · source · v1.0.0

SDI-12 Sensor Reader.

What it does
Reads SDI-12 instruments and pushes each value to your endpoint
Interface
SDI-12 digital bus
License
Open: copy it, change it, own it

Professional soil, water, and weather instruments speak SDI-12, the open digital bus that usually needs a costly datalogger. This node reads them directly and pushes each value as oat-ods: no proprietary logger, the data lands where you own it.

What it does.

Reads SDI-12 sensors (the open digital bus on professional soil, water and weather instruments) and emits each value as oat-ods, no proprietary datalogger required.

That’s the Collect layer for one more kind of sensor: it reads the instrument, shapes each reading into the one oat-ods message every Open Agriculture Technology device speaks, and pushes it to a place you own. The value is what you do with the reading later; this just gets it flowing.

What it reads.

Each reading goes out as its own oat-ods message, filed under the place you name, so swapping the hardware later never breaks the record:

What you need.

Wiring. SDI-12 is one data wire plus power and ground. The bus idles at 5 V and the ESP32 is 3.3 V, so put a level interface on the data line (a level shifter, or the published SDI-12 interface circuit). Many sensors also want 12 V on their power line, separate from the ESP32’s supply. Set the data GPIO on the setup page (default 16).

The sensor map.

SDI-12 returns bare numbers, so you label them on the setup page, one line per sensor:

<addr> <stream_id> <measure1>:<unit1>,<measure2>:<unit2>,…
0 gh2-soil   moisture:%,temperature:Cel,ec:dS/m
1 canopy-par par:umol/m2/s

The node polls each address and maps the returned values, in order, to your labels. A “Scan the bus” helper finds addresses you don’t know.

What it sends.

It pushes to wherever you point it (Webhook (HTTP POST) or MQTT) as oat-ods/0.3. One measurement per message; here’s a reading from this node:

{
  "schema": "oat-ods/0.3",
  "observed_at": "2026-06-25T14:30:00Z",
  "stream": { "id": "gh2-soil", "name": "…", "location": "…" },
  "measurement": "soil_moisture",
  "value": 34.2,
  "unit": "%",
  "source": { "tier": "oat-sdi12-reader", "gateway_id": "…", "physical_id": "sdi12:0" }
}

That’s the same envelope the whole library speaks. Point it at your webhook, an Home Assistant broker, or Open Agriculture Technology; the receiver can’t tell which node produced it. The developer reference has the full spec.

Get it & build it.

The project downloads whole: the sketch plus the shared oat_ods library it needs, so it builds as-is:

Full PlatformIO project (.zip) Just the sketch (.ino)

Two ways to put it on a board, both free:

  1. PlatformIO (builds all four ESP32 chips): unzip, then cd oat-sdi12-reader && pio run -t upload. The bundled lib/oat_ods/ resolves automatically.
  2. Arduino IDE: open the .ino, install the libraries below from the Library Manager, pick your ESP32 board, and upload.

Compile-verified on our side (it builds clean with the pinned toolchain), but not yet run on the bench with real sensors, so it ships as source rather than a browser image. If you run it, tell the collective how it went; that’s what turns it into a flash-from-browser sketch.

Set it up.

Setup happens on the device’s own page: nothing to install, works with no internet:

  1. Power the node from any USB charger or your computer.
  2. Join its Wi-Fi network OAT-SDI12-XXXX, and the setup page opens (or visit http://192.168.4.1).
  3. Sign in, set your Wi-Fi, where the readings go, and the sensor details above, then save.
  4. Point delivery at the test endpoint and watch your first reading arrive, checked against the standard.

Settings persist across reboots; a fresh flash wipes them, on purpose, so a re-used board never carries the last owner’s Wi-Fi or endpoint.

Notes.

  • SDI-12 is the open standard on a lot of research-grade gear; this node frees that data from a proprietary datalogger.
  • Each value becomes one oat-ods message: the stream is your label, and physical_id records sdi12:<addr> for provenance.

For makers & trainers.

Frequently asked questions.

How do I read an SDI-12 sensor without a datalogger?

An ESP32 with an SDI-12 library can act as the SDI-12 recorder itself: it addresses each sensor, issues a measure command, and reads back the values. Because SDI-12 idles at 5 V, a small level interface protects the 3.3 V microcontroller. The values are then labeled and sent on, so no proprietary datalogger is required.

What sensors use SDI-12?

SDI-12 is a digital bus common on research-grade environmental instruments: soil moisture and water-content probes, water-quality sensors, and some weather and radiation sensors such as the Apogee SQ-521. It lets several sensors share one data wire, each at its own address.