WolfieWeb Advanced Pi Lab
Advanced Raspberry Pi Build Guides

Next-Level Raspberry Pi Tutorials That Deserve Their Own Page

This page picks up where your beginner Raspberry Pi page leaves off. The reader moves into web dashboards, MQTT messaging, computer vision, servo control, and real database logging.

Each lesson includes parts, wiring direction, code, testing, mistakes to avoid, and a practical upgrade path.

Advanced Raspberry Pi electronics lab with sensors camera servo mount and dashboard

Pick an Advanced Tutorial

These are built as the next chapter after LED, button, sensor, camera, and motion basics.

Advanced Learning Path

Finish These in Order

Raspberry Pi Flask web dashboard tutorial with LED and sensor controls
Advanced Tutorial 1 · Intermediate
Step 1 of 5 · Browser control and GPIO output

Raspberry Pi Flask Web Dashboard

Goal: Build a local browser dashboard that shows Pi status and lets the reader control a GPIO output without touching the Pi directly.

What should happen: A phone, tablet, or desktop on the same Wi-Fi opens the Pi dashboard and turns an LED on and off from the browser.

Printable Flask Lab Manual Included

This upgraded Flask Web Dashboard section now includes a PDF lab manual with GPIO LED wiring, install commands, full Flask code, network testing, troubleshooting, and upgrade paths.

Parts Needed

Easy Build Steps

  1. Wire the LED long leg through a resistor to GPIO17, physical pin 11.
  2. Connect the LED short leg to a ground pin such as physical pin 6.
  3. Boot the Pi and run sudo apt update.
  4. Install Flask and gpiozero with pip3 install flask gpiozero.
  5. Find your Pi IP address with hostname -I.

Starter Code

from flask import Flask, redirect
from gpiozero import LED
from datetime import datetime

app = Flask(__name__)
led = LED(17)

@app.route('/')
def home():
    state = 'ON' if led.value else 'OFF'
    now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    return f'''
    <h1>WolfieWeb Pi Dashboard</h1>
    <p>LED status: <strong>{state}</strong></p>
    <p>Last refresh: {now}</p>
    <a href="/on">Turn LED ON</a> | <a href="/off">Turn LED OFF</a>
    '''

@app.route('/on')
def on():
    led.on()
    return redirect('/')

@app.route('/off')
def off():
    led.off()
    return redirect('/')

app.run(host='0.0.0.0', port=5000)
Close-up image for Raspberry Pi Flask Web Dashboard

Quick Test

Run python3 app.py, then open http://PI-IP-ADDRESS:5000 from another device on the same Wi-Fi. If the page loads but the LED does not change, the wiring is wrong.

Upgrade Path

  • Add a temperature display card.
  • Add buttons for multiple GPIO outputs.
  • Add a login before controlling anything important.
✔ Micro-win: Tutorial 1 is still here. This is the Raspberry Pi Flask Web Dashboard build, kept intact.
Raspberry Pi MQTT sensor hub with temperature sensor and network messages
Advanced Tutorial 2 · Intermediate
Step 2 of 5 · Network messages and sensor publishing

Raspberry Pi MQTT Sensor Hub

Goal: Publish temperature and humidity readings over MQTT so other devices, dashboards, or scripts can react to the Pi.

What should happen: The Pi sends readings to a topic like home/pi/lab every few seconds, and another terminal can subscribe to see them live.

Printable MQTT Lab Manual Included

The upgraded section now includes a printable PDF manual with detailed wiring, install commands, GPIO safety notes, testing steps, and troubleshooting.

Parts Needed

Easy Build Steps

  1. Update the Pi with sudo apt update.
  2. Install Mosquitto with sudo apt install mosquitto mosquitto-clients -y.
  3. Enable it at boot with sudo systemctl enable --now mosquitto.
  4. Wire DHT22 VCC to 3.3V, GND to GND, and DATA to GPIO4.
  5. Install libraries: pip3 install paho-mqtt adafruit-circuitpython-dht.
Detailed Raspberry Pi MQTT Sensor Hub DHT22 wiring diagram

Detailed DHT22 wiring: VCC to 3.3V, DATA to GPIO4, GND to ground, and 10K pull-up resistor between VCC and DATA.

Raspberry Pi MQTT Sensor Hub install command flow

Install flow: update the Pi, install Mosquitto, enable the broker, install Python libraries, then subscribe and test.

Exact Wiring

  • DHT22 VCC → Raspberry Pi 3.3V pin.
  • DHT22 DATA → Raspberry Pi GPIO4.
  • DHT22 GND → Raspberry Pi ground.
  • 10K resistor → between VCC and DATA as a pull-up resistor.

Important: Raspberry Pi GPIO pins are 3.3V logic. Do not push 5V into the DATA pin.

Install Commands

