4/2/2022

Raspberry Pi Slot Machine Image

In this post, we are going to discuss preparing Linux minimal boot image for Raspberry Pi 4 using the Yocto/OpenEmbedded build system. You can use the steps discussed here for Raspberry Pi 1/2/3 by changing the machine selection during the Yocto build configuration.

Prerequisites

  • Raspberry Pi (/ p aɪ /) is a series of small single-board computers developed in the United Kingdom by the Raspberry Pi Foundation in association with Broadcom. Early on, the Raspberry Pi project leaned towards the promotion of teaching basic computer science in schools and in developing countries.
  • Image Recognition With TensorFlow on Raspberry Pi: Google TensorFlow is an Open-Source software Library for Numerical Computation using data flow graphs. It is used by Google on its various fields of Machine Learning and Deep Learning Technologies.
  1. Ubuntu 18.04 is recommended for the current latest Yocto release Dunfell 3.1.1 (This is the latest release at the time of writing this post). Ubuntu 16.04 users should install Yocto buildtools as discussed below.
  2. Please refer Yocto quick build doc for other supported host OS and required host packages.
  3. Raspberry Pi 1/2/3/4
  4. Micro USB Power Cable ( USB Type C for Raspberry Pi 4)
  5. Monitor with HDMI interface
  6. Standard HDMI Cable ( Micro HDMI for Raspberry Pi 4)
  7. MicroSD card with an SD card reader
  8. USB Keyboard and USB Mouse
  9. Ethernet patch cable if you are planning to use the wired network

The Raspberry Pi is a powerful tool when it comes to artificial intelligence (AI) and machine learning (ML). Its processing capabilities, matched with a small form factor and low power requirements, make it a great choice for smart robotics and embedded projects.

Setup Yocto build environment

In this post, we will be using Ubuntu 16.04 Host OS. For other supported Host OS and required host packages please refer Yocto quick build doc

Install required host packages

Clone Yocto Poky

The poky is the reference distribution of Yocto/OpenEmbedded build system.

Checkout Yocto poky dunfell 3.1.1 release

Install Yocto Build tools

Setup Yocto build tools environment

Clone ‘meta-raspberry’ Yocto BSP layer for Raspberry Pi board support

Initiate build environment

Add ‘meta-raspberrypi’ layer to the bblayers.conf

Find machine name for Raspberry Pi 4

From the above listing, machine name corresponding to Raspberry Pi 4 is ‘raspberrypi4’

Configure machine name

In our case, our machine name is ‘raspberrypi4’, configure this machine name in local.conf file located at ‘conf’ directory under ‘poky/build_rpi’ folder, as shown in the following figure.

Trigger the build

It takes some time to complete based on your system performance.

Build output images are available at the following location

Write boot images on an SD card

  • Connect micro SD card using the SD card reader to your PC
  • Detect the connected SD card device using dmesg and lsblk commands

Generally, a micro sd card is detected as /dev/mmcblkX or /dev/sdX, where X value as per the device. Find your recently connected micro sd card using dmesg command

  • Find whether SD card has any mounted partitions

Here sda is the hard disk and sdb is the SD card

  • unmount mounted SD card partitions if any.

In my case, two sd card partitions ‘/dev/sdb1’ and ‘/dev/sdb2’ are mounted. I am going to unmount using the ‘umount’ command

Now we are going to write ‘core-image-base-raspberrypi4.wic’ image using ‘bmaptool’

If your system doesn’t have ‘bmaptool’ command installed, you can install ‘bmap-tool’ package using ‘apt install’ command as below

Connecting and booting the Raspberry Pi

  • Insert your flashed Micro SD card to the slot at the bottom side of your Raspberry Pi marked as ‘MICRO SD CARD’.
  • Connect USB keyboard
  • Connect HDMI cable
  • For Raspberry PI 4, connect Micro HDMI cable to the port marked as ‘HDMI0’
  • Connect Micro USB power adapter
  • For Raspberry PI 4, connect USB Type C power adapter to the port marked as ‘POWER IN’

