Contents - Raspberry Pi Pico Essentials
Contents - Raspberry Pi Pico Essentials
Dogan Ibrahim
● This is an Elektor Publication. Elektor is the media brand of
Elektor International Media B.V.
PO Box 11, NL-6114-ZG Susteren, The Netherlands
Phone: +31 46 4389444
● All rights reserved. No part of this book may be reproduced in any material form, including photocopying, or
storing in any medium by electronic means and whether or not transiently or incidentally to some other use of this
publication, without the written permission of the copyright holder except in accordance with the provisions of the
Copyright Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licencing Agency
Ltd., 90 Tottenham Court Road, London, England W1P 9HE. Applications for the copyright holder's permission to
reproduce any part of the publication should be addressed to the publishers.
● Declaration
The Author and the Publisher have used their best efforts in ensuring the correctness of the information contained
in this book. They do not assume, and hereby disclaim, any liability to any party for any loss or damage caused by
errors or omissions in this book, whether such errors or omissions result from negligence, accident or any other
cause.
Elektor is part of EIM, the world's leading source of essential technical information and electronics products for pro
engineers, electronics designers, and the companies seeking to engage them. Each day, our international team develops
and delivers high-quality content - via a variety of media channels (including magazines, video, digital media, and social
media) in several languages - relating to electronics design and DIY electronics. www.elektormagazine.com
●4
Content
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Chapter 3 • R
aspberry Pi Pico Simple Hardware Projects . . . . . . . . . . . . . . . . . . . 48
3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.7 Project 6: Changing the LED flashing rate – using pushbutton interrupts . . . . . . . . 58
●5
Raspberry Pi Pico Essentials
3.8 Project 7: Alternately flashing red, green, and blue LEDs — RGB . . . . . . . . . . . . . 63
3.9 Project 8: Randomly flashing red, green, and blue LEDs — RGB . . . . . . . . . . . . . . 65
3.18 LCDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
3.24 Project 22: Ultrasonic reverse parking aid with buzzer . . . . . . . . . . . . . . . . . . . 114
4.3 Project 2: Temperature measurement – using the internal temperature sensor . . 119
●6
Content
6.4 Project 1: Generate a 1000 Hz PWM waveform with 50% duty cycle . . . . . . . . . . 147
6.8 PROJECT 5: Measuring the frequency and duty cycle of a PWM waveform . . . . . . 152
7.3 Project 1: Sending the Raspberry Pi Pico internal temperature to an Arduino Uno 160
7.4 Project 2: Receiving and displaying numbers from the Arduino Uno . . . . . . . . . . 165
7.5 Project 3: Communicating with the Raspberry Pi 4 over the serial link . . . . . . . . 166
8.8 Project 5: Display BMP280 temperature and atmospheric pressure on an LCD . . . 196
●7
Raspberry Pi Pico Essentials
10.3 Project 2: Displaying the internal temperature on a smartphone using Wi-Fi . . . 212
11.3 Project 1: Controlling an LED from your smartphone using Bluetooth . . . . . . . . 217
12.3 Project 1: Generating squarewave signal with amplitude under +3.3 V . . . . . . . 226
12.9 Project 7: Generating an accurate sinewave signal using timer interrupts . . . . . 242
Chapter 13 • Automatic Program Execution after the Raspberry Pi Pico Boots . . 245
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
●8