It is a simple IoT solution for plant life monitoring and maintenance, based on STM32NUCLEO boards and expansion modules.

Dependencies:   BLE_API X_NUCLEO_IDB0XA1 X_NUCLEO_IKS01A1 mbed

GreenYourLife, A Plant Life Monitoring and Maintenance System

Elaborated By Engineers, Designed For The World

Introduction

A healthy ecosystem is one where all the actors in it work in synergy: each of them playing a part that serves the other. Plants play an important part in regulating our quality of life. In the modern world, they would often times be placed in buildings and houses, as decorations or as medicinal and therapeutic purposes. Whatever the reason, GreenYourLife is here to help you manage them.

GreenYourLife is an Internet of Things (IoT) solution that will allow you to perform the following:

  • Follow your plant's well-being on your connected device (smartphone, etc.)
  • Maintain your plant's well-being automatically

We've developed an indoor plant monitoring system with the STM32NUCLEO development board. The system will collect the plant's environmental data (air temperature, air humidity and soil moisture) and transfer them to your connected device. The data collected will then be stored on a cloud server, where you can follow the progress of your plant life.

How it works

Plant maintanence

Our concept of maintanence is the automatic catering of the plant's needs. In this version, we focus on water supply. Future versions may indeed include more than that.

On-board sensors on the STM32NUCLEO will obtain measurements of 3 main parameters on the plant surrounding:

  1. Air temperature
  2. Air humidity
  3. Soil moisture

Based on these values, the software then acts upon the water pump: activating it when in need of water and deactivating it if not.

Plant monitoring

Plant monitoring, for us, is the follow-up of the plant's health by monitoring environment quality and plant nutritions. In this version, we only monitor the three parameters listed above. Future version may include more advanced and smarter monitoring technique.

The STM32NUCLEO device acts as a Bluetooth server and awaits connection from any client (smartphone, etc.). Upon connection, the server updates the plant environment parameters at a fixed interval. The client application will then transfer these received characteristics to the cloud.

Details

Hardware

The target platform is the STM32NUCLEO L476RG development board with two additional modules:

  • the IDB05A1 Bluetooth LE expansion board, which uses a BlueNRG coprocessor
  • and the IKS01A1 MEMS sensor expansion board

There are several additional materials that constitute the system:

  • a Funduino Soil Moisture Sensor, hooked up to 5V at pin PB_1
  • a relay, hooked up to 3.3V at pin PC_8 and controlled by a PWM pulse
  • a DC water pump

Software

We have used the ARM mbed platform for general code bring-up. We've used the following libraries:

  • mbed library by ARM
  • BLE_API library by the Bluetooth Low Energy team
  • X_NUCLEO_IDB0XA1 library by the ST Microelectronics team
  • X_NUCLEO_IKS01A1 library by the ST Microelectronics team

The acquired data on the client device is then sent to a cloud server that we hosted on ThingSpeak, so that people can remotely access the data. It is available at the GreenYourLife channel .

Reference

