Raspberry Pi Pico Tips and Tricks
Raspberry Pi Pico Tips and Tricks
About the Book
If you've heard about the Raspberry Pi Pico you may know that it provides a fantastic method to learn about using a microcontroller and to develop some skills that go beyond the basics.
Is this book for you?
You be the judge! I write books that capture information about the things I learn. In this case I will be writing down a bunch of information about the Raspberry Pi Pico and how I learned to use it. It's not written for experts. It's put together as a guide to get you started if you're unsure about how to make the first move with a microcontroller.
Why has the book been written?
Because in the process of learning things, it's a great way to remember them if you write them down :-).
Writing about how to do cool stuff with computers means that we're accumulating ways to help ourselves out when the going gets tricky. Making a book out of the information is a no-brainer since that way more people benefit from the process.
The awesome that is Leanpub.
The book has some information in it, but there will be updates over time. Publishing using Leanpub will allow readers to get easy notification of when updates and improvements are made.
Enjoy.
So I hope you get something out of the book, please excuse the sometimes light-hearted conversational manner in which I approach the topic and enjoy the Raspberry Pi Pico!
Table of Contents
-
Introduction
- Welcome!
- What are we trying to do?
- Who is this book for?
- What will we need?
- Why on earth did I write this rambling tome?
- Where can you get more information?
-
Microcontrollers vs Computers
- Microcontrollers
- Computers
- What’s the difference to you?
-
The Raspberry Pi Pico
- The RP2040 Microcontroller Chip
- The Raspberry Pi Pico W Microcontroller Board
-
Set up
- Hardware
- Software
- What is Thonny?
- Install Thonny
-
MicroPython
- What is MicroPython?
- Connect our Pico
- Automatically Installing the Firmware
- Manually Installing the Firmware
- Updating Firmware
- Use the Shell
- Blink the on-board LED
- Automatically run your program
-
Connectivity
- Connecting using Dupont Connectors
- Connectivity via WiFi
- General Purpose Input / Output (GPIO)
- Inter-Integrated Circuit (I2C)
- Serial Peripheral Interface (SPI)
-
Reed Switches with the Raspberry Pi Pico
- What is a Reed Switch?
- The Magnetic Reed Switch
- How do we read a switch?
- Connecting up the switch to the Pico
- Code
-
Controlling a Servo from the Raspberry Pi Pico
- What is a Servo Motor?
- How does a Servo Motor Work?
- How is a Servo Motor Controlled?
- Connecting Everything Up to the Pico
- Code
- Warning
-
Controlling a Motor with the Raspberry Pi Pico
- What are the principles of motor control?
- How will we implement it?
- Connecting Up the motor controller and battery
- Code
-
Using a Stepper Motor with a Raspberry Pi Pico
- The Stepper Motor
- The 28BYJ-48
- Connecting the Pico to the controller to the GY-521
- Code
-
Connecting an SD Card to the Raspberry Pi Pico
- SD card adapter or adaptor.
- My personal SD Card adapter journey
- Choose your weapon
- Install the SDCard Library.
- Connect the SD Card Adapter
- Code
- Bonus Connection!
-
Connecting MQ Series Gas Detectors to the Pico
- The Sensor
- Connect Everything Up
- Code
-
Distance Measurement using Time of Flight Sensor
- What is a Time Of Flight Sensor?
- How does a Time Of Flight Sensor Work?
- How is a Time Of Flight Sensor Controlled?
- Connecting a Time Of Flight Sensor Up to the Pico
- Code
-
Distance Measurement using an Ultrasonic Sensor
- What is an Ultrasonic Sensor?
- How does an Ultrasonic Sensor Work?
- Connecting an Ultrasonic Sensor Up to the Pico
- Code
-
Reading the on-board Temperature of a Raspberry Pi Pico
- About the sensor
- Code
-
Multiple Temperature Measurements
- The DS18B20 Sensor
- Hardware required
- Connecting everything up
- Code
-
AHT10 Temperature and Relative Humidity
- AHT10 Details
- How is the AHT10 sensor accessed?
- Connecting the AHT10 to the Pico
- Code
-
Motion Sensing with the Raspberry Pi Pico
- What is a PIR Sensor?
- How does a PIR Sensor Work?
- How do we read a PIR?
- Connecting Up a PIR to the Pico
- Code
-
Motion detection using a Microwave Doppler Sensor
- What is a Doppler Sensor?
- How does a Microwave Doppler Sensor Work?
- Connecting the RWCL-0516 Sensor Up to the Pico
- Code
-
Sensing vibration with a Raspberry Pi Pico
- Vibration sensors
- Piezoelectric vibration sensor
- Connecting everything up
- Code
-
Using an Inertial Measurement Unit (IMU) with a Pico
- The IMU
- The GY-521 IMU module using a MPU-6050
- Connecting the GY-521 to the Raspberry Pi Pico
- Code
-
Using an OLED Display attached to a Pico
- The OLED Display
- Connecting the Display to the Pico
- Loading the ssd1306 PyPI module
- Code
-
Using a Dot-Matrix Display Attached to a Pico
- The Dot-Matrix Display
- How is the display accessed?
- Connecting the Display to the Pico
- Code
-
Controlling addressable LEDs
- What are addressable LEDs?
- Connecting the addressable LEDs
- How do we talk to our addressable LEDs?
- Code
-
Using the Raspberry Pi Pico as a Prometheus Node
- About Prometheus and Grafana
- Using the Pico as an Exporter
- Code
-
Sending an email from a Raspberry Pi Pico W
- The slightly tricky part of email.
- The Code
-
Integrating a Real Time Clock (RTC) with a Raspberry Pi Pico
- Just what is a RTC?
- The RTC on a Raspberry Pi Pico
- The Code
- What gives? My Pico appears to have accurate time already!
-
General Pico Tips and Tricks
- Universal LED Blink
- The Watchdog Timer
- Logging to Help with Troubleshooting
Other books by this author
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them