Building Smarter Gardens with ANAVI Gardening uHAT and the Yocto Project

If you have ever wanted to turn your Raspberry Pi into a smart gardening assistant, our ANAVI Gardening uHAT is a simple, low-cost way to get started. This open source add-on board makes it easy to monitor and care for your plants with sensors for soil moisture, temperature, humidity, barometric pressure, and light. Best of all, there is no soldering, special tools, or complicated setup. Just plug the board into your Raspberry Pi with your bare hands, follow the user manual, and you are ready to go. First introduced in 2021 through a successful Crowd Supply campaign, the ANAVI Gardening uHAT is now widely available through distributors such as Mouser Electronics. While the official documentation is based on Raspberry Pi Operating System, the board works with any Raspberry Pi single-board computer and any Linux distribution designed for it. This makes the ANAVI Gardening uHAT not just a hobbyist gadget, but also a versatile tool for anyone experimenting with Internet of Things (IoT), agricultural technology, or embedded Linux.

The Yocto Project Meets Raspberry Pi Gardening

In early 2025, Leon Anavi, the creator of the ANAVI Gardening uHAT, launched a new series of video tutorials on the Yocto Project and OpenEmbedded. These tools, maintained under the Linux Foundation, have become the industry standard for building custom Linux distributions for embedded devices.

In episode 10 from September 2025, Leon demonstrates how to enable the Serial Peripheral Interface (SPI) on a Raspberry Pi and use it with the Microchip MCP3002 10-bit analog-to-digital converter (ADC) integrated into the ANAVI Gardening uHAT. This allows you to connect analog sensors, such as a capacitive soil moisture sensor, and read their data in real time.

Step-by-Step: Enabling Serial Peripheral Interface with Yocto

If you want to try the tutorial yourself, here is a simplified version of the steps Leon used in the video. These examples are based on the Yocto Long Term Support (LTS) release Scarthgap and use the meta-raspberrypi board support package (BSP) layer.

  1. Enable Serial Peripheral Interface support
    Add the following line to your conf/local.conf: ENABLE_SPI_BUS = "1"
  2. Include required Python packages
    Extend your Linux image with the spidev library (used in the examples), plus some helpful tools: IMAGE_INSTALL:append = " python3-spidev"
  3. Build and flash your image
    Build the core-image-base, flash it to a microSD card, and boot your Raspberry Pi.
  4. Run Python code to read sensor values
    Open a Python 3 interactive shell and use this example code snippet to start reading data from a capacitive soil moisture sensor through the MCP3002 analog-to-digital converter.

Why This Matters

This combination of ANAVI Gardening uHAT and the Yocto Project is more than just a fun do-it-yourself experiment. It is a hands-on way to learn about:

  • Embedded Linux development
  • Custom Raspberry Pi distributions
  • Practical Internet of Things (IoT) applications in agriculture

For hobbyists, it means you can monitor your houseplants or small garden with open source hardware and software. For professionals, it is a chance to explore how Yocto-powered Linux images can streamline development in real-world embedded projects.

You may also like

Add Capacitive Soil Moisture Sensors to Raspberry Pi

Raspberry Pi is a famous series of small single-board computers (SBCs) developed in the United Kingdom by the Raspberry Pi Foundation in cooperation with Broadcom. This is a step by step tutorial for using Raspberry Pi and capacitive soil moisture sensor with Microchip MCP3002 analog-to-digital converter (ADC) and a Python script for detecting the soil moisture in percentage.

Capacitive Soil Moisture Sensor

Capacitive Soil Moisture Sensor v1.2 and v2.0 measures the volumetric content of water inside the soil and retrieves the moisture level by capacitive sensing rather than resistive sensing like other sensors. The benefit of using a capacitive soil moisture sensor is the lack of corrosion and longer lifespan.

Wiring

Unlike Raspberry Pi Pico, the recently released microcontroller, all versions and models of the Raspberry Pi single-board computers do not include an analog-to-digital converter (ADC). This tutorial explains how to use Microchip MCP3002 with Raspberry Pi.

Microchip MCP3002 is a 10-bit resolution, dual channel ADC with SPI hardware bus. It can be connected to any Raspberry Pi single board computer version and model, including Raspberry Pi 4 and Raspberry Pi 0. However, this tutorial is not for Raspberry Pi Pico microcontroller. For more details about the wiring of Microchip MCP3002 a Raspberry Pi single-board computer have a look at my previous tutorial.

Prototypes for Raspberry Pi add-on boards

Alternatively, the easier option without a breadboard an a bunch of cables, is to use a dedicated Raspberry Pi add-on board with built-in ADC. Using the free and open source tool KiCad we designed ANAVI Gardening uHAT exactly for this purpose. It has dedicated pins for connecting a couple of capacitive soil moisture sensors. The prototype has been created thanks to PCBWay. This is a lead-free prototype printed circuit board with 2 layers, green solder mask and white silkscreen. PCBway offers a huge variety of colors and even flexible PCB.

Software

Flash Raspberry Pi OS, the official Debian based GNU Linux distribution by the Raspberry Pi, on microSD card and boot it. On the Raspberry Pi, open a terminal and using the raspi-config tool enable SPI as shown in the video. Reboot the Raspberry Pi.

Python3 script for reading data from a couple of capacitive soil moisture sensors through Microchip MCP3002 ADC is available at the anavi-examples repository in GitHub. The script relies on popular Python libraries spidev and RPi.GPIO. Open a terminal and run the following commands to clone anavi-examples and run the script:

git clone https://github.com/AnaviTechnology/anavi-examples.git
cd anavi-examples/anavi-gardening-uhat/soil-moistore-sensors/python/
python3 soil-moistore-sensors.py

You may also like