How It Works

Parasitic Capacitance

As with w-parasite, the soil moisture sensor works by measuring the capacitance between two large copper traces on the board. These traces are on the PCB part that you stick in the soil.

By applying a square wave to this "capacitor" and observing the time it takes to charge up, we can estimate its capacitance. This capacitance, as it turns out, is a function of how moisture the soil around the traces are. We can then estimate how wet the soil is by measuring this capacitance. I wrote about this cool trick in more detail here.

Bluetooth Low Energy (BLE)

Once b-parasite estimates the soil moisture and collected the ambient temperature and humidity values, it packs that data into a BLE advertisement packet. This is similar to what these popular Xiaomi sensors do.

The packet is repeatedly broadcasted during a short interval of a few seconds, after which b-parasite goes to sleep, only to be woken up and starting over after a few minutes.

BLE-MQTT Bridge

In my current setup, I have a BLE-MQTT bridge that listen to b-parasites' broadcasts, decode their contents and publishes the sensor values to MQTT topics. The MQTT broker then forwards this data to interested parties to be stored in databases or displayed in dashboards.

For the bridge, I use a fork of ESPHome for which I added support for the b_parasite platform. Here's an example on how to use it. And here's a screenshot of my Grafana dashboard with 5 test b-parasites spread around my house over a period of 12 hours:

Battery Life

The main parameters involved in estimating the battery life are:

  • Current consumption (both in operation and during sleep)
  • Duty cycle (how much time it spends in operation vs. sleeping)
  • Battery capacity - this is roughly 230 mAh for CR2032 cells

In the following screenshot, I measured the voltage of a 10 Ohm series resistor during the on-cycle, for a 8dBm transmitting power (the voltage is negative, so it is upside down):

I also measured the sleep current to be around 2.7uA. With these parameters, we can estimate the battery life for a given duty cycle. I put together this spreadsheet so we can enter the active and sleep time to get an estimate.

For example, plugging in an active time of 1 second and sleep time of 10 minutes, we get around 480 days of juice.