The Yocto Project on Raspberry Pi 5 Episode 10: Use SPI for ADC and Soil Moisure Sensor on Linux @LeonAnavi
The Yocto Project on Raspberry Pi 5 Episode 10: Use SPI for ADC and Soil Moisure Sensor on Linux  @LeonAnavi
Uploaded September 2025 | Updated September 2026, 2 weeks ago
Step-by-step tutorial on enabling SPI (Serial Peripheral Interface) on a Raspberry Pi and using it with a custom Linux image built using the Yocto Project and OpenEmbedded. The examples are based on Yocto LTS release Scarthgap and use the meta-raspberrypi BSP layer. Follow the steps below to repeat the demonstration from the video tutorial:

Add the following line to conf/local.conf to enable SPI:

ENABLE_SPI_BUS = "1"

Include the spidev Python 3 package (used in the examples), along with other helpful tools:

IMAGE_INSTALL:append = " python3-spidev"

Build the core-image-base, flash it to a microSD card, and then run the following code in the Python 3 interactive shell to read values from a capacitive soil moisture sensor through the ADC:

gist.github.com/leon-anavi/58cbe2ddf340a4b243455a7c69e6982b

βš™οΈ Hardware
===
ANAVI Gardening uHAT
crowdsupply.com/anavi-technology/anavi-gardening-uhat
eu.mouser.com/c/?q=anavi%20gardening%20uhat
thepihut.com/products/anavi-gardening-uhat-starter-kit
github.com/AnaviTechnology/anavi-gardening

πŸ”— Related Videos
===
Episode 1: Building an Embedded GNU Linux Distribution
youtu.be/fY7u6PiV8qA?si=goTZ5V7I2dwa33a-
Episode 2: SSH for Remote Network Access
youtu.be/ltckiBV9FXg?si=DJwsKLDhHkDIqCIn
Episode 3: The Yocto Project on Raspberry Pi 5 Episode 3: Running Docker Containers
youtu.be/kQnOidK_U3M?si=5KiS1FK87OwfdQ0m
Episode 4: The Yocto Project on Raspberry Pi 5 Episode 4: U-Boot Bootloader
youtu.be/9tohomiv1Ug?si=kylUv0uT_BFmXt5g
Episode 5: Modifying U-Boot Environment in Linux with fw_setenv
youtu.be/SB5NvIF1IEU?si=0So6Gfv9hQR7gQgY
Episode 6: Runtime Package Management with apt and deb Packages
youtu.be/6i5UtF7fiaA?si=8DuUHUxywVEEtdyN
Episode 7: Create a New Layer, a New Recipe (.bb) and .bbappend
youtu.be/W5J1W_Cy14Y?si=ftu5WpeGqel8BZhf
Episode 8: Using ConnMan Network Manager for Wi-Fi Connectivity
youtu.be/ib8a0PeOGAU?si=jOPOYReA1woIZOJF
Episode 9: Enable I2C and Use SSD1306 Mini OLED Display on Linux
youtu.be/ReqwC9qoIJA?si=nB8qxVxOLwvKXBbR

πŸ“š Useful Links
===
yoctoproject.org
docs.yoctoproject.org
openembedded.org/wiki/Main_Page
meta-raspberrypi.readthedocs.io/en/latest/extra-build-config.html#enable-spi-bus
pypi.org/project/spidev
git.openembedded.org/meta-openembedded
microchip.com/en-us/product/mcp3002

πŸ“‘ Chapters
===
0:00 Intro
0:19 Enable SPI
1:58 How Does It Work
3:45 Hardware
6:14 Demo
13:15 Summary
14:04 Conclusions
The Yocto Project on Raspberry Pi 5 Episode 10: Use SPI for ADC and Soil Moisure Sensor on LinuxUnboxing PcoketBeagle 2 Rev A1: Tiny Linux SBC with Texas Instruments Quad-core 64-bit ARM CPUThe Yocto Project on Raspberry Pi 5 Episode 1: Building an Embedded GNU Linux Distribution #linuxRemote Power Control on Linux: Using Wake-on-LAN with UbuntuWhich transceiver is used for Ethernet in the Raspberry Pi 400? #BCM54213 #raspberrypi #rpiRaspberry Pi Compute Module 5 IO Board and IO Case with External Antenna #raspberrypiUpgrading U-Boot Bootloader on La Frite AML-S805X-AC with USB Stick or USB Boot ModeKeyboard Matrix on Raspberry Pi 400 #raspberrypi #rpiFirmware Updater on Ubuntu Simplifies UEFI BIOS Upgrade for Linux Users: Demo with ThinkPad T490Live: ThinkPad T490 Battery ReplacementUnboxing Neo6502 Modern Open Source Retro Computer with 6502 8-bit CPU and Raspberry Pi RP2040Flashing Raspberry Pi OS from Raspberry Pi 5 to Raspberry Pi Compute Module 4 (CM4) eMMC #shorts
Leon Anavi |

The Yocto Project on Raspberry Pi 5 Episode 10: Use SPI for ADC and Soil Moisure Sensor on Linux

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER