Complete for freeIntermediate

Course 17

Hardware Lab: Raspberry Pi and Internet of Things

Every circuit in this course runs on a simulated Raspberry Pi Pico W in Wokwi, a free in-browser simulator, so you can wire buttons, potentiometers, temperature and light sensors, LEDs, and servos without buying parts. You write real MicroPython (machine.Pin, machine.ADC, machine.PWM, network.WLAN), the same code a physical Pico W runs, and the simulated board joins a virtual Wi-Fi network called Wokwi-GUEST to reach the internet. Data work happens in regular Python cells that run right on the lesson page: parsing CSV logs, smoothing noisy readings, spotting gaps, and drawing charts with matplotlib. Along the way you learn the Linux terminal (the same commands work on a Raspberry Pi, a Mac, WSL on Windows, or a Chromebook's Linux environment), GPIO numbering, and the electrical rules that keep real pins alive. Later modules send readings as JSON over MQTT, build a live dashboard, authenticate devices before they can act on commands, keep passwords out of source code, and plan for sensor, network, and dashboard failures. Each module has notes that teach the ideas, a build-along that makes one working project, and a practice set with hints and full solutions. The course ends with a secure monitoring capstone such as a smart greenhouse or weather station. A real Pico W, or a Raspberry Pi 4 or 5 running Raspberry Pi OS, is optional; where it helps, lessons show the gpiozero version of the same idea.

Free completion promise: Every lesson can be finished for $0 in a web browser: circuits and MicroPython run in Wokwi's free simulator without an account, and the data analysis runs in Python cells that show their output on the lesson page. Hardware is optional, and no lesson requires buying anything.

What's inside

  • 24hand-written lessons
  • 24videos
  • 4step-through animations
  • 30diagrams, charts & live previews
  • 50quiz questions
  • 143code examples

Before you begin

Requirements & setup for Hardware Lab: Raspberry Pi and Internet of Things

Start with the complete free pathway below. Hardware, subscriptions, paid APIs, and cloud credits are never required.

Start here ยท free path

Your complete $0 setup

Every lesson can be finished for $0 in a web browser: circuits and MicroPython run in Wokwi's free simulator without an account, and the data analysis runs in Python cells that show their output on the lesson page. Hardware is optional, and no lesson requires buying anything.

$0 required

Setup checklist

0 of 15 complete

This checklist is a temporary setup aid and resets when the page reloads. Saved course progress begins in the setup lessons below.

  1. Everything required for this course is free. Paid software, APIs, cloud credits, GPUs, and physical equipment are optional.

    About 2 min
  2. Open wokwi.com in Chrome, Edge, Firefox, or Safari and click the Pi Pico tile.

  3. Under Starter Templates, choose Micropython Pico W (or go straight to wokwi.com/projects/new/micropython-pi-pico-w).

    About 5 min
  4. Paste the lesson's code into main.py and, when the lesson gives one, its circuit into diagram.json.

    About 5 min
  5. Press the green play button and watch the terminal under the diagram for your program's output.

    About 5 min
  6. Every lesson works in Wokwi (free Raspberry Pi Pico W simulator with MicroPython), so Raspberry Pi Pico W (or Pico WH, with headers already soldered) is never required.

  7. If you have Raspberry Pi Pico W (or Pico WH, with headers already soldered), use it where a lesson mentions it and compare your result with the lesson's.

    About 5 min
  8. If it doesn't match, finish that step in Wokwi (free Raspberry Pi Pico W simulator with MicroPython) and keep going.

    About 5 min
  9. Every lesson works in Wokwi (free Raspberry Pi Pico W simulator with MicroPython), so Raspberry Pi 4 or 5 with Raspberry Pi OS is never required.

  10. If you have Raspberry Pi 4 or 5 with Raspberry Pi OS, use it where a lesson mentions it and compare your result with the lesson's.

    About 5 min
  11. If it doesn't match, finish that step in Wokwi (free Raspberry Pi Pico W simulator with MicroPython) and keep going.

    About 5 min
  12. Every lesson works in Wokwi (free Raspberry Pi Pico W simulator with MicroPython), so Sensors for an environmental station is never required.

  13. If you have Sensors for an environmental station, use it where a lesson mentions it and compare your result with the lesson's.

    About 5 min
  14. If it doesn't match, finish that step in Wokwi (free Raspberry Pi Pico W simulator with MicroPython) and keep going.

    About 5 min
  15. Wokwi (free Raspberry Pi Pico W simulator with MicroPython): The template prints Hello, Pi Pico W! in the terminal, and the Module 1 blink program makes the board's onboard LED flash twice a second. Raspberry Pi Pico W (or Pico WH, with headers already soldered): The template prints Hello, Pi Pico W! in the terminal, and the Module 1 blink program makes the board's onboard LED flash twice a second. Raspberry Pi 4 or 5 with Raspberry Pi OS: The template prints Hello, Pi Pico W! in the terminal, and the Module 1 blink program makes the board's onboard LED flash twice a second. Sensors for an environmental station: The template prints Hello, Pi Pico W! in the terminal, and the Module 1 blink program makes the board's onboard LED flash twice a second.

    About 5 min

Software

1 item

Wokwi (free Raspberry Pi Pico W simulator with MicroPython)

Wokwi runs a Raspberry Pi Pico W with real MicroPython firmware in your web browser, along with LEDs, resistors, buttons, potentiometers, sensors, and servos. The simulated board can join a virtual Wi-Fi network with internet access, so networking lessons work too. Nothing to install and nothing to buy; a free account is only needed to save projects online.

Course need
Wokwi (free Raspberry Pi Pico W simulator with MicroPython)
Free

Wokwi runs a Raspberry Pi Pico W with real MicroPython firmware in your web browser, along with LEDs, resistors, buttons, potentiometers, sensors, and servos. The simulated board can join a virtual Wi-Fi network with internet access, so networking lessons work too. Nothing to install and nothing to buy; a free account is only needed to save projects online. Every lesson is readable text with copyable code, keyboard-friendly quizzes and step-throughs, and videos with YouTube captions.

  1. Open wokwi.com in Chrome, Edge, Firefox, or Safari and click the Pi Pico tile.
  2. Under Starter Templates, choose Micropython Pico W (or go straight to wokwi.com/projects/new/micropython-pi-pico-w).
  3. Paste the lesson's code into main.py and, when the lesson gives one, its circuit into diagram.json.
  4. Press the green play button and watch the terminal under the diagram for your program's output.

Hardware

3 items

Raspberry Pi Pico W (or Pico WH, with headers already soldered)

Optional. A real board runs the same MicroPython from every lesson. Add a micro-USB data cable, a breadboard, jumper wires, LEDs, 330 ohm resistors, a pushbutton, and a 10k potentiometer to build Modules 1 to 4 on a desk.

Optional
Wokwi (free Raspberry Pi Pico W simulator with MicroPython)
Free

Optional. Every lesson can be completed with Wokwi (free Raspberry Pi Pico W simulator with MicroPython); Raspberry Pi Pico W (or Pico WH, with headers already soldered) is an extra for learners who have it. Optional equipment: every assessed outcome can be completed without it.

  1. Every lesson works in Wokwi (free Raspberry Pi Pico W simulator with MicroPython), so Raspberry Pi Pico W (or Pico WH, with headers already soldered) is never required.
  2. If you have Raspberry Pi Pico W (or Pico WH, with headers already soldered), use it where a lesson mentions it and compare your result with the lesson's.
  3. If it doesn't match, finish that step in Wokwi (free Raspberry Pi Pico W simulator with MicroPython) and keep going.

Raspberry Pi 4 or 5 with Raspberry Pi OS

Optional. A full Linux computer with a 40-pin GPIO header. It can run the gpiozero versions of the circuits, the MQTT broker, and the dashboard. You also need its official power supply and a microSD card of 16 GB or more, written with Raspberry Pi Imager.

Optional
Wokwi (free Raspberry Pi Pico W simulator with MicroPython)
Free

Optional. Every lesson can be completed with Wokwi (free Raspberry Pi Pico W simulator with MicroPython); Raspberry Pi 4 or 5 with Raspberry Pi OS is an extra for learners who have it. Optional equipment: every assessed outcome can be completed without it.

  1. Every lesson works in Wokwi (free Raspberry Pi Pico W simulator with MicroPython), so Raspberry Pi 4 or 5 with Raspberry Pi OS is never required.
  2. If you have Raspberry Pi 4 or 5 with Raspberry Pi OS, use it where a lesson mentions it and compare your result with the lesson's.
  3. If it doesn't match, finish that step in Wokwi (free Raspberry Pi Pico W simulator with MicroPython) and keep going.

Sensors for an environmental station

Optional. A DHT22 temperature and humidity sensor, a 10k NTC thermistor module, a photoresistor module, and a micro servo cover the sensor and output lessons and the capstone.

Optional
Wokwi (free Raspberry Pi Pico W simulator with MicroPython)
Free

Optional. Every lesson can be completed with Wokwi (free Raspberry Pi Pico W simulator with MicroPython); Sensors for an environmental station is an extra for learners who have it. Optional equipment: every assessed outcome can be completed without it.

  1. Every lesson works in Wokwi (free Raspberry Pi Pico W simulator with MicroPython), so Sensors for an environmental station is never required.
  2. If you have Sensors for an environmental station, use it where a lesson mentions it and compare your result with the lesson's.
  3. If it doesn't match, finish that step in Wokwi (free Raspberry Pi Pico W simulator with MicroPython) and keep going.

Accounts

Nothing required

No external account is needed for this course.

What you will be able to do

Learning outcomes

  • Navigate a Linux system from the terminal and set up a project folder with safe permissions.
  • Map Raspberry Pi and Pico W GPIO pins correctly and keep circuits within 3.3 V logic and current limits.
  • Read digital and analog sensors and control LEDs and servos from MicroPython without blocking the main loop.
  • Log timestamped readings to CSV, smooth and chart them with Python, and buffer data through network outages.
  • Publish sensor data as JSON over MQTT and show fresh and stale values on a dashboard.
  • Protect remote device control with authentication, safe credential storage, and planned failure states.

Build real work

Assignments & capstone

Free tools accepted

Sensor logger that survives an outage

In Wokwi, program a Pico W in MicroPython to read and smooth two sensors on a non-blocking schedule, log timestamped readings to a CSV file, and post them over Wi-Fi in batches without losing any during an outage you trigger.

Every lesson can be finished for $0 in a web browser: circuits and MicroPython run in Wokwi's free simulator without an account, and the data analysis runs in Python cells that show their output on the lesson page. Hardware is optional, and no lesson requires buying anything. Submit your project file, or screenshots with descriptions, or a short demo.

MQTT station with a signed command

Publish JSON readings from a Wokwi Pico W over MQTT with a retained status and last will, show them on a browser dashboard that marks stale values, and accept one remote command only if its HMAC signature and sequence number check out.

Every lesson can be finished for $0 in a web browser: circuits and MicroPython run in Wokwi's free simulator without an account, and the data analysis runs in Python cells that show their output on the lesson page. Hardware is optional, and no lesson requires buying anything. Submit your project file, or screenshots with descriptions, or a short demo.

Final assessment

Secure monitoring system

Build a Pico W monitoring system in Wokwi, such as a smart greenhouse or weather station, that publishes validated readings over MQTT to a dashboard showing fresh, stale, and offline states, with one HMAC-signed remote action, git-ignored secrets, and planned failure handling. Deliverables: Wokwi project with MicroPython code and secrets.example.py, Browser dashboard, Test plan covering normal use, boundaries, failures, and attacks, README with architecture diagram, topic plan, and threat and failure tables, and Four-minute demo.

Prerequisites & pacing

Skills assumed

  • Write Python programs with functions, loops, lists, and dictionaries
  • Know what voltage, current, and resistance are, at least roughly (the course reviews the parts you need)
  • Comfortable copying text between browser tabs and editing a file

Recommended prior courses

These are advisory, not locks. If you already have the skills listed above, enroll directly.

Choose your pace

  • self paced: 10 weeks at 5 hours per week
  • weekly: 10 weeks at 5 hours per week

Part of this learning path

  • ๐Ÿค– Hardware and Robotics ยท step 3 of 4

    Go from first LED to a connected, sensing, machine-learning device โ€” every step has a browser simulator.

Course created by Zafir Shamsi.