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.
Parts Needed
- Raspberry Pi 4 or Pi 5 with Raspberry Pi OS
Find parts on Amazon → - Breadboard, jumper wires, LED, and 220Ω or 330Ω resistor
Find parts on Amazon → - Reliable USB-C power supply
Find parts on Amazon → - Optional relay module for later real-world switching
Find parts on Amazon →
Easy Build Steps
- Wire the LED long leg through a resistor to GPIO17, physical pin 11.
- Connect the LED short leg to a ground pin such as physical pin 6.
- Boot the Pi, open Terminal, and update packages with sudo apt update.
- Install Flask and gpiozero with pip3 install flask gpiozero.
- Find your Pi IP address with hostname -I.
How This Tutorial Works
Start simple: get the LED blinking locally first. Once the LED is known-good, the web dashboard becomes a software problem instead of a wiring mystery. The key setting is host='0.0.0.0'. Without that, Flask may only answer on the Pi itself.
Mistakes to Avoid
- Forgetting the resistor on the LED.
- Using physical pin 17 instead of GPIO17.
- Leaving Flask on 127.0.0.1 only.
- Trying to expose the dashboard publicly before adding authentication.
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)
Click the image to open it in the WolfieWeb lightbox.
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. If the page only loads on the Pi, the host setting or firewall is the problem.
Upgrade Path
- Add a temperature display card.
- Add buttons for multiple GPIO outputs.
- Use CSS to make the dashboard match WolfieWeb style.
- Add a login before controlling anything important.



