E-Book, Englisch, 376 Seiten
Yamanoor Raspberry Pi Pico DIY Workshop
1. Auflage 2022
ISBN: 978-1-80181-066-1
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection
Build exciting projects in home automation, personal health, gardening, and citizen science
E-Book, Englisch, 376 Seiten
ISBN: 978-1-80181-066-1
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection
The Raspberry Pi Pico is the latest addition to the Raspberry Pi family of products. Introduced by the Raspberry Pi Foundation, based on their RP2040 chip, it is a tiny, fast microcontroller that packs enough punch to power an extensive range of applications. Raspberry Pi Pico DIY Workshop will help you get started with your own Pico and leverage its features to develop innovative products.
This book begins with an introduction to the Raspberry Pi Pico, giving you a thorough understanding of the RP2040's peripherals and different development boards for the Pico designed and manufactured by various organizations. You'll explore add-on hardware and programming language options available for the Pico. Next, you'll focus on practical skills, starting with a simple LED blinking project and building up to a giant seven-segment display, while working with application examples such as citizen science displays, digital health, and robots. You'll also work on exciting projects around gardening, building a weather station, tracking air quality, hacking your personal health, and building a robot, along with discovering tips and tricks to give you the confidence needed to make the best use of RP2040.
By the end of this Raspberry Pi book, you'll have built a solid foundation in product development using the RP2040, acquired a skillset crucial for embedded device development, and have a robot that you built yourself.
Autoren/Hrsg.
Fachgebiete
Weitere Infos & Material
Table of Contents - Getting Started with the Raspberry Pi Pico
- Serial Interfaces and Applications
- Home Automation Projects
- Fun with Gardening!
- Building a Weather Station
- Designing a Giant Seven-Segment Display
- Designing a Visual Aid for Tracking Air Quality
- Building Wireless Nodes
- Let's Build a Robot!
- Designing TinyML Applications
- Let's Build a Product!
- Best Practices for Working with the Pico
Chapter 1: Getting Started with the Raspberry Pi Pico
In this chapter, we would like to delve into a quick introduction to the Raspberry Pi Pico and the RP2040 microcontroller. We will discuss the Raspberry Pi Pico's features, the RP2040's peripherals, the add-on hardware for the Pico, and development boards for the RP2040 developed by other makers. We will also discuss the programming language options available for the Pico and supplement the chapter by discussing a simple example where we print something to the screen and blink a light-emitting diode (LED).
By the end of this first chapter, you will have gotten started with the Pico and will be ready to start programming the RP2040 microcontroller and start planning to implement projects from the later chapters of this book, as well as thinking ahead to how you can tackle your own projects with the Raspberry Pi Pico!
We are going to cover the following main topics:
- Introducing the Raspberry Pi Pico and RP2040
- Discussing variants of the Pico board
- Soldering the Pico's headers
- Implementing the "Hello World!" example
- Implementing the LED-blinking example
- Identifying useful add-on hardware for the Pico
Technical requirements
The hardware and software required for this introductory chapter will be used throughout the book. In further chapters, we will provide any additional or chapter-specific requirements.
The hardware requirements are listed as follows:
- A laptop or a Raspberry Pi with a Universal Serial Bus (USB) port
- : Soldering equipment including iron, solder, safety glasses, and miscellaneous equipment
- : Prototyping breadboard and a jumper wire kit
Code in Action videos for this chapter can be viewed at https://bit.ly/3MRdYjx.
Introducing the Raspberry Pi Pico and RP2040
The Raspberry Pi Pico is the latest educational and industrial tool introduced by the Raspberry Pi Foundation. The Pico, a low-cost microcontroller, costs USD 4, and even at the low price point, the Pico packs quite a punch. The Pico is centered on the RP2040, a dual-core Cortex-M0+ microcontroller. The board comes with a total of 40 pins, where there are 20 pins on each side, as shown in the following screenshot. The Pico also comes with 2 MB of onboard flash memory and an LED on the GP25 (GP refers to General Purpose Input/Output) button.
Figure 1.1 – Raspberry Pi Pico
The datasheet for the Raspberry Pi Pico is available from here: https://bit.ly/3cwv1Ic. In this book, we will be making use of the different peripherals available on the Pico in the projects discussed in each chapter. Hence, it is handy to print the pinout provided by the Raspberry Pi foundation (source: https://bit.ly/3wa0nwq). This pinout sheet can help with pin selection during project planning. A screenshot of the pinout from Adafruit Industries is shown next. You can purchase them for USD 0.50 from their website.
Figure 1.2 – Pico pinout (Image source: Adafruit Industries; License: CC BY-SA 3.0)
The Pico board can be used in various applications involving robots, remote monitoring, citizen science, and so on. In this book, we will walk you through different application examples while exploring the peripherals of the RP2040 microcontroller.
RP2040 microcontroller
The RP2040 is a dual-core ARM Cortex-M0+ microcontroller with 264 kilobytes (KB) of static random-access memory (SRAM) but does not have have in-built flash memory. The RP2040 comes with a volley of peripherals including Inter-Integrated Circuit (I2C), Serial Peripheral Interface (SPI), and Programmable Input/Output (PIO). The PIO on the RP2040 microcontroller enables you to design your own interface, such as an additional universal asynchronous receiver-transmitter (UART) interface or a video interface. In , , we will discuss using the PIO peripheral.
Here is a list of the resources for RP2040:
- The datasheet for the RP2040 is available at the following link:
- The datasheet for the Raspberry Pi Pico is available at the following link:
- A video from the Raspberry Pi foundation on the RP2040's PIO can be found at the following link:
- Resources for the RP2040 from the Raspberry Pi Foundation can be found by visiting the following link:
We recommend that you download Pico's datasheet along with the RP2040 datasheet. It will come in handy as a reference during development, and we will refer you to the datasheet at certain points in this book for more information.
Discussing variants of the Pico board
Since the launch of the Raspberry Pi Pico, there have been several developer board variants that include the RP2040 from various open hardware companies. These are boards that come with the RP2040 microcontroller and they are outlined in more detail here:
- SparkFun Thing Plus – RP2040 (USD 17.95): This is an open source development board from SparkFun (https://bit.ly/2NS5vUn). The Thing Plus comes in the Feather form factor from Adafruit. Something unique about this board is that it comes with a microSD card holder and an individually addressable RGB LED. If you are not familiar with the Feather form factor, it simplifies prototyping due to its stacking capability and the ecosystem of prototyping tools available in the Feather form factor. In the following screenshot, you can notice the top (on the right) and bottom (on the left) sides of the RP2040 Thing Plus board:
Figure 1.3 – SparkFun Thing Plus (RP2040)
- SparkFun MicroMod RP2040 Processor (USD 11.95): This is another variant from SparkFun (https://bit.ly/3clp0hG). It comes with 16 MB of onboard flash memory. It comes in the MicroMod form factor that makes use of the M.2 standard. In the following screenshot, you can find the top and bottom sides of the RP2040 MicroMod board. You will notice a notch in a half-moon shape that is used to fasten the board to a carrier board using an M2.5 screw:
Figure 1.4 – MicroMod RP2040 Processor
SparkFun also makes carrier boards for the MicroMod ecosystem. For example, the carrier board (https://bit.ly/3cnlrHF) shown in the following screenshot was designed to drive a high-definition multimedia interface (HDMI) display using the RP2040:
Figure 1.5 – MicroMod Big Display Board for the RP2040 processor
- SparkFun Pro Micro – RP2040 (USD 9.95): The Pro Micro – RP2040 board (https://bit.ly/3cnhVgH) is a variant that belongs to the relatively small ecosystem of the Pro Micro family of boards. It comes with 16 MB of flash, individually addressable RGB LEDs, and castellated pads that enable soldering the module directly onto another printed circuit board (PCB). The castellated pins of the Pro Micro are shown in the following screenshot:
Figure 1.6 – SparkFun Pro Micro – RP2040
- Pimoroni Tiny 2040 (USD 11.55): This board from Pimoroni (https://bit.ly/3d9f7Tf) is about the size of a quarter and comes with 8 MB of flash and an RGB LED. The castellated pads enable it to be soldered onto your custom PCB directly. We must point out that you will need a cutout to solder the board onto your custom board. This is because the microcontroller in this development board is on the bottom side, as shown in the following screenshot. We will demonstrate using this board on your custom PCB.
Figure 1.7 – Pimoroni Tiny 2040
- Adafruit Feather RP2040 (USD 11.95): As the name indicates, this board from Adafruit (https://bit.ly/3cm3tW0) is a board for the RP2040 microcontroller. As with the SparkFun Thing Plus, it packs a punch with a / connector and comes with 8 MB of flash. At the time of writing this book, this board was out of stock. Here's a screenshot showing the board:
Figure 1.8 – Adafruit Feather RP2040
- Adafruit ItsyBitsy RP2040 (USD 9.95): This board...