4.7 KiB
4.7 KiB
Imperial College London
Sensing and IoT Coursework Project
Reducing water waste by automatically dispensing lower bound water amounts, calculated using a ML Model using present weather data
About
This project aims to integrate hardware IoT sensors (some RPi Zero's with I2C probes) and Machine Learning (Deep-NN) to predict how much water a outdoor garden will need every day.
The ML Model uses the last 24hrs of collected weather data to make a prediction around mow much water needs to be dispensed to keep the plants alive.
This approach hopes to reduce the overall water use by not watering plants in excess.
Project diagram
TODO
File Structure
This part is long, click to expand
data_collector/Main data collector and uploader modulesecrets/Private API keysicl-iot-weather-firebase-adminsdk.jsonFirebase key for database accessweather_api_key.txtOpenWeather API key
data_colelctor.pyPython script for data collectionDockerfileContainerizing the applicationrequirements.txtPython requirements for running the script
data_processor/ML on demand data processing modulefirebase_python_image/Since building a tf image takes ages, we build it once and use it for testing the ml script laterDockerfileBuilding a tensorflow image for armv7l
secrets/Private API keysicl-iot-weather-firebase-adminsdk.jsonFirebase key for database access
watering_model.model/Saved ML modelfor water predicitonsDockerfileContainerizing the applicationwater_predictor.pyOn demand, real time watering predictor script
Diagrams/Process and block diagramsblock_and_process_diagrams.drawioTODO
lora_nodes/Scripts running on the Pi Zero nodesmaster/Scripts running on the primary, internet connected Piirrigator/Daily watering moduleDockerfileContainerizing the applicationirrigator.pyDaily watering scriptrequirements.txtPython requirements for running the script
DockerfileContainerizing the applicationmain.pyMain data server, collects data from satellite over LoRa and returns over httprequirements.txtPython requirements for running the script
satellite/Data reading and sending module for the sensor PiDockerfileContainerizing the applicationmain.pyLoRa commend listener, temperature reader and pump controllerrequirements.txtPython requirements for running the script
manual_data_processing/iPython notebooks used for data processing and model trainingdatasets/*Various datasets used for processing and training- TODO
site/*Monitoring website, HTML+CSS+JS, hosted on Firebase.gitignoreGitignore file preventing all my API keys from showing up online...README.mdSeeREADME.md
Installation and running
- Clone this repo
- Create the secrets folders
- Generate a set of firebase and OpenWeather API credentials and place them in the secrets folders, rename accordingly
- Move the
masterfolder to the main Pi - Move the
satellitefolder to the sensor Pi - Install Docker on all Devices
- Build the docker images on the relevant architectures (for me everythong was build on armv7)
data_colelctor:docker build -t siot-weather-collector .data_processor:docker build -t siot-data-processor .master/irrigator:docker build -t master-node .master:docker build -t irrigator .satellite:docker build -t satellite .
- NOTE: The ML Dockerfile is very long and complicated because tensorflow does not play well with a 32 bit arm architeture, if you are building for x86 or arm64, you may need to change the file
- Run the docker containers:
- The
data_collectoron the cloud device:docker run -d --restart always --name siot_weather_collector siot-weather-collector - The
data_processoron the cloud device:docker run -dp 3535:3535 --restart always --name siot_watering_predictor siot-data-processor - The
masteron the master Pi:docker run -dp 3333:3333 --privileged --restart always master-node - The
master/irrigatoron the master Pi:docker run -d --privileged --restart always irrigator - The
satelliteon the sensor Pi:docker run -d --privileged --restart always satellite
- While you are free to use my ML model included in this repo, I suggest you explore the
manual_data_processingfolder and create your own. - You will also need at least 24hrs of data before the model can make predictions, so the
siot-weather-collectorimage must be started at least 24hrs before the others
Maintainers and Contributors
Max Hunt: me@maxhunt.design