Advanced Alarms

About: I am a Multimedia & Communication Technology student at Howest Kortrijk.

Description:

My project is an advanced alarms system. There is a buzzer and a LED strip that let you know when there is an alarm. When there is an alarm you have to push a button to stop the buzzer and LED strip (if enabled). The alarm is automatically deleted from the database after this action. The color of the LED strip can be chosen on the settings page of the website. You can also enable or disable the LED strip on that page. The home page shows your alarms, you can delete them and add new alarms. On the LCD display, you will see the first upcoming alarm if there are any.

In addition to the alarm system, I've implemented some sensors: a DHT11 which measures temperature and humidity and a light sensor. The data that they measure is inserted into the database. On the sensor history page of the website you will see the last 10 (or less) readings of each type of reading. You will also see the current readings of the sensors on the LCD display.

You may be wondering, how do I access the website? Well, the IP address of the Raspberry Pi is shown on the LCD display. Simply enter it into your browser and you will see the website (if you are connected to the same network as the Raspberry Pi).

Summary:

  • Alarm system (with buzzer and LED strip)
  • Temperature, humidity and light sensors
  • LCD display (shows current sensor values, first upcoming alarm, IP address of Raspberry Pi)
  • Sensor history on website
  • Add, delete, see your alarms on website
  • Change settings for LED strip on website

Step 1: Supplies/Materials/Tools

  • Raspberry Pi 3 Model B+
  • Raspberry Pi T Cobbler
  • 16x2 LCD display (with potentiometer)
  • DHT11 (temperature & humidity)
  • 830pt breadboard
  • Jumper wires
  • 16 GB micro SD card (with adapter)
  • Active buzzer
  • NeoPixel RGB led strip (2m)
  • Raspberry Pi power supply
  • 74AHCT125 level shifter
  • 5V power supply (for led strip)
  • Female DC power adapter (2.1mm)
  • Momentary push button
  • Photo transistor (light sensor)

Total cost of all above components is around € 127 (excl. shipping costs).

Take a look at the file supplies-materials-tools.xlsx for more details.

Step 2: Fritzing Scheme

Make sure the wiring is 100% correct or it probably won't work correctly.

Step 3: Normalized SQL Database

Open the file model.mwb in MySQL Workbench or a different SQL editor and forward engineer this model to make the database. For the SQL database you will install MariaDB on the Raspberry Pi.

Step 4: Code

All code and documentation is on this GitHub repository: https://github.com/DuncanDeVlaminck/advanced_alarms.

Make sure your Raspberry Pi's packages are up-to-date:

sudo apt update && sudo apt upgrade

For the frontend you will need to install Apache2 on your Raspberry Pi.
You need to upload all the files from the frontend directory to /var/www/html using FileZilla or another program that offers SFTP file transer.

For the backend (Python) you will need some extra Python packages. Take a look at the imports of the app.py file and install all of those packages except for the ones imported from the directory classes. I did this using PyCharm (settings > project interpreter) and Putty (pip install).
After that you must transfer all the files from the Python directory to a directory of your choice (example: /home/pi/directory). I did this using PyCharm (SSH connection) but you may use any program you like (SFTP programs should also be fine).
In order to execute the Python code automatically on startup of the Raspberry Pi, add these 2 lines to the file /etc/rc.local (before exit 0):

cd directory_of_python_code
sudo python3.5 -u -m flask run --host=0.0.0.0 --port=5000

Share

    Recommendations

    • Paint Challenge

      Paint Challenge
    • Classroom Science Contest

      Classroom Science Contest
    • Stone Concrete and Cement Contest

      Stone Concrete and Cement Contest

    Discussions