🪴💧 A Bluetooth Low Energy (BLE) soil moisture sensor.

Overview

b-parasite

PCB front and back photo

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 works on this Twitter thread, based on this great post on wemakethings.net
  • Air temperature and humity 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

Repository Organization

How It Works

Diagram containing two b-parasites, a bridge & an MQTT broker

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

tl;dr: By taking readings 10 minutes apart, the battery should last for over a year.

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

A screenshot of an oscilloscope used to measure current consumption

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.

b-parasite stuck into a small plant vase

License

The hardware and associated design files are released under the Creative Commons CC BY-SA 4.0 license. The code is released under the MIT license.

Issues
  • Add Photoresistor

    Add Photoresistor

    This will add a light sensor to the parasite:

    This has been tested to work with JLCPCB manufacturing qoute but not ordered yet for the below reasons.

    1. I don't really know if this design is correct as I'm fairly begginer in electronics (so far my circuits are working but this is another level)
    2. I don't know how to program a compatible code...

    Partially solving https://github.com/rbaron/b-parasite/issues/4

    opened by yuvalabou 44
  • How to program

    How to program

    HI,

    Nice work!!

    I'm looking for guidance on how to program the devices, I have an Atmel ICE that has SWD would that work?

    Are there any cheap programmers that could easily be used?

    opened by volzb 20
  • Phototransistor

    Phototransistor

    This PR substitutes the LDR introduced in #6 with a phototransistor. Some advantages:

    • RoHS compliance
    • More compact
    • Relatively linear
    • SMT, so it can be assembled by fabrication houses
    opened by rbaron 12
  • Moisture readings overflow

    Moisture readings overflow

    I haven't dug into this myself yet, but noticed this morning that one of my plants moisture reading "overflowed". When looking at the code, I saw that moisture readings are actually fit to a polynomial and the final values from the equation. Haven't done any debugging yet, so probably not much to go on, but opening the issue as something is clearly miss-behaving. Will follow up as I get time. I'm also not convinced that the moisture reading is right in the first place. It's continuously trending up, yet I haven't added water to the soil since adding the sensor.

    Love this project, thanks a bajillion for open sourcing.

    Screen Shot 2021-05-12 at 11 18 35 AM Screen Shot 2021-05-12 at 11 18 41 AM
    opened by AlexSzlavik 9
  • Alternate Parts Availability

    Alternate Parts Availability

    Right now as most have seen the nRF52840 (E73-2G4M08S1C) as proposed is currently unavailable for the most part and the ones that are available have obviously went up in price. From what I can determine this particular version of the part, the advantage is the fact that it is pre-mounted on a daughter board which makes hand soldering easier and has a ceramic antenna already attached.

    The Nordic nRF52840 SoC itself is available at LCSC (C190794) for pick and place manufacturing and at a better cost with 14,000+ currently available with more reportedly coming in. Using the Nordic in this fashion also gives you access to more of the IO's that are available.

    From what research I can find, the ceramic antenna is what is considered a medium gain antenna. Better range and performance could be achieved by designing in an IFA pcb copper trace antenna that would also occupy near the same footprint of the ceramic antenna.

    opened by MrEinstin 7
  • Mosfet instead of Q2 and Q3 bipolar?

    Mosfet instead of Q2 and Q3 bipolar?

    Hello,

    I ask myself why does Q2 and Q3 are bipolar tranistor and not mosfet ? There is an explanation of operation here : https://wemakethings.net/2012/09/26/capacitance_measurement/ But not why bipolar instead of mosfet to discharge the capacitor.

    Thanks

    opened by pit34 6
  • RTT with FTDI board using OpenOCD

    RTT with FTDI board using OpenOCD

    This question is less about the p-parasite and more about OpenOCD.

    As I lack access to a J-Link debugger to program the nRF SoC, I've had to resort to an FTDI-based programmer with OpenOCD.
    However, I suspect that my b-parasite doesn't quite work right and wish to investigate the logs it generates.
    (It never blinks the LED nor broadcasts any BLE packets and I think that it gets stuck at power_management_init())

    Now I've been wondering how to make use of the RTT functionality with OpenOCD, because I can't seem to get that to work either.
    As I understand, one has to setup RTT in OCD before being able to 'use' it. (Syntax: rtt setup <address> <size> <id>)

    Unfortunately, if I try to do that with the example values as provided in the OCD docs, I am met with this message:

    > rtt setup 0x20000000 2048 "SEGGER RTT"
    > rtt start
    rtt: Searching for control block 'SEGGER RTT'
    rtt: No control block found
    

    Both NRF_LOG_ENABLED and NRF_LOG_BACKEND_RTT_ENABLED are set to 1 in sdk_config.h.

    Perhaps I am using the wrong address or control block ID?
    My knowledge about RTT is admittedly quite limited.

    For reference, I am using a nrf52833.

    opened by ThisIsntTheWay 6
  • Negative Temperature Values

    Negative Temperature Values

    Wanting to use one left-over b-parasite to verify the temperature of my fridge, I noticed that the device does not transmit negative flawlessly (at least not to the ble_monitor solution). Is it a problem with the encoded packets or with the decoding?

    As a plant-logging use-case, it might come in handy for plants which are on a balcony, or in the garden, although that specifically will not happen for my plants right now.

    opened by jhbruhn 5
  • Conformal coating / Case

    Conformal coating / Case

    Hi, I want to use the sensor outside on my balcony. Would it be possible to coat the pcb and what parts would I need to spare? Regarding the case, is there any issue with temperatures, is there any max temperature which shouldn't be exceeded? Thanks a lot for providing the whole informations and the project itself!

    opened by a83r 4
  • Ordered 10 pcs from JLCPCB to Germany - do not need 10 - is there a platform for interested parties?

    Ordered 10 pcs from JLCPCB to Germany - do not need 10 - is there a platform for interested parties?

    Hi,

    the minimum quantity was 10 pcs because the SHTC3 was only available with a minimum of 10. Is there some market place for this item? Like to share the cost with no margin if someone need e.g. 5 pcs in Europe.

    Don't know how it does behave with CC BY-SA 4.0 license and selling these PCBs (w/ or w/o software preinstalled)

    opened by tispokes 3
  • Bad availability of nRF52 module - alternatives?

    Bad availability of nRF52 module - alternatives?

    Hello there, lately I stumbled upon this awesome project and was totally set on building a dozen of those. Unfortunately, the nRF52 Bluetooth module seems to be more than a little elusive right now, in my region starting only at €15 per piece.

    Therefore, my question(s) did you ever consider any alternative Bluetooth modules? Or if not, could you elaborate on the specific features used by the nRF52 module, e.g. the requirements for other modules? Then I could try to adapt the board accordingly.

    opened by sefranz 3
  • Theengs Decoder integration

    Theengs Decoder integration

    Hi @rbaron and all,

    great project! I only stumbled across this recently through another user and have just submitted a decoder PR to Theengs Decoder

    Theengs Decoder

    a BLE decoding library which can be used on micro controllers (ESP32, ESP8266, Arduino), and on Windows or Unix machines. It's also the BLE decoding basis for

    OpenMQTTGateway

    and

    Theengs Gateway

    Hope this helps in getting this project an even wider compatibility.

    Thanks

    opened by DigiH 1
  • Are there J-Link alternatives?

    Are there J-Link alternatives?

    Hi, just wanted to say I love the idea behind this project, and hope to someday obtain some of these for myself.

    I wanted to know if you've ever explored any alternatives to jlink debuggers for programming? Given that these devices aren't really available for sale anywhere (cheaply), if we're expecting everyone to fabricate their own devices, obtaining the debugger is a pretty high hurdle to clear.

    The suggested devices seem to be essentially sold out everywhere, what ones available on ebay look to be $50, and they also come with the annoying EDU restriction that sounds like it makes it essentially illegal to turn around and sell any products you make from it.

    Given that most end users don't really need "debugging" since we aren't developing the firmware, we just need a way to bit-bang in the boot code. Are there other devices or techniques that could achieve this? I see some cheap ARM debuggers on Ali for ~$8 shipped, any idea if something like those work? Is there any way to just bit-bang the interface with a RPI or ESP32 gpio?

    Just wondering if you've ever thought about this, to drive more adoption of this project. For a typical user who might like a handful of these devices (~5?), once you have to acquire your own expensive debugger, it probably becomes cheaper to just buy some MiFlora or something rather than spending the expense to make your own.

    Thanks!

    opened by karwosts 4
  • Add conductivity measurement

    Add conductivity measurement

    It seems that soil conductivity is an indicator for nutrient-content of the soil. If my understanding is correct, it could be realized via a simple soil-resistance measurement, where the electrodes are spaced with a known distance.

    As exposing bare copper would lead to very easy corrosion there, the electrodes could be realised via (stainless steel) screws which are screwed into electrode-screw-holes?

    This would obviously mean a rather large redesign, potentially influencing the current moisture measurement circuit (esp. the capacitor) as well (unless introduced as a second prong?).

    opened by jhbruhn 3
  • Add pushbutton to design

    Add pushbutton to design

    I think it would be useful to have a hardware de-bounced pushbutton added to the design. There appears to be room above the coin cell battery.

    One idea is to have the sensor broadcast an additional data-point of 'dry set point'. When you press/hold the button the current moisture level is published. Then you could use this in automations to know when the plant needs to be watered. Or you could use this value in the sensor code and publish a binary true/false when the current moisture level falls below the set point.

    opened by JoelWise 7
  • Minimal Case Design

    Minimal Case Design

    I've been working on getting a bulk order of these sensors together for a home garden sensing project, and I've noticed that it might be possible to drastically reduce the amount of material used in the case without compromising the overall design. Is there any chance that someone with access to a 3d printer might want to take a crack at prototyping? I'm afraid I'm using an outsourcing service for mine, as I haven't got a printer.

    opened by drspangle 24
  • Battery life estimates using NRF Power Profiler Kit II

    Battery life estimates using NRF Power Profiler Kit II

    These are measurements of hardware version 1.2.x, E73-2G4M08S1E with the latest firmware, no LED blink on wake-up and a 3.0V nominal voltage.

    https://www.nordicsemi.com/Products/Development-hardware/Power-Profiler-Kit-2

    startup: b_parasite_startup

    1 minute of deep sleep: b_parasite_1m_deep_sleep

    wake-up: b_parasite_wakeup

    battery estimates using the above: b_parasite_battery_life

    opened by JoelWise 1
