NAMES OF COLLABORATORS HERE
For submission, replace this section with your documentation!
- Pull the new changes
- Read: The Presence Table (video)
Build interactive systems where multiple devices communicate over a network using MQTT messaging. Work in teams of 3+ with Raspberry Pis.
Parts:
- A: Learn MQTT messaging
- B: Try collaborative pixel grid demo
- C: Build your own distributed system
MQTT = lightweight messaging for IoT. Publish/subscribe model with central broker.
Concepts:
- Broker:
farlab.infosci.cornell.edu:1883 - Topic: Like
IDD/bedroom/temperature(use#wildcard) - Publish/Subscribe: Send and receive messages
Install MQTT tools on your Pi:
sudo apt-get update
sudo apt-get install -y mosquitto-clientsTest it:
Subscribe to messages (listener):
mosquitto_sub -h farlab.infosci.cornell.edu -p 1883 -t 'IDD/#' -u idd -P 'device@theFarm'Publish a message (sender):
mosquitto_pub -h farlab.infosci.cornell.edu -p 1883 -t 'IDD/test/yourname' -m 'Hello!' -u idd -P 'device@theFarm'💡 Tips:
- Replace
yournamewith your actual name in the topic- Use single quotes around the password:
'device@theFarm'
🔧 Debug Tool: View all MQTT messages in real-time at http://farlab.infosci.cornell.edu:5001
💡 Brainstorm 5 ideas for messaging between devices
Each Pi = one pixel, controlled by RGB sensor, displayed in real-time grid.
Architecture: Pi (sensor) → MQTT → Server → Web Browser
Setup:
- Sensor
We use this sensor Adafruit APDS-9960 for this exmaple to detect light (also RGB)
Connect it to your pi with Qwiic connector
We need to use the screen to display the color detection, so we need to stop the running piscreen.service to make your screen available again# stop the screen service
sudo systemctl stop piscreen.serviceif you want to restart the screen service
# start the screen service
sudo systemctl start piscreen.service- Server (one person on laptop):
cd "Lab 6"
source .venv/bin/activate
pip install -r requirements-server.txt
python app.py-
View in browser:
- Grid:
http://farlab.infosci.cornell.edu:5000 - Controller:
http://farlab.infosci.cornell.edu:5000/controller
- Grid:
-
Pi publisher (everyone on their Pi):
# First time setup - create virtual environment
cd "Lab 6"
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-pi.txt
# Run the publisher
python pixel_grid_publisher.pyHold colored objects near sensor to change your pixel!
📸 Include: Screenshot of grid + photo of your Pi setup
Requirements:
- 3+ people, 3+ Pis
- Each Pi contributes sensor input via MQTT
- Meaningful or fun interaction
Ideas:
Sensor Fortune Teller
- Each Pi sends 0-255 from different sensor
- Server generates fortunes from combined values
Frankenstories
- Sensor events → story elements (not text!)
- Red = danger, gesture up = climbed, distance <10cm = suddenly
Distributed Instrument
- Each Pi = one musical parameter
- Only works together
Others: Games, presence display, mood ring
Replace this README with your documentation:
1. Project Description
- What does it do? Why interesting? User experience?
2. Architecture Diagram
- Hardware, connections, data flow
- Label input/computation/output
3. Build Documentation
- Photos of each Pi + sensors
- MQTT topics used
- Code snippets with explanations
4. User Testing
- Test with 2+ people NOT on your team
- Photos/video of use
- What did they think before trying?
- What surprised them?
- What would they change?
5. Reflection
- What worked well?
- Challenges with distributed interaction?
- How did sensor events work?
- What would you improve?
Server files:
app.py- Pixel grid server (Flask + WebSocket + MQTT)mqtt_viewer.py- MQTT message viewer for debuggingmqtt_bridge.py- MQTT → WebSocket bridgerequirements-server.txt- Server dependencies
Pi files:
pixel_grid_publisher.py- Example (RGB sensor → MQTT)requirements-pi.txt- Pi dependencies
Web interface:
templates/grid.html- Pixel grid displaytemplates/controller.html- Color pickertemplates/mqtt_viewer.html- Message viewer
MQTT Message Viewer: http://farlab.infosci.cornell.edu:5001
- See all MQTT messages in real-time
- View topics and payloads
- Helpful for debugging your own projects
Command line:
# See all IDD messages
mosquitto_sub -h farlab.infosci.cornell.edu -p 1883 -t "IDD/#" -u idd -P "device@theFarm"MQTT: Broker farlab.infosci.cornell.edu:1883, user idd, pass device@theFarm
Sensor: Check i2cdetect -y 1, APDS-9960 at 0x39
Grid: Verify server running, check MQTT in console, test with web controller
Pi venv: Make sure to activate: source .venv/bin/activate
Before submitting:
- Delete prep/instructions above
- Add YOUR project documentation
- Include photos/videos/diagrams
- Document user testing with non-team members
- Add reflection on learnings
- List team names at top
Your README = story of what YOU built!
Resources: MQTT Guide | Paho Python | Flask-SocketIO



