Raspberry Pi Pico Kit for Advanced Users
Programming & Projects
An extensive project handbook for the RP2040 microcontroller.
Featuring Over 80 Projects
By Dr. Gunter Spanner
An Extended Handbook from Elektor
About Elektor
Elektor is the world's leading source for technical information and electronics products for makers, engineers, and electronics developers, as well as for companies that employ these professionals. The international Elektor team develops high-quality content for developers and DIY electronics enthusiasts daily, distributed across various media (magazines, videos, digital media, and social media) in numerous languages. Visit: www.elektor.de
Table of Contents
Warnings
Program Download
Chapter 1 - Introduction
- 1.1 Prerequisites and Goals
- 1.2 Required Materials and Hardware Overview
- 1.3 The Advanced Pico Kit
- 1.4 A New Era: Pi Pico
Chapter 2 - Pico in Practice
- 2.1 Powering the Pico
- 2.2 Getting Started with Thonny
- 2.3 A First Test Program
- 2.4 Program Start Immediately After Pico Setup
- 2.5 Libraries
Chapter 3 - Physical Computing: LEDs in Action
- 3.1 LEDs in All Variants
- 3.2 LEDs and Series Resistors
- 3.3 Controlling an External LED
- 3.4 Simulating Flashing, Blinking, and Alarms
- 3.5 Running Lights and Airport Lighting
- 3.6 Smooth Transitions
- 3.7 Traffic Light for Robots and Model Railways
- 3.8 All Colors of the Rainbow
- 3.9 A Mood Light
- 3.10 Modern Traffic Light Version
- 3.11 Extensions and Experiments
Chapter 4 - Construction Systems
- 4.1 Magnetic Systems
- 4.2 Magnetic Metal Housings
- 4.3 Plastic Housings: Commercial or DIY
- 4.4 Order Instead of Chaos: Good Assembly Practice Pays Off
Chapter 5 - Everything at the Push of a Button: Button Control
- 5.1 Button Debouncing
- 5.2 Software Debouncing
- 5.3 Keyboard Input
- 5.4 Control Center for LEDs
- 5.5 Button for Turning: Rotary Encoder
- 5.6 Magnetic Switching with Reed Relays
- 5.7 No Chance for Burglary: Window and Door Security
- 5.8 Vibration or Tilt Sensors
- 5.9 Seismometer and Knock Light
- 5.10 Exercises and Extensions
Chapter 6 - Sensors Capture the World
- 6.1 Cross-Sensitivities – Risks and Side Effects in Technology
- 6.2 Opto-Sensors
- 6.3 Testing the Photoresistor
- 6.4 From Dark to Bright: Emergency Lighting
- 6.5 Also Important for Digital Cameras: The Light Meter
- 6.6 Seeing Robots: Object Detection
- 6.7 Seeing with Invisible Light: IR Detectors
- 6.8 A Must-Have in Every Supermarket: Barcode Reader
- 6.9 A Flame Sensor
- 6.10 Laser Light Barrier
- 6.11 Power-Saving: Light Only on Movement
- 6.12 Controlling Room Climate
- 6.13 The Pico as a Computer Thermometer
- 6.14 Humidity and Room Temperature
- 6.15 No More Mold and Moisture Damage
- 6.16 Using and Regenerating Climate Sensors
- 6.17 Thermometer Comparison
- 6.18 Moisture Sensors Help Orchids Bloom
- 6.19 Indispensable for Flower Lovers: The Watering Timer
- 6.20 Sun or Rain? - A Drop Sensor
- 6.21 A Self-Built Rain Detector
- 6.22 Bathtub Alarm and Plant Monitor
- 6.23 Please Touch: Touch Sensors
- 6.24 The Rain Detector as a Sensor Button
- 6.25 Protection Against Water Damage
- 6.26 Acoustic Sensors
- 6.27 Highly Sensitive: Acoustic Sensor
- 6.28 An "Intelligent" Clap Switch
- 6.29 Electronic Bat Ear: The Ultrasonic Sensor
- 6.30 Distance Measurement with Ultrasound
- 6.31 For Tight Garages: Parking Assist with Ultrasound
- 6.32 Experiments and Suggestions
Chapter 7 - Sounds and Tones
- 7.1 Signal Tones
- 7.2 An Acoustic Distress Signal
- 7.3 Melodies for Millions
- 7.4 Pico Musical
- 7.5 Warning and Siren Tones
- 7.6 From Tone to Sound
Chapter 8 - Capturing the Analog World: Analog-to-Digital Converters
- 8.1 From Analog to Digital
- 8.2 An LED Dimmer
- 8.3 Control with the Joystick Module
- 8.4 Red-Green Dimmer with Joystick Control
Chapter 9 - Actuators Move the World
- 9.1 DC Motors
- 9.2 Motor Control with the Pico
- 9.3 Motor Control with H-Bridge
- 9.4 Perfect Cooling: Fan with Adjustable Speed
- 9.5 Geared Motors
- 9.6 Balancing Pencils
- 9.7 Servos
- 9.8 Servo Control
- 9.9 A Servo-Controlled Flag Signal
- 9.10 Joystick Controls Robot Arm
Chapter 10 - Displays
- 10.1 Seven-Segment LED Display
- 10.2 Digital Countdown
- 10.3 Scrolling Text: "Hello" and More
- 10.4 Bright and Dark
- 10.5 LCD Displays on the Pico
- 10.6 LCD Display in Action
- 10.7 Unmissable: Blinking Display Module as a Warning Signal
- 10.8 Bar Graph Display
- 10.9 OLED Displays
- 10.10 Graphical Output
- 10.11 OLEDs as Small Graphic Screens
- 10.12 Electronic Artwork with Pixel Graphics
- 10.13 Animated Graphics
- 10.14 Suggestions and Ideas
Chapter 11 - Wirelessly Open Doors and Gates: RFID
- 11.1 Wirelessly Reading Data: The RFID Module
- 11.2 Reading an RFID Tag
Chapter 12 - Robotics
- 12.1 Chassis Assembly
- 12.2 Motor and Controller Test
- 12.3 The First Driving Program
- 12.4 Mechanical Collision Avoidance
- 12.5 Remote Control via Infrared
- 12.6 Obstacle Detection with Ultrasound
- 12.7 Autonomous Driving: Line Following
- 12.8 Extensions and Tasks
Chapter 13 - For Professionals: Applications and Practical Projects
- 13.1 Monitoring External Supply via VSYS
- 13.2 ADC in Practice: A Computer Voltmeter
- 13.3 Voltmeter with Seven-Segment Display
- 13.4 Universal Signal Generator
- 13.5 Convenient High-Frequency Generator
- 13.6 Sweep Generator
- 13.7 Oscilloscope and Transient Recorder
- 13.8 Frequency Counter
- 13.9 Stroboscope with Variable Flash Frequency
- 13.10 Digital Clock with Seven-Segment Display
- 13.11 Stopwatch with OLED Display
- 13.12 For the Perfect Breakfast Egg: Egg Timer
- 13.13 Egg Timer with Tilt Sensor
- 13.14 Fully Automatic Tea Timer
- 13.15 Electronic Tachometer
- 13.16 Thermometer with Servo Mega Display
- 13.17 Electronic Desk Calendar with Climate Display
- 13.18 Gale or Calm? Digital Wind Meter
- 13.19 Shaken - Not Stirred: Tilt Switch Controls Motor
- 13.20 Calculator Built by Hand
- 13.21 Ultrasonic Distance Meter with Laser Target Indicator
- 13.22 Power-Saving Lighting
- 13.23 Safe Shooting Practice: Laser Shooting Range with Hit Counter
- 13.24 RFID-Protected Treasure Chest
- 13.25 People Counter: How Many Guests Are at the Party?
- 13.26 Code Lock
- 13.27 Pico on Solar Power
- 13.28 Tasks, Suggestions, and Extensions
Chapter 14 - Python Compendium for the Pico
- 14.1 Essential: Comments
- 14.2 Output with Print()
- 14.3 Structure Through Indentation and Blocks
- 14.4 For Important Values: Variables and Constants
- 14.5 Numbers and Variable Types
- 14.6 To and Fro: Converting Number Types
- 14.7 Operators – Not Just for Mathematicians
- 14.8 Ideal for Number Series and Measurements: Arrays and Lists
- 14.9 Appealing Format: Text and Data Output
- 14.10 Character Processing and Strings
- 14.11 Trial and Error: Try and Except
- 14.12 Controlled Program Termination
- 14.13 Bootstrap Functions
- 14.14 Pins and Ports Under Control: Controlling Digital Inputs and Outputs
- 14.15 Alternating Flasher Under the Magnifying Glass
- 14.16 The "machine" Module in Detail
- 14.17 Optical SOS Signal
- 14.18 Timer Control
- 14.19 Button Query
- 14.20 Frequency Change with Button-Controlled Interrupts
- 14.21 Binary LED Counter
- 14.22 Funfair Lighting and Sci-Fi Displays
- 14.23 Time Control: time, ticks, and utime
- 14.24 Exercises, Extensions, and Tasks
Chapter 15 - Hardware Compendium
- 15.1 Breadboards
- 15.2 Jumper Wires
- 15.3 Resistors
- 15.4 Light Emitting Diodes (LEDs)
- 15.5 Capacitors
- 15.6 Electrolytic Capacitors
- 15.7 Diodes
- 15.8 The Potentiometer
Chapter 16 - Troubleshooting
Chapter 17 - Sources
Chapter 18 - Literature
Index