Now we are done with all physical connections to our Raspberry Pi. Power up your connected Monitor and Raspberry Pi, Now Linux should boot up!

Google AI Education

Slot

The Raspberry Pi is a powerful tool when it comes to artificial intelligence (AI) and machine learning (ML). Its processing capabilities, matched with a small form factor and low power requirements, make it a great choice for smart robotics and embedded projects. Google is a champion of the Pi’s place in the AI world, its AIY voice recognition system being given away with this very magazine (issue 57, no longer available in print).

You can now buy Google's AIY projects and newer Coral AIY products for Raspberry from Mouser.co.uk

Google’s AI Education site is an ideal place to start your machine-learning journey. If you want to really understand how AI/ML works ‘under the hood’, there are lot of principles to comprehend before you even get to coding. Google has provided a self-guided suite that starts with a ‘Crash Course’ in machine learning, then expands to cover the basics of problem framing and data gathering. The main online course comprises 25 lessons over 15 hours (approximately, you can set your own pace) and comes in the form of reading materials, interactive sections, programming exercises, and video tutorials. This is then backed by a substantial collection of follow-on courses. A superb resource.

See also:

Complete Guide to TensorFlow for Deep Learning with Python

TensorFlow is, without a doubt, the most popular software library for machine learning on the Raspberry Pi. If you’re keen to get started and write code, TensorFlow will probably be your tool of choice. You can get a great introduction to TensorFlow in The MagPi #71, but if you are after a deep dive, Udemy offers a comprehensive 14-hour video course that covers not only the theory of machine learning, but also the practicalities of setting up the software with real-world examples and programming exercises. If you’re after a hands-on learning approach, this may well suit. Don’t be put off by the steep (£195) price – this course is often promoted and was £13 at time of writing.

Raspberry Pi Slot Machine Image Tool

Beginning Artificial Intelligence with the Raspberry Pi

This book is perfectly tailored to the Raspberry Pi community. Not only does it cover the principles behind concepts such as neural networks, fuzzy logic, and shallow versus deep learning, it also provides practical, fun projects to code and build. Starting with simple examples of learning, you can play your Pi at noughts-and-crosses and Nim. Along the way, the projects are made fun through the use of the Pi’s GPIO header, using LEDs and switches to bring code to life. You then progress to robotics, covering obstacle avoidance and light seeking. A steady learning curve culminates in the building of ‘Alfie’, your very own artificially intelligent robot vehicle. If you fancy building the winner of the next Pi Wars, this could be the perfect reading material.

Essential bookmarks: Providers of popular AI/ML tools

  • Google Coral: Recently featured in The MagPi #79, this exciting new USB accelerator from Google transforms the Raspberry Pi’s AI capabilities by adding a dedicated neural network processor. Also, don’t miss Google’s Coral AIY site.
  • OpenCV: The tool of choice for many robot builders, the Open Source Computer Vision Library not only gives your Pi sight, but the ability to ‘comprehend’ what it sees. A powerful tool for intelligent object recognition.
  • TensorFlow: If you want implement machine learning on a Pi, chances are you’ll be using TensorFlow to do it. The official site not only features full documentation, but also a range of courses

Learn by example: Do you learn by doing? Try these

Raspberry Pi Slot Machine Image Free

  • How to Build DIY AI Projects Using Google TensorFlow and Raspberry Pi. A collection of AI/ML projects to build or provide inspiration. From introductions to TensorFlow to a wide range of projects including magic mirrors and an impressive cucumber sorting machine!
  • AI on Raspberry Pi with the Intel Neural Compute Stick. Like Google, Intel has also released a USB-based neural co-processor. This tutorial is a great ‘getting started’ guide, talking you throughinstallation and on to your first facial recognition app.
  • Raspberry Pi Pokédex. PyImageSearch is an incredible resource for learning OpenCV. This detailed tutorial is ideal for younger minds, using a Pi and the official touchscreen to create a Pokédex that can ‘recognise’ plush Pokémon.