Smart gardening with a Raspi and Prometheus

By Francesca Guadagnini - SEPTEMBER 9, 2021


Let’s build a smart gardening system with Prometheus and a Raspberry pi.

Having plants at home can reduce your stress levels and make your home look more delightful. Seeing your indoor oasis growing gives us a sense of accomplishment and makes us feel proud… until you see that first brown leaf. That’s when you start doubting your green fingers.

Plants have different needs, and having a monitoring system that helps you understand their exact moisture levels, as well as the perfect temperature and light, is a great way to see them grow strong and healthy without guessing if we’re doing things right.

What you’ll need

  • Flower Sensors (like these)
  • Raspberry Pi with Bluetooth
  • MicroSD + adapter (to install RaspOS on the Pi)
  • Plants

Some optional accessories you may need depending on your Pi setup are a Micro HDMI/HDMI cable and a USB keyboard.

How does this work

Sensors will send metrics to the Bluetooth receiver on the Raspi. Then, an exporter will parse these metrics and send them to the service Prometheus instance installed on the Raspi. Finally, this Prometheus instance will push the metrics to a Prometheus remote write endpoint to make them available in the long term.

What you’ll monitor

  • Light
  • Moisture
  • Temperature
  • Soil Fertility (thanks to soil conductivity)
  • Battery % (of the sensor)

Before starting the configuration, place your sensors in the soil and check your phone to ensure they are working properly. You may need to adjust their positioning – leaves can cover the sensor and you may receive the light metric as 0, while it’s just a positioning matter.

The next step will be setting up your sensors to communicate with your Pi.

Set up your Raspberry Pi

To get your Pi up and running, all you have to do is to install Raspberry Pi Desktop OS by using Raspberry Pi Imager, following the guided steps, and then connecting it to your WiFi.

Connect your flower sensors

On the Pi, run the following commands:

sudo bluetoothctl
scan on

This will detect the Bluetooth devices around you. Find the flower sensors and take note of their MAC addresses; you’ll need them later when configuring the flower exporter. This is how they’re going to look:

[NEW] Device C4:7C:8D:6B:85:69 Flower care 
[NEW] Device C4:7C:8D:6B:85:62 Flower care

Configure Prometheus and the exporter

You can install Prometheus in your Rasperry following the steps on how to install Prometheus in a Raspberri Pi using docker.

You’ll also need an exporter to collect stats and translate them to a Prometheus format. For this project, you can use flowercare-exporter.

Let’s install it:

git clone

You now need to install Go and build it:

sudo apt-get install golang
go build .

Now, configure the flower exporter service. Here is where you’ll need to paste the MAC addresses detected to associate them with a plant.

Description=Flower exporter
ExecStart=./flowercare-exporter -s your_plant_name=MACaddress

Configure Prometheus remote write

Lastly, you need to configure Prometheus to send metrics to a Prometheus remote write endpoint.

The configuration of your Prometheus server depends on how you installed it. In general, you have to configure the remote_write section in your prometheus.yml configuration file:

  scrape_interval:     10s # By default, scrape targets every 15 seconds.
  evaluation_interval: 10s # By default, scrape targets every 15 seconds.
  scrape_timeout: 10s      # By default, is set to the global default (10s).
  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
      gardener: francesca
# A scrape configuration containing exactly one endpoint to scrape:
  - job_name: 'greendig_plants'
      - targets: ['']
    insecure_skip_verify: true

Now, your metrics received in the Raspi, will be pushed to the Prometheus remote write endpoint!

Easy smart gardening with Prometheus

In this article, you learned how to build a smart gardening solution with Prometheus that helps you assure their moisture, temperature, and light levels are OK. Now you can relax while you see them grow strong and healthy!

Start gardening now with Sysdig

If you want to try this right now, you can sign-up for a Sysdig Monitor free trial to start using Sysdig’s managed Prometheus platform, and its Prometheus remote write endpoint!

Once you configured your Raspi to send metrics to Sysdig’s Prometheus Remote write endpoint, you can log into Sysdig and see how your metrics look in PromQL Explore. You can also be able to filter them by all of the available labels; For example, you can identify your plants by filtering by ‘gardener,’ which is a custom label you previously set in the prometheus.yml.

Let’s see if your plants’ moisture level is OK. You just need to query:


… to have a detailed trend for every plant and see all of the available labels:

How do you know if our moisture, light, and temperature values are OK?

The sensors’ app provides indications for that. It’s easy to identify the correct values for every metric specifying the plant type. These values will be the guide when setting up our alerts for the plants.

Set up your Dashboard

In Sysdig, you can create a Dashboard to keep an eye on your plants and monitor them daily. If you’re familiar with PromQL, you can directly create a Dashboard from PromQL Explore:

Alternatively, you can also create a new Dashboard directly from the Dashboard feature by using the Sysdig interface.

Here’s an example of a Dashboard you could create:

Let’s set up a panel to check the moisture levels for a specific plant. Here’s how you do it:

Create a new Number Panel and first configure the query, using the metric


… and then scope it to a specific plant:

As you can see, the query will inherit the Dashboard Scope and display the value for that plant.

If you are setting a Dashboard shared with friends or family and you want to filter it to only see your plants, you can use the ‘gardener’ filter, which is a custom label you configured in the prometheus.yml.

As a last step, you must set the Thresholds to have visual guidance for when you need to water our plant:

These values are the ones you’ll find in the app, which work well as a guidance.
In this case, our moisture levels are OK, and the panel will display the appropriate color (and emoji!).

Give a voice to your plants

Last but not least, you can be notified when your plants need attention by configuring alerts. You can configure your alerts using PromQL or the Sysdig UI:

Again, all you need to do is set the metric you want to be notified for (in this case, moisture), eventually, scope it to a specific plant, and configure the trigger.

Finally, configure how you want to be notified (there are multiple channels available such as email, Slack, etc.).

Voilà! With Dashboards and Alerts, now you’re all set and you’ll be able to monitor your plants as they grow strong and happy.

Subscribe and get the latest updates