Committer:
kaiserhaz
Date:
Sat Nov 26 13:38:23 2016 +0000
Revision:
0:7dce5e74ad91
Child:
5:b98f4f7cee5a
Initial commit.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kaiserhaz 0:7dce5e74ad91 1 /************************ STM32NUCLEO IOT Contest ******************************
kaiserhaz 0:7dce5e74ad91 2 *
kaiserhaz 0:7dce5e74ad91 3 * Green Building IoT Solution for
kaiserhaz 0:7dce5e74ad91 4 * Plant Life Monitoring And Maintenance
kaiserhaz 0:7dce5e74ad91 5 *
kaiserhaz 0:7dce5e74ad91 6 * Authored by
kaiserhaz 0:7dce5e74ad91 7 * Dien Hoa Truong
kaiserhaz 0:7dce5e74ad91 8 * Muhammad Haziq Bin Kamarul Azman
kaiserhaz 0:7dce5e74ad91 9 *
kaiserhaz 0:7dce5e74ad91 10 * for the
kaiserhaz 0:7dce5e74ad91 11 * eSAME 2016 STM32NUCLEO IoT Contest in Sophia-Antipolis
kaiserhaz 0:7dce5e74ad91 12 *
kaiserhaz 0:7dce5e74ad91 13 *
kaiserhaz 0:7dce5e74ad91 14 * GreenBuildingService.h | Green Building Service header
kaiserhaz 0:7dce5e74ad91 15 *
kaiserhaz 0:7dce5e74ad91 16 ******************************************************************************/
kaiserhaz 0:7dce5e74ad91 17
kaiserhaz 0:7dce5e74ad91 18 #ifndef __BLE_GREEN_BUILDING_SERVICE_H__
kaiserhaz 0:7dce5e74ad91 19 #define __BLE_GREEN_BUILDING_SERVICE_H__
kaiserhaz 0:7dce5e74ad91 20
kaiserhaz 0:7dce5e74ad91 21 #include "ble/BLE.h"
kaiserhaz 0:7dce5e74ad91 22
kaiserhaz 0:7dce5e74ad91 23 /**
kaiserhaz 0:7dce5e74ad91 24 * @class GreenBuildingService
kaiserhaz 0:7dce5e74ad91 25 * @brief Custom service derived from mbed's BLE Environmental Service. This service provides air temperature, humidity and soil moisture measurement.
kaiserhaz 0:7dce5e74ad91 26 */
kaiserhaz 0:7dce5e74ad91 27 class GreenBuildingService {
kaiserhaz 0:7dce5e74ad91 28 public:
kaiserhaz 0:7dce5e74ad91 29
kaiserhaz 0:7dce5e74ad91 30 static const uint16_t UUID_GREEN_BUILDING_SERVICE = 0xEB00; /**< Green Building service UUID */
kaiserhaz 0:7dce5e74ad91 31 static const uint16_t UUID_PLANT_ENVIRONMENT_CHAR = 0xEB01; /**< Plant environment characteristic UUID */
kaiserhaz 0:7dce5e74ad91 32
kaiserhaz 0:7dce5e74ad91 33 /** Plant environment data type
kaiserhaz 0:7dce5e74ad91 34 *
kaiserhaz 0:7dce5e74ad91 35 */
kaiserhaz 0:7dce5e74ad91 36 typedef struct
kaiserhaz 0:7dce5e74ad91 37 {
kaiserhaz 0:7dce5e74ad91 38 uint8_t airTemperature; /**< Air temperature value */
kaiserhaz 0:7dce5e74ad91 39 uint8_t airHumidity ; /**< Air humidity value */
kaiserhaz 0:7dce5e74ad91 40 uint8_t soilMoisture ; /**< Soil moisture value */
kaiserhaz 0:7dce5e74ad91 41 } PlantEnvironmentType_t;
kaiserhaz 0:7dce5e74ad91 42
kaiserhaz 0:7dce5e74ad91 43 /**
kaiserhaz 0:7dce5e74ad91 44 * @brief GreenBuildingService constructor.
kaiserhaz 0:7dce5e74ad91 45 * @param ble Reference to BLE device.
kaiserhaz 0:7dce5e74ad91 46 */
kaiserhaz 0:7dce5e74ad91 47 GreenBuildingService(BLE& _ble) :
kaiserhaz 0:7dce5e74ad91 48 ble(_ble),
kaiserhaz 0:7dce5e74ad91 49 plantEnvironmentCharacteristic(GreenBuildingService::UUID_PLANT_ENVIRONMENT_CHAR,
kaiserhaz 0:7dce5e74ad91 50 &plantEnvironment ,
kaiserhaz 0:7dce5e74ad91 51 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)
kaiserhaz 0:7dce5e74ad91 52 {
kaiserhaz 0:7dce5e74ad91 53 static bool serviceAdded = false; // Ensure only single service is added
kaiserhaz 0:7dce5e74ad91 54 if (serviceAdded) {
kaiserhaz 0:7dce5e74ad91 55 return;
kaiserhaz 0:7dce5e74ad91 56 }
kaiserhaz 0:7dce5e74ad91 57
kaiserhaz 0:7dce5e74ad91 58 GattCharacteristic *charTable[] = { &plantEnvironmentCharacteristic }; // Compile characteristics
kaiserhaz 0:7dce5e74ad91 59
kaiserhaz 0:7dce5e74ad91 60 GattService greenBuildingService(GreenBuildingService::UUID_GREEN_BUILDING_SERVICE,
kaiserhaz 0:7dce5e74ad91 61 charTable ,
kaiserhaz 0:7dce5e74ad91 62 sizeof(charTable) / sizeof(GattCharacteristic *)); // Create GATT service
kaiserhaz 0:7dce5e74ad91 63
kaiserhaz 0:7dce5e74ad91 64 ble.gattServer().addService(greenBuildingService); // Register service with GATT server
kaiserhaz 0:7dce5e74ad91 65
kaiserhaz 0:7dce5e74ad91 66 serviceAdded = true;
kaiserhaz 0:7dce5e74ad91 67 }
kaiserhaz 0:7dce5e74ad91 68
kaiserhaz 0:7dce5e74ad91 69 /**
kaiserhaz 0:7dce5e74ad91 70 * @brief Update plant environment characteristic.
kaiserhaz 0:7dce5e74ad91 71 * @param newPlantEnvironmentVal New plant environment measurement.
kaiserhaz 0:7dce5e74ad91 72 */
kaiserhaz 0:7dce5e74ad91 73 void updatePlantEnvironment(PlantEnvironmentType_t newPlantEnvironmentVal)
kaiserhaz 0:7dce5e74ad91 74 {
kaiserhaz 0:7dce5e74ad91 75 plantEnvironment = (PlantEnvironmentType_t) (newPlantEnvironmentVal);
kaiserhaz 0:7dce5e74ad91 76 ble.gattServer().write(plantEnvironmentCharacteristic.getValueHandle(), (uint8_t *) &plantEnvironment, sizeof(PlantEnvironmentType_t));
kaiserhaz 0:7dce5e74ad91 77 }
kaiserhaz 0:7dce5e74ad91 78
kaiserhaz 0:7dce5e74ad91 79 private:
kaiserhaz 0:7dce5e74ad91 80 BLE& ble; /*< Local BLE controller reference */
kaiserhaz 0:7dce5e74ad91 81
kaiserhaz 0:7dce5e74ad91 82 ReadOnlyGattCharacteristic<PlantEnvironmentType_t> plantEnvironmentCharacteristic; /*< Plant environment read-only characteristic */
kaiserhaz 0:7dce5e74ad91 83
kaiserhaz 0:7dce5e74ad91 84 PlantEnvironmentType_t plantEnvironment; /*< Local var for plant environment */
kaiserhaz 0:7dce5e74ad91 85 };
kaiserhaz 0:7dce5e74ad91 86
kaiserhaz 0:7dce5e74ad91 87 #endif /* #ifndef __BLE_GREEN_BUILDING_SERVICE_H__*/