Skip to content

This is the project repository for the course 113455a "Cloud Services and Internet of Things". Target was to connect IoT devices using scalable cloud services in a project setup.

Notifications You must be signed in to change notification settings

codeOfJannik/cloud-iot-plant-watering

Repository files navigation

chronos

This is the project repository for the course 113455a "Cloud Services and Internet of Things". Target was to connect IoT devices using scalable cloud services in a project setup.

Features/functions of this project

This project implements automated plant watering for any number of beds. For each bed any number of soil mositure sensors can be assigned. Based on the readings of the soil mositure sensors for a bed and the threshold for the bed, set optionally on a control panel device, the related watering valve will be opend or closed. Additional another valve is implemented which controls the water source based on the fill level of a rain barrel. The minimum fill level of the rain barrel before it is used as the water source can also be set via the control panel device.

As cloud provider AWS was chosen and that's why most of the files are in JSON. All infrastructure setup, both on the AWS site and on local site, is done via Terrafrom. AWS IoT Core and AWS IoT Events are the services used on server side. For more information see IoT Core and IoT Events. Programming of the software code for the devices was done in Python. Due to COVID-19 there were no real devices and sensors, so emulator devices were used instead. The emulators are based on the following project: https://gitlab.mi.hdm-stuttgart.de/csiot-tools/emulator.

Architecture/Infrastructure

Architecture

Further readme files for other important project aspects

Setup instructions

Requirements

  • AWS Account (NO AWS Educate account - does not include AWS IoT Events!)
  • AWS CLI Version > 2.0.27 installed
  • Terrafrom installed
  • Docker and installed
  • git clone git@gitlab.mi.hdm-stuttgart.de:csiot/ss20/chronos.git

Setup steps

1. Update your AWS Credentials

Put your valid AWS credentials to $HOME/.aws/credentials on Linux and OS X or %USERPROFILE%\.aws\credentials on Windows and update the profile in chronos_infrastructure/main.tf

2. Build emulator and software image

The csiot/emulator and chronos/software docker images need to be build once. Run the build script located at the root directory with . build

3. Initialize Terraform

terraform init chronos_infrastructure/

4. Optional: Check terraform script

terraform plan chronos_infrastructure/

There should not be any errors.

5. Execute terraform script (see README)

terraform apply chronos_infrastructure/

Terraform creates the AWS IoT Events Inputs and Detector Models (see iot_events module). After that, Terraform creates an AWS IoT Thing, certificate and policy for each device declared by a directory in devices/chronos_iot/devices, as well as rules to send data to iot events (see iot_core module). After creating the AWS resources, Terraform deploys two docker containers (emulator & software) for each device (see docker module). After building the Docker containers, the run.py script is started in the software container of each device (see Dockerfile and README).

If changes to software or config files occured and the docker containers should be restarted, it's necessary to call terraform destroy chronots_infrastructure/. Otherwise the AWS IoT MQTT client won't work as desired.

Information terraform destroy

When terraform destroy chronos_infrastructure/ is executed, the Docker containers are stopped and all AWS resources are deleted in reversed order.

New Devices

New devices can be added by creating a new folder for the device at iot_core/devices. More information about can be found here.

Contributors

Jannik S. (js329@hdm-stuttgart.de)
Patrick E. (pe019@hdm-stuttgart.de)
Jan Z. (jz043@hdm-stuttgart.de)

About

This is the project repository for the course 113455a "Cloud Services and Internet of Things". Target was to connect IoT devices using scalable cloud services in a project setup.

Topics

Resources

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •