Monitor your plants, keep track of them environment and automate your water pump to irrigate them.
Project consists to allow users to manage irrigation system and monitor the growing plants/crop 24/7 with the help of an IoT system. The IoT system is composed by 3 main components:
-
A Website: Company's website let web visitors see what's the company about and what services/products it offers. Website visitors are able to contact the company, register to newsletters and give feedback on products and services.
-
A Web application: Allows users to register an account, view data collected from the sensors,
control water pump
, checkprojected yields
and manage life-cycle of the growing plants/crop,manage your sensors and pumps
and more... -
A Rest API: Allows your wireless
pump controllers
&sensors
(Raspberry Pi) to register and communicate with the web application to be able to send collected sensor data and receive instructions to control the water pump. -
A Raspberry Pi System Repository: Hardware that allow us to collect and control a remote wireless system. Which is composed, by a
weather sensor
(temperature, humidity & atmospheric pressure),soil sensors
(moist, temperature & pH) and arelay system
to control the water pump
-
- Installing Web Application and Rest API
- Installing Raspberry Sensors
-
- Access Website
- Access App - Flask
- Access Database Client - Adminer
- Communicate with your API - Flask
-
- Clone repository and go inside the repository folder "site-app-docker"
git clone https://github.com/Fantaso/site-app-docker
- Build the docker images
docker-compose build
- Initialize database used in the web app
docker-compose run --rm app python manage.py db init
- Create the database mapping to migrate the database
docker-compose run --rm app python manage.py db migrate
- Apply the migration changes detected to the database
docker-compose run --rm app python manage.py db upgrade
- Add a test user to login into web app
docker-compose run --rm app python manage.py addusers
- Add the crops data to the database
docker-compose run --rm app python manage.py addcrops
- Add the licenses data to the database (licenses are string identifiers that allows to control which IoT sensors belongs to which user, and it is used for the IoT sensors to send the sensor data to the web app)
docker-compose run --rm app python manage.py addlicenses
- Run the Docker containers
docker-compose up
Visit Raspberry Pi Repository
Once docker-compose is done downloading all images and none of the services failed after you have run the containers with docker-compose up
The web application should be running and you can access it in your web browser at http://0.0.0.0:5000 or at http://0.0.0.0:5000/site
which will take you to the website and there in the navigation bar you can find the login link.
Access the web app at http://0.0.0.0:5000/app
You will be prompt to enter Username and Password, which we have registered in Step # 6
of the installation. Or you could register a new user following the link at the login page.
Login information:
- Username = fan@fantaso.de
- Password =
123456
Access the database client at http://0.0.0.0:8080
You will be prompt to enter System, Server, Username, Password, Database which has been pre-configured within the web app at config.py
and the docker-compose.yml
files.
Login information:
- System =
PostgreSQL
- Server =
db
- Username =
postgres
- Password =
password
- Database =
mydb
Access the API at http://0.0.0.0:5000/agrimodule_api You can talk to the API if you have an API client like Postman in order to test and check how the process of registering a sensor or a pump controller into your web application.
-
Check if the API is working at:
- Method:
GET
- Url:
/agrimodule_api/
- Method:
-
Check if IoT devices license is valid:
- Method:
GET
- Url:
/agrimodule_api/check/<identifier>
- Method:
-
Register IoT devices and get credentials:
- Method:
POST
- Url:
/agrimodule_api/register
- Payload:
identifier
= strmac
= str
- Response:
username
= strpassword
= str
- Method:
-
Send IoT devices data to web app database:
- Method:
POST
- Url:
/agrimodule_api/agrimodule/<agrimodule_id>/set-measurement
- Payload:
agrimodule_id
= inttimestamp
= datetimesoil_ph
= floatsoil_nutrient
= floatsoil_temp
= floatsoil_humi
= floatair_temp
= floatair_humi
= floatair_pres
= floatsolar_radiation
= floatbatt_status
= intlat
= floatlon
= float
- Method:
-
Get an IoT specific measurement from the web app:
- Method:
GET
- Url:
/agrimodule_api/agrimodule/<agrimodule_id>/get-measurement/<measurement_id>
- Method:
-
Get all data collected by an IoT device:
- Method:
GET
- Url:
/agrimodule_api/agrimodule/<agrimodule_id>/get-measurements
- Method:
-
Unregister IoT devices:
- Method:
GET
- Url:
/agrimodule_api/unregister/<identifier>/<mac>
- Method:
Technology Stack | ||
---|---|---|
Python | back-end | |
Flask | web-framework | |
SQLAlchemy | orm | |
PostgreSQL | database | |
Docker | container | |
Docker-Compose | container-manager | |
Adminer | database-client |
Get in touch -–> fantaso.de