> For the complete documentation index, see [llms.txt](https://caseytechschool.gitbook.io/tinker-code-keep-it/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://caseytechschool.gitbook.io/tinker-code-keep-it/tinker-code-keep-it/session-1-introduction-to-embedded-systems-and-setup-guide.md).

# 🚀 Session 1: Introduction to Embedded Systems & Setup Guide

#### 💡 Why Are We Here? Understanding Connected Devices (The "Why")

In today's world, nearly every electronic device is interconnected—from our smart lights controlled by an app to sophisticated homes like Google Nest or Amazon Alexa. When you use these devices, they need more than just Wi-Fi; they need a central brain and a way to read their environment.

How do these smart devices actually connect to the internet? How does them pull data from sensors?

This club is your perfect opportunity to explore those questions. We won't just learn theoretical concepts; we will build our own connected system—a device designed by you, from scratch!

***

#### 💻 Technology Stack: The Tools of the Trade

Before we build anything, let’s familiarise ourselves with our components and software tools.

**⚙️ Hardware:**

* **Raspberry Pi Pico 2W:** Our powerful microcontroller board (With built-in wireless capabilities). \[<https://www.raspberrypi.com/products/raspberry-pi-pico-2/>]

**💾 Software & Programming:**

* **Thonny IDE:** A user-friendly Integrated Development Environment (IDE) for writing and running our code.
* **MicroPython:** The specialised language environment we use to program the Pico.

**📍 Understanding the Pi Pico 2W Pinout**

<figure><img src="https://www.raspberrypi.com/documentation/microcontrollers/images/picow-pinout.svg" alt=""><figcaption></figcaption></figure>

**⚡ Key Electrical Categories on the Board**

Understanding the pins is crucial, as they tell us what kind of power or signal we are sending.

* **🔴 Power Pins:** \* **VBUS (Pin 40):** The raw 5V power input coming directly from USB. \* **VSYS (Pin 39):** The main system voltage input (used when powering from a battery, not just USB). \* **3V3(OUT) (Pin 36):** The regulated 3.3V—this is the primary power rail that the Pico runs on. *Use this to safely power small 3.3V sensors.* \* **3V3\_EN (Pin 37):** An advanced pin used to turn the internal regulator off (useful for deep sleep projects). \* **ADC\_VREF (Pin 35):** The voltage reference point for our Analog-to-Digital Converter.
* **⚫ Ground (GND):** These pins provide ground electricity. **💡 Best Practice:** Always connect a ground wire alongside any signal wire to ensure stable electrical connections.
* **🟢 GPIO (General Purpose Input/Output):** The standard numbered pins (GP0–GP28). Think of these as digital switches: \* **Output:** Sending signals (e.g., turning an LED on/off). \* **Input:** Reading signals (e.g., from a button, reading 'on' or 'off'). \* *(Bonus:* Most GPIOs also support **PWM**, which allows us to simulate analog signals like dimming LEDs or controlling motor speed.)
* **🟢 ADC (Analog Pins):** GP26, GP27, GP28 can read a *range* of voltages—not just on/off. These pins are useful for sensors that provide varying data, such as light intensity detectors, potentiometers, or temperature probes.

***

#### 🔌 Getting Everything Running: Setup Walkthrough

Follow these steps carefully to get your hardware and software configured!

**Step 1: Flashing the Firmware (The Pico Board)**

The Pico needs specialised firmware before we can program it.

1. Visit the official MicroPython website and download the latest firmware for the Raspberry Pi Pico 2W: \[<https://micropython.org/download/RPI_PICO2_W/>]
2. Grab your Pico board and USB cable. **Crucially:** Connect one end of the USB to the Pico, then press and hold the **BOOSTER button** while connecting the other end to your laptop.
3. Your Pico should appear on your computer as a removable drive (like a USB stick).
4. Drag and drop the downloaded firmware file into the Pico's drive and wait for the installation process to complete.

> ⚠️ **Troubleshooting Tip:** If you did not press and hold the BOOSTER button while connecting, your operating system will *not* recognise it as a removable device. Make sure you press and hold it!

**Step 2: Setting Up Your Laptop (The IDE)**

1. Visit the Thonny IDE website and download/install the version for your specific operating system. \[<https://thonny.org/>]
2. Open Thonny. Go to `Tools` → `Manage Packages`.
3. Search for **PICOZERO** and install this library.

**Step 3: The Test Run (Checking Our Work)**

We'll write a simple "Hello World" equivalent for the Pico—making an LED blink!

1. In Thonny, copy and paste the following code:

   ```py
   from picozero import pico_led
   from time import sleep

   while True:
       pico_led.on()
       sleep(0.5)
       pico_led.off()
       sleep(0.5)
   ```
2. **Save the Code:** Select `File` → `Save` → Choose **RP2040 device**. (This saves it directly onto your Pico).
3. Press the **Run** button and watch the magic happen! 💡

> **Reference:** For deeper understanding of our key library, check out the PICOZERO documentation: <https://picozero.readthedocs.io/en/latest/index.html>

#### **✅ Wrapping Up Session 1: From Theory to Action!**

**Wow! What an accomplishment. Today**, we didn't just read theory—we became builders. We successfully mastered the basic workflow of embedded programming, set up our entire digital workshop (the Pico and Thonny!), and saw our first code make a physical change by making that LED blink.

Today was all about **foundation** and proving the concept: Code *works.*

**➡️ What’s Next? The Real World Awaits! (Session 2 Preview)** If Session 1 taught us how to whisper instructions to the Pico, **Session 2 will teach us how to listen.**

Next week, we are leveling up our skills! We are going beyond simple single outputs and tackling:

* **Physical Prototyping:** We’ll learn how to use the magic of the breadboard to connect external parts cleanly.
* **Sensing Input:** Instead of just telling the LED when to blink, we will teach the Pico to *read* its environment—detecting temperature and responding to button presses!
* **Variable Data:** We'll explore how to read smooth, continuous data (like using a potentiometer) rather than just simple on/off signals.

Get ready for Session 2: The world is full of inputs, and we are going to build the circuits that can understand them all!
