Twitter icon
Facebook icon
LinkedIn icon
Google icon
Reddit icon
StumbleUpon icon
Del.icio.us icon

b-parasite - An Open Source BLE Soil Moisture Sensor

Added to IoTplaybook or last updated on: 06/07/2021
b-parasite - An Open Source BLE Soil Moisture Sensor

Story

b-parasite

b-parasite is an open source Bluetooth Low Energy (BLE) soil moisture and ambient temperature/humidity sensor.

Features

  • Soil moisture sensor. I wrote about how capacitive soil moisture sensors work on this Twitter thread, based on this great post on wemakethings.net
  • Air temperature and humidity sensor using a Sensirion's SHTC3
  • Powered by a common CR2032 coin cell, with a battery life of possibly over a year - see "Battery Life" below
  • Open hardware and open source design

Things used in this project

Hardware components

nRF52840 Multi-Protocol SoC
Nordic Semiconductor nRF52840 Multi-Protocol SoC
 
× 1

Nordic Semi

Software apps and online services

nRF Connect SDK
Nordic Semiconductor nRF Connect SDK
 
  Nordic Semi

GitHub Repository Organization

  • code/b-parasite/ - firmware code based on the nRF5 SDK
  • kicad/ - KiCad schematic, layout and fabrication files for the printed circuit board (PCB)
  • data/ - data for testing and sensor calibration
  • bridge/ - an ESPHome-based BLE-MQTT bridge
  • case/ - a 3D printable case

How It Works

b-parasite works by periodically measuring the soil moisture, air temperature/humidity and broadcasting those values via Bluetooth Low Energy (BLE) advertisement packets. After doing so, the board goes into a sleep mode until it's time for another measurement. The sleep interval is configurable - I often use 10 minutes between readings, which is a good compromise between fresh data and saving battery.

At this point, b-parasite's job is done. We have many possibilities of how to capture its BLE advertisement packet and what to do with the data. What works okay for me is having a BLE-MQTT bridge that listens for these BLE broadcasts, decodes them and ships the sensor values through MQTT messages. The MQTT broker is then responsible for relaying the sensor data to interested parties. This is the topology shown in the diagram above.

A popular choice for a BLE-MQTT bridge is the ESPHome project, which runs on our beloved ESP32 boards. I forked ESPHome into rbaron/esphome and added support for the b_parasite platform. An example project using this fork is defined in this repo, under bridge/ (check out README.md there for more info).

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):

The short high peaks correspond to when the radio is active, sending broadcasting packets. The average current consumption during this active time is roughly 9mA. Let's round it to 10mA. During off time, I measure a current of less than 3uA.

With these parameters in hand, I put together this spreadsheet in which you can estimate the battery life. For example, for an active time of one second and sleep time of ten minutes, we see a runtime of 488.10 days.

Case

A 3D printable case model can be found in case/.

Schematics

Schematic - Designed used KiCAD.

Code

Github - GitHub repository with all the design files and code.

A Bluetooth Low Energy (BLE) soil moisture sensor. — Read More

Latest commit to the master branch on 5-27-2021

Download as zip

Credits

rbaron

rbaron

I like to build stuff.

 

Hackster.io

This content is provided by our content partner Hackster.io, an Avnet developer community for learning, programming, and building hardware. Visit them online for more great content like this.

This article was originally published at Hackster.io. It was added to IoTplaybook or last modified on 06/07/2021.