Introduction: Automated Garden Monitoring System - Slimme Serre

About: Student NMCT @ Howest te Kortrijk

As a student, I have a habit of forgetting things. Because of that, I'm unable to plant any plants,vegetables or herbs. But now with the help of The Slimme Serre, this is no longer a problem.

The Slimme Serre is an automated gardening monitoring system that sends the data of the sensors that are in the device, to a webserver. So that the user can monitor their plants on a website. With The Slimme Serre it is possible to monitor your plants, all while being in the comfort of your own couch.

This concept is being developed as a final project within the first year of multimedia and communication technology, at Howest Kortrijk, Belgium.

Step 1: The Materials

In order to build this project, you will need the following items:

Electronics:
1 ) Raspberry pi 3 - kit
2 ) Breadboard
3 ) Male-to-male connectors
4 ) Male-to-female connectors
5) DHT11 (humidity + temperture sensor)
6) YL-69 (Soil moisture sensor)
7) LDR (light sensor)
8) MCP3008
9) Potentiometer
10) LCD-display
11) Button
12) Resistors

Casing:
13) Polyethylene plates
14) PVC Profiles
15) Piano hinges
16) Tec-7
17) Normal carboard box
18) Plastic or farbic

Tools:
19) Grinding wheel machine / Drill
20) Ruler
21) Marker
22) File
23) Saw

Step 2: Making the Circuit

In Step 2 we are going to make the basics electronics for this project. You take all the electronic materials from step one and put it together like the photo above. Use the fritzing table and the diagram to make an exact copy of the circuit.

Information about the circuit:
We have the major circuit with the MCP3008 and all the sensors that are attached to it. You can connect the YL-69 and the LDR to this chip. But the DHT11 has a digital-output, so it needs to be connected to a GPIO-pin on your raspberry pi.

Extra:
You can also implement the LCD-display,the button and the potentiometer into your circuit. Later we are going to display our real-time values of our sensors on this display. If this circuit is to hard for you, you can always leave out the LCD-display and only work with the other sensors.

Step 3: Create a Database

It's important to store your data from the sensors in a secure and organized way. I did this with a database, so I can secure my data (with a personal account) and keep it organized. In the picture above, you can find my ERD from my database and a file to export the database to a database-program (Like MySQL).

The structure:
You can divide my database in 3 groups.
The first group are the tables where the information is placed about the sensor.
The second group is a collection of 3 tables with the same purpose, store the data from the sensor.
In the end we have the third group, and that is the System table where everything is linked together to create one big system (my Slimme Serre).
This system table is important for the project in the future (for example, you want more than one system). But for now, we will focus on one system only.

Database-program
It's very important that our database runs from our raspberry pi 3. You can do this by downloading MySQL for the raspberry pi, connect Pycharm (A program from jetbrains) with your raspberry pi and add a datasource. This way we get a nice visual representation of our database that is running from the raspberry pi. I will not explain how you actually install MySQL for the raspberry pi, because there are enough tutorials on the internet that explain it much better than I do.

Step 4: Connecting the Database With the Sensors

After the database is up and running on your raspberry pi, we now start and import data into it. We do this by creating 3 scripts, one script for every sensor. This way the connection with your database will be more stable, because I had a lot of trouble making a stable connection with one major-script(this major script was a script where every sensor was putting data inside the database at once).

You can download all the scripts on my github page: https://github.com/MollieMaarten/Pi_Code.git

Details github:
When you go to my github page, you see 2 folders. One is called launcher, the other is called scripts. For now, we need the folder scripts. In this folder you will find 4 scripts in total. There are 3 scripts that are the code for every sensor. And one script named: LCD_Vocht.py

LCD_Vocht.py
This script is only for people who implemented the LCD-display onto their circuit, it's because this is the script for controlling that LCD-display. With this script up and running, the user can switch between real-time values of the sensor.

Step 5: Measuring the Soil Moisture Sensor

This step is very important for the health of your plants.

If you want to know, which values are too much or which values are too little of moisture for your plants. You need to measure the sensor. I did this by taking 4 containers with different amounts of water in the soil. My findings were:

10 - 45 %
Dry

45 - 70 %
Good

70 - 100 %
Too much

Step 6: Automatisation Script

It's very important that our scripts for reading the sensors start automatically. This is to prevent the possibility of power-outage and needing to reset everything manualy.

Time interval:
For my project I worked with crontab on the raspberry pi, this 'program' helped me to run my scripts every 5 minutes. It's very easy to use, you just need to make a .sh-file to start you script.
You can always follow this usefull tutorial: https://www.instructables.com/id/Raspberry-Pi-Laun...

Launchers:
In the tutorial above, you will need to make .sh-files. If you go to my github-page and look inside the launcher folder. You will see all the .sh-files that you need for this project.

Link: https://github.com/MollieMaarten/Pi_Code.git

Step 7: Making the Website

I made my website in a program named Bootstrap Studio. I highly recommend this program but it is NOT free, it cost 25 euros.

Importing your website into Pycharm
After you made your website in Bootstrap Studio, it is important that you export it to Pycharm. You can do this by exporting the webpage in html,css,js,... files and importing it into Pycharm. You can find my files fot the website in Pycharm on my github-page.

link: https://github.com/MollieMaarten/Project.git

Step 8: Making the Greenhouse (step 1/2)

We start of by cutting the polyethylene plates to the appropriate sizes. You can do this with the grinding wheel machine.
To make this process easier, I made a plan that you can follow.

Airflow:

It's important to have some kind of ventilation in your greenhouse. That's why I drilled a couple of random holes on the two sides for air to pass through.

Cable-holes:
I drilled one more hole in the back-panel for the powercable for the raspberry pi.

Important:
Keep in mind, always wear safety glases. Because the little pieces of the polyethylene plates can fly into your eye(s).

Step 9: Assembling the Greenhouse 2/2

After you have successfully cut out the parts you need for the greenhouse. We then attach the PVC-profiles to the rough edges of the polyethylene plates. This is to give our greenhouse a nicer finish.

Attaching the PVC-profiles:
This is very simple, you can do this by measuring the border of the polyethylene plates. And then cutting the right pieces of the PVC-profiles. I used a saw to cut this, because it's a very soft and easy material.

After sawing the right pieces, you can attach it with tec-7.
Let it dry for +/- 1 hour.

Assembling the greenhouse:

This is de final step of the greenhouse, you just need to assemble everything. You can do this by using tec-7 and then clamping it together.

First you start by the base 4 walls (side1 ,side2 ,back & front) and let this dry for 1 hour. After that you attach the hinges to the back and the roof with tec7.

It's important that while you are attaching the hinges with tec7, that you don't get tec7 on the middle part of the hinge. The hinge won't work and get blocked if that happens.

Step 10: Putting It All Together

After you have done all the previous steps, you now can put it all into your greenhouse. You can do this by:
- Taping the raspberry pi to the back-panel of your greenhouse.
- Making a little box for the circuit (keep in mind, do not cover the LDR)
- Put the soil moisture sensor in the soil
- Tape the DHT-sensor to one of the sides of the greenhouse
- And take the power-cable of the raspberry pi and put it throught the designated hole in the back-panel