Baseline Arduino shield for temperature, humidity, soil moisture and ambient light

Introduction Green-Shield is an Arduino R3 shield for temperature, humidity, soil moisture and ambient light optimized for use in greenhouses where th

#Eduh 3 Dec 29, 2021
Arduino Sketch and a Web Bluetooth API for loading models and running inference on the Nano Sense 33 BLE device.

TF4Micro Motion Kit This repo contains the Arduino Sketch and a Web Bluetooth API for loading models and running inference on the device. Install and

Google Creative Lab 46 Jun 24, 2022
ControllaBLE - A retro-controllers to Bluetooth BLE adapter

ControllaBLE - A retro-controllers to Bluetooth BLE adapter This is an ESP32 based controller adapter that outputs as a dual joypad through Bluetooth

null 13 Dec 1, 2021
DIY Zigbee CC2530 Motion sensor (AM312/ AM412/ BS312/ BS412), Temperature /Humidity /Pressure sensor (BME280), Ambient Light sensor (BH1750), 2.9inch e-Paper Module

How to join: If device in FN(factory new) state: Press and hold button (1) for 2-3 seconds, until device start flashing led Wait, in case of successfu

Sergey Koptyakov 5 Feb 13, 2022
DIY Zigbee CC2530 Motion sensor (AM312/ AM412/ BS312/ BS412), Temperature /Humidity /Pressure sensor (BME280), Ambient Light sensor (BH1750), 2.9/2.13/1.54 inch e-Paper Module

