Raspberry Pi Pico DIY Workshop

Book description

Take your first steps with the Raspberry Pi Pico and take on exciting projects using CircuitPython, MicroPython, and Pico

Key Features

  • Make the most of the Raspberry Pi Pico—a low-cost microcontroller that is primed for innovation
  • Work with easy-to-follow examples and learn how to interface and program a Raspberry Pi Pico
  • Work on fun projects, right from home automation to building a seven-segment display to tracking air quality

Book Description

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.

What you will learn

  • Understand the RP2040's peripherals and apply them in the real world
  • Find out about the programming languages that can be used to program the RP2040
  • Delve into the applications of serial interfaces available on the Pico
  • Discover add-on hardware available for the RP2040
  • Explore different development board variants for the Raspberry Pi Pico
  • Discover tips and tricks for seamless product development with the Pico

Who this book is for

This book is for students, teachers, engineers, scientists, artists, and tech enthusiasts who want to develop embedded systems that drive cost-effective automation, IoT, robotics, medical devices, and art projects. If you consider yourself a maker and would like to learn how to use the Raspberry Pi Pico, then this book is for you. Familiarity with Python programming, MicroPython, CircuitPython, embedded hardware, and peripherals is helpful but not mandatory to get the most out of this book.

Publisher resources

Download Example Code

