Smart Flowerpot

by Yitro Verstraeten in Circuits > Raspberry Pi

238 Views, 1 Favorites, 0 Comments

Smart Flowerpot

IMG_8062.jpg

I always want some plants around. Unfortunately, most of them die after some time. So I thought that is was a great idea to make something that automatically waters my plant. I am a student at MCT at Howest and @ the end of the first year I need to make a project.

I thought about why my previous plants died. Which showed that I was either giving them too much or too little water. That's why I made this project.

Supplies

Electronics:

  • 1 Raspberry Pi 4 + T-Cobbler
  • 1 LCD display
  • 3 DALLAS DS1820
  • 1-Wire sensors
  • 1 Soil moisture sensor
  • 5 LM393 Light sensors
  • 1 LED strip
  • 3 MOSFET (IRF520)
  • 1 Water pumpBreadboard + power supply
  • A lot of dupont calbes

Materials:

  • Screws
  • MDF plate
  • 2 flower pots
  • Tape
  • Spray paint

Setting Up the Raspberry Pi

First you need to download the image for the Pi here. I usually take the full version because it's easier to work with. After you downloaded the file. You write that image on an SD card. You 'll need to change some and add a file. In de file "cmdline.txt" you need to add "ip=192.168.168.168" to the end of that file.

After that you make an empty file "ssh" without an extension. Put that file in the same directory as the "cmdline.txt". You can now insert the SD card in the Pi. Connect the Pi to power and connect it with an ethernet cable to you PC. Make sure that your PC has a static IP "192.168.168.100".

Once you booted into the Pi change some configurations. You can do that with the command "sudo raspi-config". Go to interfacing Options and activate the 1-wire, SPI and I²C bus.

Connect to WIFI. Once you are connected, you can download the updates and required packages in the following order:

  1. "sudo apt update && apt upgrade -y" This will get the latest updates for the Pi.
  2. "sudo apt install mariadb-server apache2" These will run the webserver and database respectively.
  3. "sudo pip3 install Flask Flask-Cors Flask-SocketIO gevent gevent-websocket greenlet spi SPI-Pyspidev" These are some Python packages needed to run the backend for this project.
  4. And finally "sudo apt install python3-mysql.connector -y" to connect to the database

Next you'll need to setup the database.

Building the Circuit

breadboard.png
Schema v1_schema.png

To build the circuit, you can follow the schematics.

Building the Case

IMG_8047.jpg
IMG_8061.jpg
IMG_8042.jpg
IMG_8049.jpg
IMG_8057.jpg
IMG_8058.jpg
IMG_8040.jpg
IMG_8063.jpg
IMG_8045.jpg

The case is made of old MDF plates. They were the previous doors of my kitchen cabinets. I cut the planks to size. Pre-drilled the holes and screwed everything together. I made a 2nd floor in my case to separate the electronics from the water.

I spray painted the casing and the flowerpot. Made a hole in de pot and the casing to pass al the cables trough.

Writing the Code

You can download the code here.

You place the files in a folder. You copy the files of the folder "Code/Frontend" into "/var/www/html".

These are the files for the website. The files in "Code/Backend" need to be placed in "home/pi". Change the config.py file with your own password and username.

The Smart Flowerpot Is Ready

IMG_8062.jpg

Now everything is done. If you have a question, feel free to leave a comment and I'll try to answer as fast as I can.