Smart Terrarium With Raspberry Pi
by MilanDM in Circuits > Raspberry Pi
1848 Views, 1 Favorites, 0 Comments
Smart Terrarium With Raspberry Pi
The Smart Terrarium is a self-sustainable terrarium that fits the needs of your reptiles. It measures the temperature, the humidity level of the soil and the water level of the reservoir. Besides that, it has a heatlamp and a water pump that can be turned on and off with the simple push of a button. The whole process can be automated by updating the times of usage on the site.
This terrarium will make sure your reptiles stay healthy without you needing to do much.
I wanted to make this project because I have two tortoises at home. While they were younger they needed to stay inside a terrarium and sometimes you could easily forget to spray water on them.
Supplies
Electronics (~ € 93.23)
- Raspberry Pi 4
- DS18B20 waterproof temperature sensor
- HC-SR04 ultrasonic sensor
- Soil moisture sensor
- 2 channel dc 5v relay module
- water pump
- breadboard power supply
- 16x2LCD character display
- adapter for power supply
Other supplies (~ € 40)
- 12 mm MDF wood
- Water reservoir
- Magnets
- Heat shrink
- Tie raps
- Cable binder cubes
- Female to male pin headers
- Primer (of choise)
- Paint (of choise)
- Multi plug 6 way
- Tesa tape
- Monsoon nozzles
- Copper wire
The Main Components
In the following lines, I'll tell you more about the components and their functions:
- Raspberry Pi 4: it's the brain of the operation. We use it to run a webserver on and make to use of the other components.
- DS18B20 waterproof temperature sensor: it's used to measure the temperature inside the terrarium. I chose a waterproof one because I also work with water and condensation.
- HC-SR04 ultrasonic sensor: it's used to measure the amount of water left in the reservoir. It uses sound to detect the distance.
- Soil moisture sensor: it's used to measure the humidity level of the substraight. The sensor measures the changes in soil property to get a level of humidity.
- 2 channel dc 5v relay module: it's used to enable and disable the water pump and the heatlamp. The relay uses a signal to open or close the circuit.
- Water pump: it's used to pump water from the reservoir to the nozzle.
- Breadboard power supply: it's used to power most of the components.
- 16x2LCD character display: it's used to show the IP address of the site and some text on it.
Assemblance of Electronics
Breadboard
When your components arrive at your door. It's nice to always test them before you actually put them inside your project. This is where the breadboard could be useful.
Soldering
I have solderd the temperature sensor, the ultrasonic sensor, the soil moisture sensor, the water pump and some extra cables for the relay. In this way I could make the cable much longer which came in useful when I put everything in the caseing. Of course, if you want to make everything without the breadboard and just soldered together, feel free to do so.
In the electronic schematic you can find how to connect everything with or without the use of breadboards. If you wish to use the breadboard like I did, it's useful to check the breadboard.
Cutting the MDF in the Right Size
You need to cut your MDF plate in to different pieces or you can have them cut to size in the store:
- One piece of 55,5 x 46 cm
- Two pieces of 40x 25.7 cm
- One piece of 54 x 40 cm
- One piece of 51 35.5 cm
- Two pieces of 35.5 x 3.6 cm
- One piece of 53.9 x 4.7 cm
- One piece of 54.1 x 29.1 cm
- One piece of 9.7 x 4 cm
- One piece of 11 x 4.2 cm
- One piece of 26.3 x 5.5 cm
Assemblance of Caseing
It's time to assemble the pieces together. First of all, you screw the two pieces of 40x 25.7 cm together with the two pieces of 35.5 x 3.6 cm with a spacing of 1.8 cm wide space on the right edge. When those are put together screw the piece of 51 35.5 cm in an H-form against the 2 smaller pieces we just screwed. After they are stuck together, you screw the H-form onto the large baseplate with a 1cm space on the left and right edge and a 1,2cm space on the back edge. Now your caseing is almost done, the only thing that rest us left to do, is to screw the magnets onto the remaining pieces. On the 2 standing pieces of the H-form we attach 3 magnets to each one. Then we screw the little magnet plates onto the 3 remaining pieces like shown in the pictures above.
Adding the Primer on the MDF Pieces
I added a primer on the MDF pieces because this way, the paint will stick better and will give a nice white base color to paint over. I used the mathys fassiprim primer white as my primer but any other primer will do.
Painting the Primed Pieces
When the primer is all dried up, you first need to sand the surface of every piece of wood. When that's done, you can start to paint the pieces in any color you like. I used paint from Mathys and the color I used is a medium light shade of yellow-green with hex color code #d6db86. But like I said, feel free to try any other color of preference. It's most likely you'll need to add two layers of paint because one layer won't be enough and you will still be able to see the white primer.
Fitting Everything Inside
When the paint is all dried up, we can fit everything inside the caseing. First of all, we put the terrarium inside the big open space. When it's in place, we put the piece of wood that is supposed to be there back with the help of the magnets. But first, we cut a hole inside the piece for our LCD screen. When the terrarium is in place, we can put everything else inside of the caseing and terrarium like you can see on the photos. I decided to arrange everything my own way, as you can see with the help of the tie wraps and cable binder cubes. If you want to rearrange everything in a different way, feel free to adjust some changes.
Finishing the Build
Finally, when all the components are fit inside the case, you can put the aquarium background over the soil moisture sensor so you don't really see the cables anymore. After that, put all the panels back onto the magnets and your case is done!
Software
Software Development
For software development, I used Visual Studio Code. The whole project is written in four different languages: Python, Javascript, HTML and CSS.
All the processes that happen in the background, such as the code for the electronics, are handled with Python, Flask and Socketio.
When we speak about the frontend, it's writen in HTML, CSS, Javascript and Apexcharts:
- HTML is used for the raw website
- CSS is used to make our raw website fully customizable
- Javascript is used to showcase the data we get out of the database
- Apexcharts is used to create graphs wich are used to show real time data
You can find all the software and the full install manual on GitHub.
Database
You heard me talking a lot about the database in STEP 9 but now, I'll explain a little bit more about the database itself.
Animal (Dier)
This table is used to store data about the animal, such as the English name, scientific name, the start and end time of the heatlamp and the time interval between the water sprays.
Action (Actie)
This table is used to define the different types of actions.
Device (Device)
This table is used to store the information about your different devices.
History (History)
In this table, all the incoming values are getting stored. This is very useful because this table makes use of the foreign keys of the other tables. This will make it easier to store data gathered from a specific device.
Finished Product
These were the steps to make your very own Smart Terrarium.
I hope you enjoyed and that everything is clear!