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:

IoT: Sensors (for monitoring plant data)

Database: MongoDB (Atlas, Realm and Chart)

Cross platform mobile ap…


This content originally appeared on DEV Community and was authored by Souvik Biswas

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, software distributed 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 and limitations 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


This content originally appeared on DEV Community and was authored by Souvik Biswas


Print Share Comment Cite Upload Translate Updates
APA

Souvik Biswas | Sciencx (2022-01-12T17:58:56+00:00) Plant Monitor – MongoDB Atlas Hackathon Submission. Retrieved from https://www.scien.cx/2022/01/12/plant-monitor-mongodb-atlas-hackathon-submission/

MLA
" » Plant Monitor – MongoDB Atlas Hackathon Submission." Souvik Biswas | Sciencx - Wednesday January 12, 2022, https://www.scien.cx/2022/01/12/plant-monitor-mongodb-atlas-hackathon-submission/
HARVARD
Souvik Biswas | Sciencx Wednesday January 12, 2022 » Plant Monitor – MongoDB Atlas Hackathon Submission., viewed ,<https://www.scien.cx/2022/01/12/plant-monitor-mongodb-atlas-hackathon-submission/>
VANCOUVER
Souvik Biswas | Sciencx - » Plant Monitor – MongoDB Atlas Hackathon Submission. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/01/12/plant-monitor-mongodb-atlas-hackathon-submission/
CHICAGO
" » Plant Monitor – MongoDB Atlas Hackathon Submission." Souvik Biswas | Sciencx - Accessed . https://www.scien.cx/2022/01/12/plant-monitor-mongodb-atlas-hackathon-submission/
IEEE
" » Plant Monitor – MongoDB Atlas Hackathon Submission." Souvik Biswas | Sciencx [Online]. Available: https://www.scien.cx/2022/01/12/plant-monitor-mongodb-atlas-hackathon-submission/. [Accessed: ]
rf:citation
» Plant Monitor – MongoDB Atlas Hackathon Submission | Souvik Biswas | Sciencx | https://www.scien.cx/2022/01/12/plant-monitor-mongodb-atlas-hackathon-submission/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.