𝔖 Scriptorium
✦   LIBER   ✦

📁

Beginning MicroPython with the Raspberry Pi Pico: Build Electronics and IoT Projects

✍ Scribed by Charles Bell


Publisher
Apress
Year
2022
Tongue
English
Leaves
648
Series
Maker Innovations Series
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Program the Raspberry Pi Pico, the latest microcontroller board from raspberrypi.org, with MicroPython. This book will take you on a tour of the Raspberry Pi Pico, including how to get started using the microcontroller, seeing which alternative microcontrollers are available, and how to connect and run simple code examples.
You’ll program example projects in MicroPython using Python on your PC as a learning platform. Then build your hardware skillset working with electronics and breadboard circuits. You'll implement example projects with all steps explained, including hardware connections and executing the project. Then apply them to real-world, approachable projects using the accessible Raspberry Pi Pico!
The book shows how the cloud is used for IoT data and find out what popular cloud systems currently exist for IoT. Finally, you'll use ThingSpeak for hosting IoT data including connecting your Pico to the Internet.
Beginning MicroPython with the Raspberry Pi Pico allows you to build up your skills to more advanced IoT projects and Cloud systems!
What You Will Learn

  • Build valuable programming skills with MicroPython
  • Explore the Raspberry Pi Pico and similar boards
  • Develop your own electronics and IOT projects
  • Incorporate the Grove component system with the Raspberry Pi Pico

Who This Book Is For
Beginners interested in learning to work with the Raspberry Pi Pico using MicroPython on microcontrollers with little to no experience in programming, hardware, or electronics. The book should also appeal to those who wanting to gain experience with building electronic solutions with microcontrollers.

✦ Table of Contents


