Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 12, 2022 05:58 pm GMT

Plant Monitor - MongoDB Atlas Hackathon Submission

Overview

Plant Monitor is an IoT-based project for monitoring plant health with ease. The projects consists of three parts:

Submission Category:

Action Star

Link to Code

The code for both the app and the IoT part is present in the following GitHub repo:

GitHub logo sbis04 / plant-monitor

Plant monitoring system using IoT, MongoDB, and Flutter

Plant Monitor

IoT based plant monitoring system which is connected to MongoDB. This is a Flutter app to display the realtime data from the sensors attached to the plant on a mobile device.

License

Copyright 2022 Souvik Biswas

Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.




Project Description

A detailed description of all the three parts of this project is present below.

IoT: Sensors

Hardware sensors

ESP32 module is used for collecting data, processing and uploading to the MongoDB database. It is a low powered microcontroller integrated with WiFi and Bluetooth.

DHT11 sensor is used for measuring raw temperate and humidity data from the surroundings of the plant.

LDR is used for calculating the light intensity that the plant is receiving.

Soil Moisture sensor module is used to measure the moisture or the water level of the soil. The sensor includes a potentiometer to set the desired moisture threshold.

Database: MongoDB

MongoDB Atlas

MongoDB Atlas provides cloud database service using AWS, Azure, and Google Cloud. It also has various automation tools for performing various backend functionalities and comes with visualization tools. The services that are used in this project are described below.

Atlas is used as the main cloud database for storing the sensor readings along with timestamps.

Atlas

Realm Function is defined to easily store the sensor data from the ESP32 module. A HTTP Endpoint is created to access the MongoDB database from the ESP32.

The following function is used for storing the sensor data:

exports = function(payload){    var atlas = context.services.get("mongodb-atlas");    var coll = atlas.db("plantdata").collection("readings");    try {      if (payload.body)       {        body = EJSON.parse(payload.body.text());      }      coll.insertOne(body);      console.log(body);    } catch (e) {      console.log("Error inserting doc: " + e);      return e.message();    }};

Charts are used to visualize the sensor readings directly inside the MongoDB web app.

Charts

For this project I have created four charts:

  • Plant Light (%): Amount of light intensity plant is receiving
  • Plant Humidity (%): Humidity around the plant
  • Plant Moisture (%): Amount of water present in the soil
  • Plant Temperature (C): Current temperature around the plant

Mobile app: Flutter

Flutter app

To use the Realm data inside the Flutter application I have created a modified version of the flutter_mongodb_realm plugin to support Dart null safety and run it on the latest version of the Flutter SDK.

References


Original Link: https://dev.to/sbis04/plant-monitor-mongodb-atlas-hackathon-submission-34j0

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To