finds.dev← search

// the find

Miceuz/i2c-moisture-sensor

★ 258 · C · Apache-2.0 · updated Feb 2023

I2C based soil moisture sensor

A capacitive soil moisture sensor with an on-board thermistor and light sensor, exposed as a small register map over I2C on an AVR microcontroller. It is the successor to the Chirp plant watering alarm, aimed at people building their own plant monitors or home automation nodes who want the board, firmware, and interface in one repo.

Hardware, firmware, and fab files all live in the repo: KiCad schematic and board, BOM, STEP models, and the AVR source (main.c, twi.c, thermistor.c). You can rebuild the board from this repository alone, which is rare for a sensor project. The I2C interface is small and documented: ten registers with access type and length, plus an address-change procedure that notes the double-write protection added in firmware 0x26. Capacitive sensing avoids bare metal electrodes sitting in the soil, which is where resistive probes usually corrode. The README states the limits plainly: free-air reads of 290 to 310, temperature in tenths of a degree, and light reading 65535 in darkness.

Moisture comes out as a relative capacitance count with no conversion to percent. Every soil and pot needs its own calibration curve, and the repo leaves that to you beyond a PDF. The read protocol is awkward: each read returns the previous measurement and starts a new one, so a current value means discard, poll GET_BUSY, then read again. Any consumer that misses this gets stale data. The example code is dated. The Raspberry Pi scripts use Python 2 print statements and the deprecated Adafruit_I2C helper, and the light sensor is described as noisy, so these are poor starting points for Python 3 users. The last push was February 2023, and the firmware build chain (hex2c.py generating firmware.h, plus a committed main.bin next to main.c) is not explained, so anyone reflashing the chip has to work out which artifact is authoritative.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →