Hardware-focused Python project for ENGG67, targeting Raspberry Pi sensors, status LEDs, and a buzzer. The codebase includes a bootstrapping installer, GPIO-driven buzzer and LED helpers, and a main loop that is intended to orchestrate sensors, fans, and logging.
- main.py — entry point and orchestration loop (work-in-progress).
- bootup.py — optional dependency installer.
- buzzer.py — buzzer control via pigpio.
- LED_control.py — status LED control via pigpio.
- Raspberry Pi (or compatible) with GPIO access
- Python 3.9+
- pigpio daemon running (
pigpiod) - Sensor libraries used in main.py:
- numpy, smbus2, Adafruit_ADS1x15, adafruit-bmp, adafruit-circuitpython-sht31d, pypms, pyserial, RPi.GPIO, pigpio
- Custom libraries: ENS160, MQ_2_7_138 (installed from GitHub in bootup.py)
- Start the pigpio daemon:
sudo pigpiod
- (Optional) Install dependencies using the bootup helper:
- Run bootup.py, or import and call
bootup.bootup_sequence()from your entry script.
- Run bootup.py, or import and call
Run the main program:
python3 main.py
Import and use:
buzzer.buzzer_on()/buzzer.buzzer_off()buzzer.beep(duration_ms=100)buzzer.pattern(beeps=2, on_ms=100, off_ms=150)buzzer.alarm(duration_ms=1000)
Create a StatusLEDs instance with a pigpio.pi() and use:
leds.set("red" | "yellow" | "green" | "blue" | None)leds.flash_all(times=3, period=0.4)
- main.py references functions such as
all_fans_init(),vent_fans_start(),sensor_fan_start(),take_readings(),buzzer_ini(), andled_init()that are not yet implemented in this repository. - The hardware state machine in
hardware.handle_data()is a placeholder. - Logging is currently written to
log.txtin append mode.
bootup.py
buzzer.py
LED_control.py
main.py
README.md