How to join: If device in FN(factory new) state: Press and hold button (1) for 2-3 seconds, until device start flashing led Wait, in case of successfu

Sergey Koptyakov 24 Jun 28, 2022
Exploits the Wii U's bluetooth stack to gain IOSU kernel access via bluetooth.

BluuBomb Exploits the Wii U's bluetooth stack to gain IOSU kernel access via bluetooth. For a more detailed write-up see WRITEUP.md. Not to be confuse

null 92 Jun 24, 2022
Bluetooth Joystick : A wireless joystick with ESP-32 microcontroller and Dual Axis Joystick Module using the Bluetooth connectivity.

BluetoothJoystick Bluetooth Joystick : A wireless joystick with ESP-32 microcontroller and Dual Axis Joystick Module using the Bluetooth connectivity.

null 9 Feb 24, 2022
Allows for multiple SwitchBot buttons and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Meter/Temp Sensor

SwitchBot-MQTT-BLE-ESP32 Switchbot local control using ESP32. no switchbot hub used/required. works with any smarthub that supports MQTT https://githu

null 244 Jun 29, 2022
Control of 4 DOF robotic arm using Bluetooth HC-05 Sensor

SERV-E -> "At your Service" Problem Statement With the current boom of technology where the whole world is running towards digitisation and automation

Swarup Tripathy 2 Apr 27, 2022
Control Heidelberg Wallbox Energy Control over WiFi using ESP8266 and configure your own local load management

< scroll down for English version and additional information > wbec WLAN-Anbindung der Heidelberg WallBox Energy Control über ESP8266 Die Heidelberg W

null 69 Jun 21, 2022
multispectral monitoring of a sourdough starter; esp32 eink module, scd30 co2 sensor, vl6180 distance sensor

EINK STARTER MONITOR See full blogpost here Tracks height of starter with a VL6180 i2c distance sensor, and CO2/temperature/humidity with an SCD30. A

AKA 15 Feb 16, 2022
Sensirion Mass Flow Sensor Arduino library, modified from MyElectrons and Nabilphysics Arduino repositories for SFM3300 Digital Mass Flow Sensor

Sensirion Mass Flow Sensor Arduino library, modified from MyElectrons and Nabilphysics Arduino repositories for SFM3300 Digital Mass Flow Sensor. When the sensor data gets stuck, the library has a hard reset function to ensure that it is read continuously.

Paul Ryan Santiago 3 Apr 11, 2022
Tasmota-Berry Tank Sensor for fuel-oil usind VL53L1X or SR04 sensor

Tasmota-Tank-Sensor Tasmota-Berry Tank Sensor for fuel-oil volume measurement using an VL53L1X or SR04 sensor The Sensor body The sensor was prepared

Tom Lafleur 2 Feb 10, 2022
My new zigbee project. Wireless temperature and humidity mini sensor with electronic ink display 2.13 inches, low power consumption, compact size, enclosure with magnets.

My new zigbee project. Wireless temperature and humidity mini sensor with electronic ink display 2.13 inches, low power consumption, compact size, enclosure with magnets. The device use SHTC3 sensors, chip CC2530, battery CR2477.

Andrew Lamchenko 13 Feb 22, 2022
A water tank level sensor **Built With WisBlock** to detect overflow and low level conditions.

RAK12014 Laser TOF sensor coming soon WisBlock Watertank Level Sensor Watertank Overflow detection using the RAKwireless WisBlock modules. It implemen

Bernd Giesecke 3 Feb 3, 2022
CC2500 Low-Cost Low-Power 2.4 GHz RF Transceiver driver for esp-idf

esp-idf-cc2500 CC2500 Low-Cost Low-Power 2.4 GHz RF Transceiver driver for esp-idf. I ported from this. 2.00mm pitch External Antena 1.27mm pitch PCB

null 3 May 29, 2022
nrf52832 nrf52810 ble keyboard firmware

BLEKeyboard nrf52832 nrf52810 ble keyboard firmware WHY Learm more about hardware design and engineering. WHAT Implement a full featured powerful and

Jason Zhou 周正昌 38 Jun 18, 2022
sc-ble-bridge is a utility that for every connected Steam Controller creates a virtual one acting as a bridge between SC and Steam

sc-ble-bridge The main goal of this utility is to provide workaround for steam-for-linux issue which makes Valve's Steam Controller unusable in BLE mo

null 5 Apr 19, 2022
WisBlock API takes care of all the LoRaWAN, BLE, AT command functionality

WisBlock-API Targeting low power consumption, this Arduino library for RAKwireless WisBlock Core modules takes care of all the LoRaWAN, BLE, AT comman

Bernd Giesecke 9 May 19, 2022