UCL - IIoT - Moisture Data Collector

About: nick7668@edu.eal.dk

This instructable, will provide you with the infomation on the moisture from dirt, which will be able to be viewed on a UI with node-red, furthermore will data be collected and put in a MySQL database, this can help you learn the watering patterns for your plants, learning when they are gonna need water.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts List

1 x Arduino Mega 2560

1 x USB cable

1 x I2C LCD screen

1 x Moisture soil sensor

Wires

Step 2: Wiring

LCD I2C display

GND > GND on arduino

VCC > 5V on arduino

SDA > SDA on arduino

SCL > SCL on arduino

Moisture sensor

GND > GND on arduino

VCC > 5V on arduino

Signal > A0 on arduino

Step 3: Flowchart

This flowchart showcases what we do with the data from our arduino, the whole thing starts with collecting our data from our arduino which then gets send to the MySQL server, from where we are connected to with nodeRED to get the data shown in a display.

Step 4: Code

The code for the Arduino can be seen here, and it is also made as a text document to make it easy to download and implement in Arduino IDE so you can upload it to your own Arduino and see how the code is structured.

Step 5: Node-RED

node-red is used in this project to send and recieve data, that we can then display on a dashboard to see the infomation we put in. We use node-red to get the timestamp put into our MySQL server, and to collect our data from our moisture sensor on our Arduino. This is how we sent data to our MySQL, and also how we collect it for our UI, by retrieving it from our database.

You will need to run and install node-red by going to https://nodered.org/docs/getting-started/installat...
and follow the guide on how to install and run node-red.

When it is installed you will have to run it through CMD to make it go.

The code from my node-red is uploaded as a text file in this instructable and has to be imported into node-red

You will need to install the following libraries into node-red:

node-red

node-red-dashboard

node-red-node-mysql

node-red-node-arduino

node-red-contrib-string

node-red-node-serialport

node-red-node-feedparser

this is to ensure that node-red will function prober with the node-red code which is provided in this instructable. Otherwise this flow will just give you errors.

Step 6: MySQL Wampserver

Wampserver is used to create a MySQL database, in which we can save the data from our Arduino, which in this project is the moisture sensors data. When using Wampserver the server runs locally on your computer, and to sign into your database you will have to sign in with "root" and not enter a code. To communicate with node-red its important that the MySQL set up in the flow contains the same info as your Wampserver database, otherwise it wont be able to connect to it.

In this project I have created a new database called nodered and then created a table called node. You will then create two rows, one for time and one for moisture, this will help collect the moisture data coming from the sensor, and the timestamp is provided by node-red in this case.

Wampserver can be installed here : http://www.wampserver.com/en/

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions

    0
    None
    DIY Hacks and How Tos

    9 months ago

    Nice design. This would be really useful for a smart garden monitoring system.