/SchoolBellProject

Real school project. RPI 3 control 3.5 mm jack audio system

Primary LanguagePythonMIT LicenseMIT

School Bell System

About

image This is a project to automate the work of school bells. The main features are the ease of installation of the system and simple configuration through a convenient web interface.

Techincal Stack

Hardware

  1. RPi 3B (Or any another Raspberry PI or it's copies, like Orange Pi)
  2. 3.5 mm audio system

Backend

  1. Python + Playsound lib
  2. Flask - REST API
  3. Sqlite3 - Database

Frontend

Native stack

  1. HTML5 + CSS3 + Pure JS(Modern fetch api for ajax api)

Installation

Clone this repository to your Raspberry PI

git clone https://github.com/ret7020/SchoolBellProject

Start the installer(WITH ROOT PRIVILAGES)

chmod +x installer.sh
sudo ./installer.sh

Change SECRET_KEY in config.py to long random string
Run project(only for current ssh session without autostart)

./run.sh

Default password from admin panel: 12345

Production deployment

Autorun on boot

This is an instruction for systemd systems(systems with systemd as init). In the other cases refer to documentation for your init system.
If you clone repository in local user(named with pi) folder you will not have to change systemd service config.

  1. Open ./configs/school-bells.service with vim, nano or another text editor.
vim school-bells.service
  1. Edit line number 7, change /home/pi/Documents/Progs/SchoolBellProject/ with your absolute path to directory with SchoolBellProject
  2. Edit line number 8, change /home/pi/Documents/Progs/SchoolBellProject/run.sh with absolute path to run.sh file SchoolBellProject dir
  3. Edit line number 9, change /home/pi/.local/lib/python3.9/site-packages with absolute path to your python env(with installed libraies from requirements.txt)
  4. Then execute script setup_autorun.sh
  5. After it you can check service status (if must be active)
sudo systemctl start school-bells.service

Enable port 80 for Flask (via nginx forwarding)

The installer script immediately installs nginx, adds it to autoload and applies a special config that redirects port 8080 from the flask server to 80 nginx port.

Test final deployment steps

  1. Check web ui on port 80.
  2. Reboot RPi and check autorun on boot

Development workflow

ToDo

  1. Base timetable watcher ✔️
  2. Bell ring method ✔️
  3. WebUI to edit timetable ✔️
  4. WebUI ability to upload melodies ✔️
  5. Adaptive WebUI for smartphones ✔️
  6. Bindings to weekdays(DISABLE bell on Saturday and Sunday) ✔️
  7. Design as a REST API application with mostly AJAX WebUI as client ✔️
  8. Create Production Setup ✔️
  9. Create first release (1.0.0) ✔️
  10. Delete melody from list ✔️
  11. Modify Lesson start melody and finish melody

Screenshots

image image image