Table of Contents
About the Author
About the Technical Reviewer
Acknowledgments
Introduction
Chapter 1: Introducing the Raspberry Pi Pico
What Is a Microcontroller?
A Tour of the Raspberry Pi Pico
Introducing the RP2040
Pico Hardware Overview
RP2040-Based Alternatives
Adafruit Feather 2040
Adafruit ItsyBitsy RP2040
Adafruit QT Py
SparkFun Pro Micro – RP2040
SparkFun Thing Plus – RP2040
SparkFun MicroMod Pi RP2040 Processor
Arduino Nano RP2040 Connect
Pimoroni Pico LiPo
Getting Started with the Pico
Where to Buy
Required Accessories
Optional and Recommended Accessories
Preparing Your Computer
Installing MicroPython on the Pico
Manual Install
Using Thonny
Connecting to the Pico
Using the REPL Console with a Serial Communication Utility
Starting the REPL Console (macOS and Linux)
Connecting to the Pico with Thonny
Summary
Chapter 2: Introducing MicroPython
Getting Started
Origins
MicroPython Features
MicroPython Limitations
What Does MicroPython Run On?
Experimenting with Python on Your PC
Installing Python 3 on Windows 10
Installing Python 3 on macOS
Installing Python 3 on Linux
Running the Python Console
Running Python Programs with the Interpreter
How It Works
File Operations with a Utility
File Operations with Thonny
Off and Running with MicroPython
Example 1 – Blink the LED
Example 2 – Toggle the LED
Example 3 – Timer
Saving Your Work
Summary
Chapter 3: How to Program in MicroPython
Basic Concepts
Code Blocks
Comments
Arithmetic
Output to Screen
Variables and Statements
Types
Basic Data Structures
Lists
Tuples
Dictionaries
Statements
Conditional Statements
Loops
Modularization
Including Modules
Functions
Classes and Objects
Object-Oriented Programming (OOP) Terminology
Python Object Syntax
Learning Python by Example
How Do I Create and Execute Python Files?
Example 1: Using Loops
Write the Code
Execute the Code
Your Challenge
Example 2: Using Complex Data and Files
Write the Code
Execute the Code
Your Challenge
Example 3: Using Functions
Write the Code
Execute the Code
Your Challenge
Example 4: Using Classes
Write the Code
Execute the Code
Your Challenge
For More Information
Summary
Chapter 4: Low-Level Hardware Support
The Pico GPIO Header
MicroPython Libraries
Built-In and Standard Libraries
Overview
sys
uio
ujson
uos
Built-In Functions and Classes
Exceptions
MicroPython-Specific Libraries
machine
Custom Libraries
Low-Level Libraries
Working with Low-Level Hardware
Drivers and Libraries to the Rescue!
Using Breakout Boards
Inter-integrated Circuit (I2C)
What Is I2C?
Overview
Required Components
Set Up the Hardware
Write the Code
Execute
Serial Peripheral Interface (SPI)
Overview
Required Components
Set Up the Hardware
Write the Code
Execute
Summary
Chapter 5: Electronics for Beginners
The Basics
Tools
Multimeter
Soldering Iron
Wire Strippers
Helping Hands
Using a Multimeter
Testing Continuity
Measuring Voltage
Measuring Current
Measuring Resistance
Powering Your Electronics
Electronic Components
Button
Capacitor
Diode
Fuse
Light-Emitting Diode (LED)
Relay
Resistor
Switch
Transistor
Voltage Regulator
Breakout Boards
Breadboard and Jumper Wires
Basic Electronics Kit
Using a Breadboard to Build Circuits
What Are Sensors?
How Sensors Measure
Analog Sensors
Digital Sensors
Examples of Sensors
Accelerometers
Audio Sensors
Barcode Readers
Biometric Sensors
Capacitive Sensors
Coin Sensors
Current Sensors
Flex/Force Sensors
Gas Sensors
Light Sensors
Liquid Flow Sensors
Liquid-Level Sensors
Location Sensors
Magnetic Stripe Readers
Magnetometers
Moisture Sensors
Proximity Sensors
Radiation Sensors
RFID Sensors
Speed Sensors
Switches and Pushbuttons
Tilt Switches
Touch Sensors
Video Sensors
Weather Sensors
Electronics Resources
Summary
Chapter 6: Project: Hello, World! MicroPython Style
Getting Started with Pico Projects
One Step at a Time!
Some Assembly Required
Handle with Care!
Overview
Required Components
Set Up the Hardware
Write the Code
Design
Libraries Needed
Planning the Code
Imports
Setup
Initialize
New Helper Functions
Core Code
Test the Breakout Boards
Test the RTC Breakout Board
Test the OLED Breakout Board
Execute
Taking It Further
Summary
Chapter 7: Project: Pedestrian Crossing
Overview
Required Components
Set Up the Hardware
Write the Code
Imports
Setup
Functions
Execute
Taking It Further
Summary
Chapter 8: Project: Soil Moisture Monitor
Overview
Required Components
Pico Omnibus
Pico Display
Soil Moisture Sensor
Potential Hardware Conflicts
Set Up the Hardware
Load the Pimoroni Image on the Pico
Connecting the Hardware
Write the Code
Calibrating the Sensor
Class Modules
ReadTimer
SoilMoisture
Constructor
Public Functions
Private Functions
PlantDisplay
Main Code
Execute
Taking It Further
Summary
Chapter 9: Introducing Grove
Overview
The Grove Component System
Capabilities
How Does It Work?
I2C
Digital
Analog
UART
Limitations
Components Available
Host Adapters
Modules
Cabling and Connectors
Where to Buy Grove Components
Using the Components with Your Pico
Summary
Chapter 10: Project: Sound Activated Lights
Overview
Required Components
Grove Shield for Pi Pico
Sound Sensor
Grove RGB LED
Grove Kits
Set Up the Hardware
Write the Code
Libraries Needed
Code Layout
Imports
Functions
Main Function
Setup
Execution Loop
Execute
Taking It Further
Summary
Chapter 11: Project: Simon Game
Overview
Required Components
Grove Dual Button
Grove LCD RGB Backlight
Set Up the Hardware
Using a Mounting Plate
Write the Code
Install Software Libraries
Create the Class Modules
Buzzer Class
Buttons Class
Simon Class
Main Code Module
Execute
Taking It Further
Summary
Chapter 12: Project: Monitoring your Environment
Project Overview
Required Components
About the Hardware
Grove OLED 0.96
Grove I2C High Accuracy Temperature Sensor (MCP9808)
Grove Temperature and Barometer Sensor (BMP280)
Grove Air Quality Sensor
Grove Dust Sensor
Set Up the Hardware
Using a Mounting Plate
Write the Code
Install Software Libraries
Create the Class Modules
DustSensor Class
AirMonitor Class
Main Code Module
Execute
Going Further
Summary
Chapter 13: Introducing IoT for the Cloud
Overview
What Is the Cloud?
What Is Cloud Computing Then?
How Does the Cloud Help IoT?
IoT Cloud Systems
IoT Cloud Services Available
Data Storage
Data Transformation (Queries)
Visualization Tools
Routing and Messaging
Connecting Your Pico to the Internet
Pico WiFi Modules
ESP8266 WiFi Module for Raspberry Pi Pico
DiP-Pi WiFi Master for Raspberry Pi Pico
Maker Pi Pico Base
Pico Wireless Pack
So, Which One Do You Choose?
Using the Pico Wireless Pack
IoT Project Examples
Example 1: Pedestrian Crossing
Set Up the Hardware
Write the Code
Imports
Global Variables
Functions Needed
Execute
Example 2: Soil Moisture Monitor
Set Up the Hardware
Write the Code
Main Code
HTML Code (Files)
Imports
Constants
Setup Code
Helper Functions
Main Function
Complete Code
Soil Moisture Class
Public Functions
Using Locks
Using the SD Card
Completed Code
Execute
Improving the Code
Summary
Chapter 14: Using ThingSpeak
Getting Started
Create an Account in ThingSpeak
Create a Channel
How to Add ThingSpeak to Your Projects
Using ThingSpeak with the Pico
Configuring the Raspberry Pi Pico
Write the Code
Testing the Script
Example Project: IoT Environment Monitor
Required Components
Set Up the Hardware
Create the ThingSpeak Channel
Prepare the Project Files
Update the Main Code
Execute and Visualize the Data
Public View
Summary
Correction to: Beginning MicroPython with the Raspberry Pi Pico
Correction to:
Appendix
Index


