Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSC 591/791, ECE 592 — Homework 2 (Fall 2025)

This repository contains a complete reference implementation for the MQTT-based multi-device system described in the assignment. It includes:

  • Broker setup for Laptop #1 (Mosquitto via Docker Compose)
  • Raspberry Pi A sensor publisher (LDR + potentiometer via ADC0831)
  • Raspberry Pi C decision node (compares light vs threshold, publishes LightStatus)
  • Raspberry Pi B LED controller (drives LED1/LED2/LED3 based on topics)
  • Laptop #2 logger (subscribes to all topics, logs with duplicate reasoning and LED1 on/off timestamps)

All publications/subscriptions use QoS 2 and required retained messages.

Project layout

  • broker/ — Mosquitto configuration and Docker Compose for Laptop #1
  • raspberry_pi_a/ — Sensor publisher for Pi A
  • raspberry_pi_b/ — LED controller for Pi B
  • raspberry_pi_c/ — Decision node for Pi C
  • laptop2_logger/ — Subscriber/logger for Laptop #2 or smartphone
  • submission/ — Templates and placeholders for your report/wiring diagrams

Quick start

  1. Start broker on Laptop #1
  • Install Docker Desktop
  • In broker/, run: docker compose up -d
  1. Prepare Raspberry Pis (A, B, C)
  • Raspberry Pi OS Bookworm or later, Python 3.10+
  • Pi A deps: sudo apt update && sudo apt install -y python3-pip python3-rpi.gpio
  1. Install Python deps per component
  • On each device component directory, run: pip3 install -r requirements.txt
  1. Run components (replace <BROKER_HOST> with Laptop #1 IP)
  • Pi A: python3 publisher.py --broker <BROKER_HOST> --adc0831-clk 11 --adc0831-dout 9 --ldr-cs 8 --pot-cs 7
  • Pi C: python3 decision_node.py --broker <BROKER_HOST>
  • Pi B: sudo python3 led_controller.py --broker <BROKER_HOST>
  • Laptop #2 logger: python3 logger.py --broker <BROKER_HOST>
  1. Graceful shutdown
  • Press Ctrl+C in each process; Pi A and Pi C will publish retained offline before disconnect.

Notes

  • Topics used:
    • lightSensor (retained, QoS 2)
    • threshold (retained, QoS 2)
    • LightStatus (retained, QoS 2)
    • Status/RaspberryPiA (retained, QoS 2)
    • Status/RaspberryPiC (retained, QoS 2)
  • Default GPIO mapping on Pi B:
    • LED1: GPIO17, LED2: GPIO27, LED3: GPIO22
  • ADC0831 wiring on Pi A (BCM): CLK=11, DOUT=9, LDR CS=8, POT CS=7

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages