-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Use the Sidebar to navigate to other pages.
This project was made with the intention of measuring temperature
,
humidity
, sound
and light
changes in an office environment.
Sensor Readings will be shown in the graphs rendered on the root HTML page.
The Data will be collected at a rate depending on the on configuration of the mbed project.
The data is sent with a HTTP POST request to the Entry
API endpoint.
The data collected will be stored in the database to provide historic graphs(to be implemented later)
In the mbed project it is possible to adjust how often the client will send the data to the API.
The embedded controller project is located in the mbed
folder, and is meant
to be compiled with the mbed online compiler.
The embedded controller project uses mbed-os
version: 5.11.1
.
The project is meant to also accommodate read outs on a screen from the embedded contrller, but due to time constraints that rendering of data on the screen of the embedded controller was not finished.
The Server part of the project is meant to be run with docker-compose
as this
enables the server to be run on any server with easy, that images that have been created
has also been tested on the arm64 architecture which means that it is also possible to
run this project on a Raspberry Pi.
The API Server is intended to be run through docker. Docker is a technology that allows you to run applications and servers on any operating system without installing the dependencies on the host system causing potential conflicts.
Docker compose is a command written in Python using the docker API to compose and organise multiple Docker Containers.
The API Server has been tested and proven to be stable when running on ARM64 or x86 architectures
The database used is PostgreSQL this can at any time be changed but doing so will require a regeneration of the migrations and a change of the connection options for the database.
All the database data is getting processed and handled through the Doctrine ORM and the migrations can be generated with Doctrine Migrations, this means that the API server supports all the database platforms that the Doctrine ORM supports, the complete list of which can be found here
The API is writtin in the PHP programming language using a micro framework called Slim
Slim is a micro-framework and therefore doesn't come with all that much functionality
out of the box, but it has great expandability which means that it is easy to include other
composer packages to fill in the functionality that you are missing.
The API also has 1 page that is render with a PHP library called Twig. Twig is a library that allows you to create easy to read HTML views and render them.
The API uses the PHP-DI library to handle Dependency Injection. Dependency injection is a technique in which an object receives other objects that it depends on.
The API uses the Respect Validation library to validate content received from the client.
Composer is a package manager for PHP which allows you to easily manage dependencies for your PHP project. Composer greatly simplifies that act of depending on external libraries and updating those libraries.
To run this project to will need the following:
docker
docker-compose
php
composer
# Clone the project
git clone [email protected]:sicet7/rpi-school-project.git
# Go into the repo
cd rpi-school-project
# Go into the php src
cd src
# Install composer requirements
composer install
# Go back to the repo root directory.
cd ..
# Run the project with docker-compose
docker-compose up -d
When the project is running, then if it is the first time you are running the project then you will need to go into the PHP docker container and run the migrations, this can be done with the following commands:
# Getting inside the container
docker exec -it <docker-container-name> sh
# Get to the right directory in the container
cd /var/www/html
# Running the migrations (this requires interaction)
php bin/vendor/doctrine-migrations migrate