← All projects & experiments

EMBEDDED · SENSORS · BLE · PCB DESIGN

A plant sensor, from soil to screen

Working prototype · Mesh and solar power are still the plan

I am a death sentence for plants. I really like having them around, but every plant I have been given has ended up dead. I went looking for a monitor that could tell me about the soil, light, and temperature, and found a choice between expensive gadgets with app subscriptions and cheaper ones with mixed reviews. So my friend Winston and I decided to make our own.

We wanted to measure moisture, electrical conductance, temperature, humidity, and light without creating another little ecosystem I would have to maintain. The sensor PCB works, and I built an ESP32 bridge to put its readings on two OLEDs and send reports to this site. The self-healing mesh and solar power are the longer-term goal, not features of this prototype yet.

Purple soil sensor PCB in a basil plant, beside the breadboard ESP32 bridge and its two OLED displays
The working prototype in a basil plant. One OLED shows the environment; the other shows the soil readings.

The big idea

I would eventually like several sensors to pass readings through a self-healing mesh to a hub, then let that hub share the data with smart-home tools. A separate solar board would mean no battery changes. For now, there is one nRF52840 sensor talking to an ESP32 over Bluetooth Low Energy; the bridge uses Wi-Fi to reach this site. Separating the solar harvester from the sensor board made the first round of prototyping much easier to debug.

Hand-drawn plan showing plant sensors relaying readings to a hub, which connects over Wi-Fi
My original sketch of the end goal. The relaying sensors are a plan; the current prototype uses one BLE link to the hub.

The sensor is the PCB

The heart of the device is the capacitive moisture probe. Two long copper plates run down the PCB, with the surrounding soil acting as part of the capacitor’s dielectric. Water changes its effective capacitance. I excite the probe at 125 kHz and turn its response into a voltage the nRF52840 can read. In my reference tests, wetter conditions produced a lower voltage.

That voltage becomes a relative wetness index using three calibration points. It helps me track what is happening in this plant, but it is not a percentage of water in the soil. The drawing below was how I first explained the electric-field idea to myself; the PCB layout shows where the plates and the separate conductance electrodes ended up.

Hand-drawn capacitor plates comparing electric fields in dry and wet soil
My dry-versus-wet sketch: changing the material around the plates changes the effective capacitance.
PCB layout showing electronics at the top, long capacitive plates, and electrodes at the tip
The actual PCB layout. The long plates measure the capacitive response; the exposed electrodes at the tip are for conductance.

Getting a voltage the microcontroller can use

For repeatable measurements, the powered plate has to discharge between pulses. A BJT inverts the PWM signal to the gate of an NMOS transistor, which gives that plate a path to ground while PWM is low. When the next pulse arrives, the probe starts from a known state instead of carrying charge from the previous measurement.

A diode and an RC network smooth the probe response into a slower voltage for the ADC. The optional R1 footprint is left unpopulated so I can tune the charging time constant later. In firmware, I let the output settle before averaging readings rather than trusting the first sample.

Close-up schematic of the capacitive probe discharge transistor, diode, smoothing capacitor, resistor, and ADC output
The capacitive circuit from my writeup: Q1 discharges the plate, while D1, C1, and R2 shape the voltage sent to the ADC. R1 is marked do not populate.

What the electrodes at the tip tell me

The second measurement uses two exposed electrodes. A DRV8210 H-bridge reverses their excitation at 5 kHz, so one half-cycle makes one electrode positive and the next reverses it. A TLV9004 circuit senses electrode voltage and the current through a shunt; firmware compares samples from both polarities to estimate resistance and conductance.

This path taught us more during bring-up than I expected. The first board’s 10× amplifier gain drove the op-amp into saturation. Lowering the gain on the second board got the circuit measuring against known resistors. I have still seen clipping in moist soil, so I am not calling the output calibrated soil conductivity, much less a direct measure of fertility. Electrode geometry and temperature calibration are still needed.

Soil sensor wired to a reference resistor on a breadboard
Checking the conductance path against a known resistor before trusting a reading from soil.

The other sensors and the controller

For temperature, humidity, and light, I used I²C chips that do the analog work for us: an SHTC3 for the surrounding air and an OPT3001 for ambient light. The temperature reading is near the electronics, not necessarily the temperature below the soil. The nRF52840 also watches its supply voltage for troubleshooting; that is not a battery-charge reading.

The controller wakes the SHTC3 for a reading, checks its CRC, and puts it back to sleep. It times conductance samples around switching edges and retries a sample if it lands on one. Communication failures, clipping, and values outside calibration get fault flags instead of quietly becoming normal readings.

Full sensor schematic showing the capacitive and conductance circuits, OPT3001, and SHTC3
The full sensor schematic. The capacitive circuit is at upper left, the conductance drive and amplifiers at upper right, and the light and environmental sensors below.

Open the complete sensor schematic (PDF)

From the plant to my screen

Once the sensor was running, I made an ESP32 bridge with two OLED displays because I wanted to read the conditions without opening an app. About every five seconds it asks for a fresh BLE reading. One display has temperature, humidity, and light; the other has wetness, conductance, and watering status. Separate I²C buses let the two displays use the same address.

For fun, I also made the bridge send hourly summaries to this site over HTTPS. It reconnects after BLE loss, marks old readings as stale, and retries uploads using a report ID so the same report is not saved twice. The 24-hour field note plots what has actually arrived. Its watering marker is only an inference from a sustained wetness increase and falling raw probe voltage, not a confirmed record that I watered the plant. Gaps are possible when the bridge loses power or connectivity.

What I would change next time

I did not put nearly enough test points and debug connectors on this board. That turned simple verification into a much longer job than it needed to be. I carried that lesson into RADIOLAND, my SDR: low-speed traces have test points, critical power stages have solder jumpers, and I have ways to inject power or reach backup I/O if a stage misbehaves.

The solar board, built around a BQ25570, is still on the bench. I have tested the sensor from an external supply, but have not measured battery life or finished matching the harvester settings to the panel and storage. The mesh network and third-party integrations are also future work. Right now the useful next test is less glamorous: get trustworthy history from the plant, finish wetness and conductance calibration, and compare the sensor’s story with what I actually did to the basil.

See the prototype

Video demo of the sensor and bridge. Open on YouTube