javaplus / PicoProjects

74 stars 11 forks source link

Pico Projects

This is our amazing introduction to basic electronics and working with the Raspberry Pi Pico microcontroller. These lessons will help you bring code to life and release your inner mad scientist!

Prerequisites

Basically you just need the simple Python editor called Thonny which allows you write code on your laptop and execute it on the Pico via a USB cable. USB cables will be provided just make sure you have a laptop with Thonny installed and an available USB jack on your laptop. We will have a few USB C to USB A adapters for those with only tiny ports. We will not have Mac dongles so make sure you have a way to connect a USB A cable into your laptop.

Please download and install the latest version(4.x or higher) of Thonny.
Download Thonny

For these labs, you do NOT have to be a Python expert. You can probably get by fine without having ever done Python programming before. However, some general programming knowledge is required. As long as you are comfortable with basic programming constructs(IF/ELSE statements, For/While loops, etc...) in other languagues we will have enough of the code for you to figure out the Python bits. If you want to get a little familar with Python before coming you can check out this free tutorial get comfortable with Python. We will have code samples and links to reference materials if you just need to see how to do "normal" programming things in Python. Python Tutorial

Are you Running a Hackathon

If you are using this as part of a Hackathon or contest, check out our Hackathon Guide.

Overview

We start with a basic introduction to circuits and some basic electronics. So, the first several labs only use the Pico as a power source to introduce basic circuits and some electronic components we will be working with. Without this foundational knowledge, it will be difficult to build useful solutions that integrate code and electronics.

If you aren't familar with how to use a breadboard, please take a moment and look at our introduction to them before starting the labs: Introduction to Breadboards

NOTE on LABS
We provide working code for each lab, but you are welcome to try to code some of the stretch goals or solutions on your own once you get the hang of things.

Many of the labs reference specific columns and rows to use when plugging in electronics. This is just to make it easier for beginners. The exact column and rows do not matter if you already understand how a breadboard works and know how to complete the circuit. If this is all brand new to this, you should follow our instructions exactly. But just know as you learn more about breadboards and circuits the exact location you plug things into the breadboard in many of the labs aren't important if you still complete the circuit.

If you finish a lab quickly and see others that are struggling, your stretch goal is to help a neighbor!

Optional Path

Instead of going sequentially through the labs, you can instead use the Parts Description page to see a list of all the cool gadgets you can use to build a game and then choose your own adventure.

Intro to Circuits.

Simple circuit with LED using power from Pico and turn on LED.
Lab 1

Resistors.

Same simple circuit from above and just add resistors to control the brightness of the LED.
Lab 2

Variable Resistors (Photoresistor)

Working with Light Sensitive Resistors. Also known as Photoresistors.
Lab 3

Variable Resistor (Potentiometer)

Use a Potentiometer to control brightness of LED.
Lab 4

Buttons/Switches

Introduction to using Buttons/Switches with cicuits:
Lab 5

Use Code to Flash LED (First Lab with Pico and MicroPython)

Finally, we will use code to light up LEDs:
Lab 6
Lab 7

Working with Buttons and the Pico

Use the Pico to detect when a button is pressed.
Lab 8
Lab 9
Optional Game - Reaction Time Lab 16
Lab 10

Pulse Width Modulation (PWM)

Explain PWM and use PWM to fade an LED in and out and control brightness.
Lab 11

Buzzer lab with PWM.
Lab 11b

PWM to Control Servos

Use PWM to control a servo:
Lab 12

Joystick and Turrets(Optional)

Joystick Lab
Turret Lab

Threading in MicroPython

Threading on the Pico:
Lab 13

Reading PhotoResistor Values

Using Analog input with the Pico:
Lab 14

Seven Segment Display

Seven Segment Display:
Lab 15

Build the Laser Shooting Shark Game:

Final Lab 01
Final Lab 02
Final Lab 03

References:

Parts List

Spreadsheet with Links where I ordered most parts

Python:

Pico: