In week 19 we explored methods to store data collected from sensors over time. We ultimately decided to structure data in database like so:
The primary key used should be (Timestamp, SensorID).
After doing some research, we realised there are two kinds of databases we can use:
SQLite (locally)
Azure Database (on cloud)
Initially, we implemented the SQLite to test the queries work:
We made a decision to use Azure Database as this means we can access the data anywhere as long as we are connected to the internet. Here is the profile for the iot-farmbeats database.
The database_manager.py and azure_database_manager.py code were implemented to create the table and make direct SQL queries.
To connect to the database, we initially used the ODBC driver. However, there was the issue of allowing the raspberry pi to connect, which led us to find an alternative solution: IoT Hub.
In addition, we also coded the GUI to have a more appealing appearance to match our prototype. This includes sketching button sketches using Procreate, adding the png files to assets and displaying the images instead of the Tkinter default buttons. As well as this, we used the Tkinter canvas to draw rectangles to represent the scale displaying current sensor reading.
The GUI menu and profile pages now look like this:
Comments