📜 SIMILAR VOLUMES


Beginning MicroPython with the Raspberry
✍ Charles Bell 📂 Library 📅 2022 🏛 Apress 🌐 English

<span>Program the Raspberry Pi Pico, the latest microcontroller board from raspberrypi.org, with MicroPython. This book will take you on a tour of the Raspberry Pi Pico, including how to get started using the microcontroller, seeing which alternative microcontrollers are available, and how to connec

Beginning MicroPython with the Raspberry
✍ Charles Bell 📂 Library 📅 2022 🏛 Apress 🌐 English

<span>Program the Raspberry Pi Pico, the latest microcontroller board from raspberrypi.org, with MicroPython. This book will take you on a tour of the Raspberry Pi Pico, including how to get started using the microcontroller, seeing which alternative microcontrollers are available, and how to connec

Raspberry Pi Pico Essentials Program, bu
✍ Dogan Ibrahim 📂 Library 📅 2021 🌐 English

<span><p>The Raspberry Pi Pico is a high-performance microcontroller module designed especially for physical computing. Microcontrollers differ from single-board computers, like the Raspberry Pi 4, in not having an operating system. The Raspberry Pi Pico can be programmed to run a single task very e

Raspberry Pi Pico Essentials: Program, B
✍ Dogan Ibrahim 📂 Library 📅 2021 🏛 Elektor Publication 🌐 English

<div> <p>The Raspberry Pi Pico is a high-performance microcontroller module designed especially for physical computing. Microcontrollers differ from single-board computers, like the Raspberry Pi 4, in not having an operating system. The Raspberry Pi Pico can be programmed to run a single task very

Get started with MicroPython on Raspberr
✍ Gareth Halfacree, Ben Everard 📂 Library 📅 2021 🏛 Raspberry Pi Trading Ltd 🌐 English

You might think of computers as things you stick on your desk and type on, and this is certainly one type of computer, but it’s not the only type. In this book, we’re looking at microcontrollers – small processing units with a bit of memory that are good at controlling other hardware. You probably h

Get started with MicroPython on Raspberr
✍ Gareth Halfacree; Ben Everard 📂 Library 📅 2021 🏛 Raspberry Pi Trading Ltd 🌐 English

THE OFFICIAL RASPBERRY PI PICO GUIDE Get started with MicroPython on Raspberry Pi Pico by Gareth Halfacree and Ben Everard Get started with MicroPython on Raspberry Pi Pico Microcontrollers, like RP2040 at the heart of Raspberry Pi Pico, are computers stripped back to their bare e