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_W1 = "1"
Include Python 3 packages used in the examples:
IMAGE_INSTALL:append = " python3-core python3-shell"
Build the core-image-base, flash it to a microSD card
Run the following command to measure and show the temperature for DS18B20:
cat /sys/bus/w1/devices/28-*/w1_slave
Run the following code in the Python 3 interactive shell to measure temperature from DS18B20 1-wire sensor:
gist.github.com/leon-anavi/2874aab81fd0ee83bcaa43280a1010e8
The GitHub pull requests to fix 1-wire for Raspberry Pi 5 in meta-raspberrypi BSP layer:
* master: github.com/agherzan/meta-raspberrypi/pull/1524
* Scarthgap: github.com/agherzan/meta-raspberrypi/pull/1525
⚙️ Hardware
===
ANAVI Gardening uHAT
crowdsupply.com/anavi-technology/anavi-gardening-uhat
eu.mouser.com/c/?q=anavi%20gardening%20uhat
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
Episode 10: Use SPI for ADC and Soil Moisure Sensor on Linux
youtu.be/fQ3ACtPPzE0?si=aSrRBbGpNWAHs2jL
📚 Useful Links
===
yoctoproject.org
docs.yoctoproject.org
openembedded.org/wiki/Main_Page
git.openembedded.org/meta-openembedded
meta-raspberrypi.readthedocs.io/en/latest/extra-build-config.html#enable-one-wire-interface
📑 Chapters
===
0:00 Intro
0:36 Enable 1-wire
2:08 How Does It Work
5:07 Hardware
7:43 Demo
10:24 Water
11:35 Python 3
13:54 Summary
14:34 Conclusions
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_W1 = "1"
Include Python 3 packages used in the examples:
IMAGE_INSTALL:append = " python3-core python3-shell"
Build the core-image-base, flash it to a microSD card
Run the following command to measure and show the temperature for DS18B20:
cat /sys/bus/w1/devices/28-*/w1_slave
Run the following code in the Python 3 interactive shell to measure temperature from DS18B20 1-wire sensor:
gist.github.com/leon-anavi/2874aab81fd0ee83bcaa43280a1010e8
The GitHub pull requests to fix 1-wire for Raspberry Pi 5 in meta-raspberrypi BSP layer:
* master: github.com/agherzan/meta-raspberrypi/pull/1524
* Scarthgap: github.com/agherzan/meta-raspberrypi/pull/1525
⚙️ Hardware
===
ANAVI Gardening uHAT
crowdsupply.com/anavi-technology/anavi-gardening-uhat
eu.mouser.com/c/?q=anavi%20gardening%20uhat
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
Episode 10: Use SPI for ADC and Soil Moisure Sensor on Linux
youtu.be/fQ3ACtPPzE0?si=aSrRBbGpNWAHs2jL
📚 Useful Links
===
yoctoproject.org
docs.yoctoproject.org
openembedded.org/wiki/Main_Page
git.openembedded.org/meta-openembedded
meta-raspberrypi.readthedocs.io/en/latest/extra-build-config.html#enable-one-wire-interface
📑 Chapters
===
0:00 Intro
0:36 Enable 1-wire
2:08 How Does It Work
5:07 Hardware
7:43 Demo
10:24 Water
11:35 Python 3
13:54 Summary
14:34 Conclusions