sudo apt update
sudo apt install mosquitto mosquitto-clients -y
sudo systemctl enable --now mosquitto
sudo systemctl status mosquitto

pip3 install paho-mqtt adafruit-circuitpython-dht
sudo apt install libgpiod2 -y

Subscriber Test

mosquitto_sub -h localhost -t home/pi/lab

Publisher Code

import time
import board
import adafruit_dht
import paho.mqtt.client as mqtt

sensor = adafruit_dht.DHT22(board.D4)
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
client.connect('localhost', 1883, 60)

while True:
    try:
        temp = sensor.temperature
        humidity = sensor.humidity
        message = f'temp={temp},humidity={humidity}'
        client.publish('home/pi/lab', message)
        print('Published:', message)
    except RuntimeError as error:
        print('Sensor read failed:', error.args[0])
    time.sleep(5)
Close-up image for Raspberry Pi MQTT Sensor Hub

Quick Test

In a second terminal, run mosquitto_sub -h localhost -t home/pi/lab. Then start the Python script. If messages appear, the broker and publisher are working.

Upgrade Path

  • Subscribe from Node-RED or Home Assistant.
  • Send JSON instead of comma text.
  • Log MQTT readings into SQLite.
  • Push alerts to a dashboard or phone notification system.

Download the Full Wiring & Install Manual

The PDF is included in this ZIP and should be uploaded to /downloads/WolfieWeb_Raspberry_Pi_MQTT_Sensor_Hub_Lab_Manual.pdf.

Open MQTT Sensor Hub PDF
✔ Micro-win: Tutorial 2 now has the detailed wiring and installation flow readers need.
Raspberry Pi OpenCV camera motion detection tutorial
Advanced Tutorial 3 · Intermediate Plus
Step 3 of 5 · Computer vision and motion snapshots

OpenCV Motion Camera

Goal: Use OpenCV to compare camera frames and save a snapshot when real movement is detected.

Printable OpenCV Lab Manual Included

This upgraded OpenCV section now includes a full PDF lab manual with camera setup, OpenCV install commands, camera test steps, motion detection code, tuning guidance, troubleshooting, and upgrade paths.

Parts Needed

Easy Build Steps

  1. Mount the camera so it cannot wobble.
  2. Test the camera before installing OpenCV.
  3. Install OpenCV with sudo apt install python3-opencv -y.
  4. Run a simple camera capture test.
  5. Run the motion script and tune the threshold.

Install Commands

sudo apt update
sudo apt install python3-pip python3-opencv v4l-utils -y
python3 -c "import cv2; print(cv2.__version__)"
ls /dev/video*

Camera Setup Warning

Power off the Raspberry Pi before inserting or removing a CSI camera ribbon cable. A loose or crooked ribbon cable is one of the fastest ways to turn this project into a troubleshooting mess.

Close-up image for Raspberry Pi OpenCV Motion Camera

Quick Test

Run the camera test first. If the camera does not work there, OpenCV will not fix it. After the camera works, run the motion script and wave your hand in front of the camera. A snapshot should save into the motion_captures folder.

Upgrade Path

  • Send a motion MQTT alert.
  • Save snapshots to the Flask dashboard.
  • Add date folders for captures.
  • Log motion events into SQLite.
  • Move the servo pan-tilt mount toward detected movement.
Raspberry Pi servo pan tilt camera mount tutorial
Advanced Tutorial 4 · Advanced Hardware
Step 4 of 5 · Servo control and external power

Servo Pan-Tilt Camera Mount

Goal: Control a two-axis pan-tilt mount with two servos while protecting the Raspberry Pi from servo power spikes.

Printable Servo Lab Manual Included

This upgraded Servo Pan-Tilt section now includes a PDF lab manual with safe external power wiring, shared ground rules, GPIO signal pins, servo test code, angle tuning, and troubleshooting.

Parts Needed

Power Safety Steps

  1. Connect servo red wires to external 5V positive.
  2. Connect servo brown/black wires to external 5V ground.
  3. Connect external ground to Raspberry Pi ground.
  4. Connect pan signal to GPIO17 and tilt signal to GPIO18.
  5. Test movement slowly before mounting the camera.
Close-up image for Servo Pan-Tilt Camera Mount

Power Rule

Use external 5V power and connect the external ground to the Pi ground.

Raspberry Pi SQLite sensor data logger tutorial
Advanced Tutorial 5 · Advanced Software
Step 5 of 5 · Database storage and charts

SQLite Sensor Data Logger

Goal: Store sensor readings in a local SQLite database so the Pi can build history instead of only showing live values.

Close-up image for SQLite Sensor Data Logger

Upgrade Path

  • Feed MQTT messages into SQLite.
  • Graph readings in Flask.
  • Export daily CSV files.

Share This Advanced Raspberry Pi Page

This page is built for readers who finished the basics and want real projects they can grow into robotics, IoT, and smart-home systems.