Introduction: IGreenhouse - Intelligent Greenhouse
Home-grown fruits and vegetables are often better than those you buy, but sometimes you can lose sight of your greenhouse. In this project we will make an intelligent greenhouse. This greenhouse will automatically open and close his windows and door when it's too hot or too cold. When the plants are to dry, the smart greenhouse will automatically water your plants (in this project we will visualise the watering based on a led). The time your plants are being watered and when the door and windows are opened or closed is shown on a homemade website.
Step 1: Tools and Components
Tools:
- A rivet pliers
- A multifunctional saw
- A drill diameter 1 mm
- A step drill 8mm
- tape measure
- A file
- Sandpaper
- snap-off knife
- A soldering iron
Components (see PDF):
- Servo motors
- Push buttons
- Raspberry Pi 3 Model B
- Temperature sensor
- Moisture sensor
- Breadboard
- Transistor
- Universal Power supply
- Resistors
- MCP3008
- Pi T-Cobbler (Optional)
- Led
- Wires
- Ethernet cable
- 5,2V adapter
- 8GB micro SD card
- Hinges
- Alluminium blind rivets
- Bright polystyrene plate
- Angle section
- Soldering Tin
- Double-sided tape
- Pins
- Electrical heat shrink sleeve
- Cable ties
- Box
Maximum cost: € 167,82
Step 2: Setting Up the RPi
We will start installing the operating system on our Raspberry Pi.
- Download the image "Raspbian Jessie with pixel" from the Raspberry Pi website.
You will see that this is a ZIP-file. - Extract this ZIP-file to a desired location.
- Download the tool Win32 Disk Imager, this can be downloaded on Sourceforge.
- Click on the folder icon to select the image
- Then select at "Device" your microSD
- Then click on "Write"
After the image is written on your microSD, you can open the microSD in Windows Explorer.
- Open the file "cmdline.txt"
- Add the following line before the word "rootwait": 169.254.10.0
- Then save the file.
- Insert the microSD in the RPi
- Apply a voltage to your RPi with 5,2V DC Adapter
- Connect the network cable to the RPi and plug it into the network port of your computer.
Your Raspberry is ready to use now.
Step 3: Connect to the RPi
To connect to our RPi we will use Putty.
- Download Putty
- Create a SSH connection (see image)
- Sign in
- Username: pi
- Password: raspberry
SETTING WIFI UP
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Go to the bottom of the file and add the following:
network={<br> ssid="name of the wireless netwerok"<br> psk="password of the wireless network" <p>}</p>
To see your IP address type:
ifconfig wlan0
Now you can wirelessly connect to your Raspberry Pi
Hostname in Putty = IP address
Step 4: The Greenhouse
In this step we are about to make the greenhouse itself.
You'll need:
- A multifunctional saw
- A file
- The rest of the materials mentioned in the bill of materials
Steps:
- Saw the polystyreen panel like illustrated on the draft above.
- Saw the angle section like illustrated on the picture above:
- 3 x 50 cm
- 2 x 50 cm (angle 140°)
- 4 x 20,5 cm with one lit shortened by 1,5 cm
- mitre cut these profiles with the 2 x 50 cm (angle 140°)
- 4 x 17,5 cm (mitre cut two by two to make the gable)
- After sawing, polish the burr.
Step 5: The Angle Sections
- Place all parts together on the base of the angle sections.
- Drill holes in your corner profile and polystyrene pannel, as shown on the picture. The diameter is indicated on the packaging of your blind rivets.
- Place the blind rivets in the holes and fix them using a rivet pliers.
!! Please note that the blind rivets are diametrically opposed, so we don't have problems further on. !!
5. Now you slide the front and the back into the greenhouse.
Step 6: Windows & Door
Now we will place the door and the windows.
- Mark the door and the windows like shown on the pictures above.
- Saw the marked parts using a multifunctional saw.
After sawing you'll see that there is burr on the side of the windows and door. - Polish the sides and also the sides of the pieces that you have sawn out until you don't see any burr anymore.
- Pin the windows and the door with hinges as illustrated on the pictures.
The greenhouse is ready now!
Step 7: Wiring
- R2 = 220Ω resistor
- R3 = 1kΩ resistor
- R4 = 10kΩ resistor
- R5 = 1kΩ resistor
- R6 = 10kΩ resistor
- R7 = 1kΩ resistor
- R8 = 10kΩ resistor
- R10 = 470Ω resistor
- R11 = 220Ω resistor
- R12 = 220Ω resistor
Step 8: Adding Servos
Paste the servo motors to the polystyreen panel, using double sided tape.
Make sure that their pivot point is in a straight line with the hinge point of the door and the windows. (see picture)
- To ensure that the door and the windows are pulled open by the servo motor, we will need to drill a small hole (diameter 1 mm). Between the wick of servo and the hole we will place a pin.
- To get our wiring inside, we will drill a hole with a step drill. While you drill, ensure that you push your drill to a certain side. In this way we get a kind of rectangle.
Tuck the spelt so when the servo opens, the door goes with it.
Extend the wires (linking other wires) so you can reach your breadboard at the end of the greenhouse.
Step 9: Push Buttons
In this step we will start to drill 4 holes with a diameter of 1 mm to plug our buttons in (to open and close the door).
- Keep your button where you want to attach him (next to the door) and draw a dot on the place of the legs of your button. ( 2 times, 2 buttons)
- Drill in the dot you've drawn.
Attach the buttons
- Insert the legs of the buttons through the holes. (one inside, one outside)
- Solder a wire to each leg of the button.
- Place heat shrink over the leg and the brazed piece, so that the wires don't make a short circuit.
- Solder on the end of one wire a 220 ohm resistor. Place heat shrink over it.
Drill a hole with the step drill as seen in the previous step, so we can bring the wires of the inner button inside.
Attach the wires of the two buttons together with a clamping strap.
Extend the wires (linking other wires) so you can reach your breadboard at the end of the greenhouse.
Step 10: Soldering Led & Temperature Sensor
Solder the led as you did by the push button.
- Solder a wire to each leg of the led.
- Place heat shrink over the leg and the brazed piece, so that the wires don't make a short circuit.
- Solder on the end of one wire a 220 ohm resistor. Place heat shrink over it
Solder to each thread of the temperature sensor a male-female thread. So it will be easier to connect our temperature sensor to the breadboard.
!! Don't forget to place electrical heat shrink sleeve over the soldered parts. !!
Step 11: Hide Away Wiring
In this step we will make sure that the cables don't run through our plants.
- Insert a clamping strap through the holes that were formed when you have placed your blind rivets right in front of each other.
- Insert all cables in the clamping strap and pull.
And finally:
Past your breadboard and Raspberry Pi in the little box with double sided tape and drill a hole in the backpanel so you can bring your power supply out.
Step 12: Coding
Before we can run the code, we must first install some things on our Raspberry Pi.
- Enable the one-wire interface
- sudo raspi-config
- Interfacing options
- 1-wire : enable
- sudo nano /boot/config.txt
- add the following --> dtoverlay=w1-gpio
- restart the Raspberry Pi with 'sudo reboot'
- Installing MySQL on the Raspberry Pi
- sudo apt-get update && sudo apt-get upgrade
- sudo apt-get install mysql-server
- sudo apt-get install mysql-client
- mysql -uroot -p
- password = root
- Installing MySQL connector
- sudo apt-get install python3-mysql.connector
- Download the Flask project from Github.
- Open the project in Pycharm
Step 13: MySQL Database
MySQL user toevoegen
mysql -uroot -p
CREATE USER 'name'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'name'@'localhost' WITH GRANT OPTION;
CREATE USER 'name'@'%' IDENTIFIED BY 'password';
<span style="background-color: initial;">GRANT ALL PRIVILEGES ON *.* TO 'name'@'%' WITH GRANT OPTION</span>
Password and name are self-chosen.
Create a new database
CREATE DATABASE ENMDatabase;
Exit MySQL connection
quit
Step 14: Create Table in Pycharm
Add as Data Source a MySQL database.
- CTRL + SHIFT + A --> Database
- + Data Source --> MySQL
Use next information:
General
Host: localhost Port: 3306
Database: ENMDatabase
User: ** name you chose in previous step
Password: ** password you chose in previous step
SSH/SSL
Proxy host: ** your IP address Port: 22
Proxy user: pi
Proxy password: raspberry
Inserting tables
- Right click on the ENMDatabase --> Open console
- Execute the sql files (Database.zip) in the 'console'
- Result: see image above
Attachments
Step 15: Upload the Project
In Flask:
- Click on Tools --> Deployment --> Configuration
- Configure as in the picture above
- Click on Tools --> Deployment --> Upload to Default server
Step 16: Automatically Run
This is the very last step before we can use our greenhouse!
Go to your Raspberry Pi in Putty
sudo nano /etc/profile
Add the following line below:
python /home/pi/ProjectFlask/ProjectFlask.py &
Step 17: Using IGreenhouse
In this step we are going to put our greenhouse ready for use.
- Connect the power supplyy from the Rasberry Pi in the socket.
- Wait until the Raspberry Pi is fully booted.
- Connect the universal power supply to the socket.
Always wait to connect the universal power supply until the Raspberry Pi is fully booted up, otherwise the servo motors will not work correctly!
To see your website: search for your IP address followed by :5000
Now your iGreenhouse is ready to use. You can grown your own fruit and vegetables.
So I'd say: enjoy your meal!
10 Comments
Question 5 months ago
I cannot access the website i followed every step can you help me please. By the way I have a question in this code python /home/pi/ProjectFlask/ProjectFlask.py & where should I put it in the /etc/profile should I just add it below or there is a specific place to put this?
Question 3 years ago
Is it possible, once this project is completed, to add soil humidity sensors and an irrigation system? If yes, how? Can you kindly explain it to me or give me some useful links? Thanks a lot and great project !!!
Answer 3 years ago
As far as I can see, it already has a soil moisture sensor, albeit not a very good one
Should you want to add another one, or an irrigation pump, given that the MCP3008 still has a few free channels (and the Rpi no doubt a few free pins as well), that should not be a problem. It seems the code is in python so, adding it to the code should not be too difficult either.
3 years ago
Where i can download full image of circuit?
4 years ago
can plz anyone describe the circuit
6 years ago
great project! I started to work on it. I have one issue with the 140 degree angles. I cant buy them, how you did this part?
Best greets,
Thomas
6 years ago
maybe you can integrate feeding and soil ph too ?
6 years ago
I've always wanted to build something like this, but I got stuck at
the <pretty much everything> step. Thanks for the instructions...
definitely something to try next growing season!
6 years ago
Nice and cleaver project! Well done!
6 years ago
That's an awesome setup. :) We'd love to automate ours if I can get the time.