Table of contents

  1. Raspberry Pi Pico DIY Workshop
  2. Contributors
  3. About the authors
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Code in Action
    6. Download the color images
    7. Conventions used
    8. Get in touch
    9. Share your thoughts
  6. Section 1: An Introduction to the Pico
  7. Chapter 1: Getting Started with the Raspberry Pi Pico
    1. Technical requirements
    2. Introducing the Raspberry Pi Pico and RP2040
      1. RP2040 microcontroller
    3. Discussing variants of the Pico board
      1. Where to buy the Pico
    4. Soldering the Pico's headers
      1. Soldering the headers
    5. Implementing the "Hello World!" example
      1. MicroPython
    6. Implementing the LED-blinking example
      1. Description of the code sample
      2. CircuitPython example
      3. Launching Mu
      4. Second LED-blinking example
      5. CircuitPython or MicroPython?
    7. Identifying useful add-on hardware for the Pico
      1. Pico Breadboard Kit (USD 19.31)
      2. Pico GPIO Expansion Board (USD 10.34)
      3. Pico HAT Expansion (USD 13.79)
      4. Grove Shield for Pi Pico (USD 3.90)
      5. Pimoroni Pico Decker (Quad Expander) (USD 16.55)
    8. Summary
  8. Chapter 2: Serial Interfaces and Applications
    1. Technical requirements
    2. Installing requisite libraries
      1. HTU21D-F temperature sensor
      2. DHT20 temperature and humidity sensor
      3. OLED display (driven by SSD1306)
      4. Wireless pack
    3. Using the UART interface to communicate between two Pico boards
      1. The UART interface
      2. Setting up the Pico
      3. Programming the Pico boards
      4. Testing the code
      5. Applications of the UART interface
    4. Interfacing sensors using the I2C interface
      1. Introduction to the I2C interface
      2. Pull-up resistors
      3. Testing the HTU21D-F temperature sensor
      4. HTU21D-F temperature sensor code
      5. Testing the DHT20 temperature sensor
      6. AHT20 temperature sensor code
      7. The Feather RP2040 board
      8. Troubleshooting
    5. Displaying temperature data using the SPI
      1. The Serial Peripheral Interface (SPI)
      2. Wiring up the display
      3. Displaying the temperature and humidity data
      4. The LILYGO RP2040 board
    6. Setting up the wireless pack
    7. Summary
  9. Chapter 3: Home Automation Projects
    1. Technical requirements
    2. Installing the requisite libraries
      1. NeoPixel
      2. Wireless pack
    3. Interfacing sensors
    4. Controlling appliances
    5. Publishing sensor events to the cloud
      1. Setting up Adafruit IO
      2. Publishing events
    6. Controlling LED strips
    7. Introducing the RP2040 Connect
    8. Installing CircuitPython on the RP2040 Connect
      1. Connecting the RP2040 to the internet
    9. Summary
  10. Chapter 4: Fun with Gardening!
    1. Technical requirements
    2. Why gardening?
    3. Installing the requisite libraries
      1. Soil sensor
      2. Wireless pack
      3. NeoPixel
    4. Setting up the soil sensor
    5. Setting up the wireless pack
    6. Setting up the NeoPixel LED
    7. Publishing data to ThingSpeak
    8. Putting it all together
    9. Summary
  11. Section 2: Learning by Making
  12. Chapter 5: Building a Weather Station
    1. Technical requirements
    2. Conducting citizen science experiments
    3. Installing the requisite libraries
      1. The AM2315 sensor
      2. BME280 sensor
      3. VEML6075 UV light sensor
    4. Testing the sensors
      1. Testing the BME280 sensor
      2. Testing the AM2315 temperature/humidity sensor
      3. Testing the VEML6075 sensor
      4. Testing the weather meter sensors
      5. Testing the wireless pack
    5. Assembling and testing the weather station
      1. Next steps
    6. Summary
  13. Chapter 6: Designing a Giant Seven-Segment Display
    1. Technical requirements
    2. Inspiration for the project
      1. Potential use cases
    3. Installing the required libraries
      1. Wireless pack
    4. Selecting a seven-segment display
    5. Wiring up the giant seven-segment display
    6. Writing the drivers for the giant seven-segment display
    7. Using the display
      1. Simple web server
      2. Serial port example
      3. Tracking physical activity
    8. Putting it all together
    9. Summary
  14. Chapter 7: Designing a Visual Aid for Tracking Air Quality
    1. Technical requirements
    2. Inspiration for the project
    3. Installing requisite libraries
      1. Stepper motor
      2. Wireless pack
      3. SCD30 CO2 sensor
    4. Using public data sources for air quality data
      1. Running the query on a Pico
    5. Interfacing a CO2 sensor with the Pico
    6. Interfacing the stepper motor
    7. Building the display
      1. Making an interactive display
    8. Summary
  15. Section 3: Advanced Topics
  16. Chapter 8: Building Wireless Nodes
    1. Technical requirements
    2. Installing requisite libraries
      1. Adafruit Bluefruit LE SPI Friend
      2. Optional – the LoRa module
      3. Optional – the CO2 sensor
    3. Interfacing a Bluetooth Low Energy module
      1. Publishing sensor data via the Bluetooth module
    4. Interfacing a Sigfox module
      1. What is Sigfox?
      2. Sigfox module
      3. Setting up the Sigfox module
    5. Interfacing a LoRa module
      1. What is LoRa?
      2. Considering an example scenario
    6. Summary
  17. Chapter 9: Let's Build a Robot!
    1. Technical requirements
    2. Installing the prerequisites
      1. Installing the batteries
    3. Controlling the LEDs
    4. Motor selection and control
      1. DC motors
      2. Stepper motors
      3. Servo motors
      4. DC motor control
      5. Servo motor control
    5. Testing the sensors
      1. Ultrasonic sensor
      2. Line-following sensor
    6. Testing the robot
      1. Robotics contests
    7. Summary
  18. Chapter 10: Designing TinyML Applications
    1. Technical requirements
      1. Optional hardware
    2. Introducing TinyML
      1. Introducing the Pico4ML
    3. Keyword recognition in audio samples
      1. Edge Impulse
    4. Classifying images
    5. Developing edge devices
    6. Summary
  19. Chapter 11: Let's Build a Product!
    1. Technical requirements
    2. Understanding the Pico phone
    3. Capturing the requirements
      1. Selecting components
      2. Building a proof-of-concept
      3. Installing the requisite libraries
      4. Testing the Notecard
      5. Testing the keypad
    4. Designing a PCB
      1. Schematic capture
      2. PCB layout
      3. Enclosure selection
      4. Gerber file generation
      5. Board fabrication
      6. Assembling the PCB
    5. Bringing up the board
      1. Final assembly and testing
    6. Taking the project forward
      1. Replacing the Pico
      2. Pimoroni PGA2040 – USD 9.05
      3. RP2040 Stamp – USD 14.55
    7. Summary
  20. Chapter 12: Best Practices for Working with the Pico
    1. Technical requirements
    2. Upgrading your Pico's firmware
    3. Programming the Pico using the Arduino IDE
      1. Downloading and installing the Arduino IDE
      2. Installing a board package for the Pico
    4. Programming in C/C++ using the Pico SDK
      1. Debuggers for the Raspberry Pi Pico
    5. Tools to aid with prototyping and product development
      1. Breadboard with Pico's pinout labels
      2. Power profiling your application
      3. Nordic Power Profiler Kit – USD 81.25
      4. Joulescope – USD 999
      5. Programming the PIOs
    6. Summary
    7. Why subscribe?
  21. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share your thoughts

Product information

  • Title: Raspberry Pi Pico DIY Workshop
  • Author(s): Sai Yamanoor, Srihari Yamanoor
  • Release date: May 2022
  • Publisher(s): Packt Publishing
  • ISBN: 9781801814812