Introduction: Smart Terrarium

Picture of Smart Terrarium

The story has begun with two greek tortoises. They were christmas gifts to my son. Cute reptiles, they just need some special circumstances like controlled temperature, humidity and UVB light for their healthy shell growth. I have red a few books about the tortoise habitats and tried to look for a "smart" terrarium controller for them, but I couldn't find any.

OK. Then build one!

Step 1: Project Summary

The base is a Wemos D1 ESP8266 arduino compatible board. Why not Arduino? Because ESP8266 has wifi capabilities and I needed internet connection for OTA (Over The Air) updates and NTP (Network Time Protocol) updates for the built in RTC (Real Time Clock) module. The tortoises need controlled temperature between 33°C and 38°C, and controlled humidity around 50-60%. That's why the terrarium has four temperature sensors (three DHT22 temperature/humidity sensors and the DS3231 RTC module's own integrated temperature sensor).

These sensors are in the cave, on the runway and in the furnace (where the heaters are) and the last one is integrated in RTC module in the control-room which is measuring the temperature near to the electronics. In the furnace there are three lightbulbs, two pieces (a 25W and a 50W bulbs) for the heating, and a special UVB one. The terrarium has a thermostat part, it can control these bulbs through the 4 channel relay module (I use only three relays, but there was no 3 channel module:))

The heating works based on the cave sensor data, the thermostat is checking every 10 minutes and compares the sensor data to the predefined optimal temperature and turns the bulbs on or off as the temperature requires. It's not working night and day of course, the controller counts the sunrise and sunset time every day (based on the date and geographic coordinates) and the heating is working only on daytime. The UVB control is using sunrise/sunset also and it's working 9 hours a day.

On the front face of the cave there is a built in 2*16 character LCD display which shows the most important parameters, and informations about the terrarium, for instance:

  • Terrarium start parameters
    • Connect to wifi (SSID)
    • IP address
  • Date/time
  • Timezone
  • Sunrise/sunset time
  • Cave temperature/humidity
  • Runway temperature/humidity
  • Furnace temperature/humidity
  • Control-room temperature/humidity
  • Sending data to the cloud
  • Information if the heating output changes
  • UVB turn on/off
  • Plant soil moisture status

In the night the LCD backlight is turned off, and just a 5mm blue LED shows the working status of the terrarium.

Step 2: ​Internet of Things Tortoises

Picture of ​Internet of Things Tortoises

Web, cloud, mobile

The terrarium is connected to Twitter (https://twitter.com/smartterrarium), tweets important changes and errors, and connected to Thingspeak (https://thingspeak.com/channels/126060) where you check the current temperature and humidity parameters of the system (the cave, the runway, the furnace and the control room) and there is a chart about the heating power output. Last but not least the Smart Terrarium has a web server, from the local network you can check the main parameters with an internet browser.

I have installed the IoT ThingSpeak Monitor Widget app (https://play.google.com/store/apps/details?id=ua.livi.thingspeakmonitor) to my mobile, and I can check my smart terrarium parameters anytime and everywhere.

Step 3: List Materials and Tools

Picture of List Materials and Tools

The terrarium (glass):

  • Plate glass with the edges sanded
  • 100% silicone transparent sealant (or aquarium glue)
  • Masking strip or duct tape
  • Caulking gun
  • and a few large box or some heavy books for holding up the glass

The cave:

  • XPS foam
  • Utility knife
  • Mini heat hot air gun
  • Kitchen torch
  • Foam knife
  • Caulking gun (again :))
  • Silicone sealant (white or whatever)
  • Aluminum grid
  • Gelato boxes

The electronics:

  • Wemos D1 ESP8266 board
  • 2*16 LCD display
  • Blue LED
  • 270 ohm resistor
  • I2C interface
  • DHT22 temperature and humidity sensor
  • DS3231 RTC module
  • Standard proto screw shield board for arduino compatible double-side PCB
  • Soldering iron

Step 4: Create the Glass Terrarium and the Base of Cave

Picture of Create the Glass Terrarium and the Base of Cave

The glass part

Unfortunately I haven’t got images about the glass terrarium building process, but there are good articles and videos about it on the youtube. I just bought the sanded edge glass sheets and put together with special aquarium glue.

The XPS cave

The cave was more interesting part of the terrarium. I have measured the place in the terrarium and I had cut the proper size parts for the cave from the XPS foam board. I have formed the base of the cave in this step. You don't need to be so precise (aside from the external dimensions!), because you actually create an irregular shape piece of rock.

Step 5: Formatting the Cave

Picture of Formatting the Cave

Create rock!

The surface of the cave must be irregular. You can form it with a kitchen torch, a utility knife and a hot air gun. Be creative! You can create a realistic rock form easily. I have glued some cut off part to the cave wall to formatting hollows and emersions. Top of the cave I have built in two gelatos box. One for the electronics and a second one for the plant.

After I have finished the formatting of the rock, I mixed outdoor tile adhesive and painted the full surface of the cave - except the glass-fitting parts. After it dried it looked like a real rock.

Step 6: Build the Electronics

Picture of Build the Electronics

Low current system

After I received every ordered parts I started to build the controller. I used an Arduino Standard Proto Screw Shield Board, as a shield connector, the sensors connected with CAT5 ethernet cable and soldered it into the proto board. In this way I can disconnect the ESP8266 board easily if I had any problem and I would need to change the controller board.

  • (Pin 01)----> RELAY1_UVB
  • (Pin 02)----> RELAY3_25W
  • (Pin 03)----> LED
  • (Pin 04)----> SDA
  • (Pin 05)----> SCL
  • (Pin 12)----> DHT22 Runway
  • (Pin 13)----> DHT22 Cave
  • (Pin 14)----> DHT22 Furnace
  • (Pin 16)----> RELAY2_50W

One pin, two pin

I2C is a serial protocol for two-wire (SDA/SCL) interface to connect devices like ESP8266. That’s why I used that for the LCD and the RTC module (each I2C slave device has a 7-bit address that needs to be unique on the bus) and in this way i could connect more I2C compatible devices to I2C port of the microcontroller.

Step 7: Hiding the Cables, Finishing the Terrarium

Picture of Hiding the Cables, Finishing the Terrarium

High current system

Separating the high and the low current circuits is important. I used a 2 way boat rocker switch, first switch is to high current (heater bulbs, UVB bulb) the second one is to low current (ESP8266, relays, sensors, etc.). I wanted to hide all of the cables inside the rock, it was simple electrician task, I have used foam and utility knife to formatting the XPS board and to create channels for the conduits. All of conduits are soldered, I didn’t want to use releasable connections inside the cave because when I finish the project I want to bond the parts together permanently.

Be careful with the electrical isolation, mains voltage electricity is dangerous! There is a significant risk of death through electrocution if mains voltage electricity is allowed to pass through your body!


Step 8: The Software

Picture of The Software

Arduino IDE


Install the ESP8266 Package

Go to Tools > Board > Board manager and add ESP8266 package. Then, restart your IDE.

Select the Board

Go to Tools > Board and select Adafruit HUZZAH ESP8266. CPU Speed Select 80 MHz as the CPU frequency by going to Tools > CPU Frequency. Upload Speed For Upload Speed, select 115200 baud. Selecting the Port Select the matching COM port for your FTDI or USB-Serial cable.

Go to GitHub to download the code:

https://github.com/vakaati/smartterrarium

Fill in the SSID and the password for your WIFI, but do not upload it to the board yet.

You can download and Install Arduino IDE from here:

https://www.arduino.cc/en/Main/Software

Connect ESP8266 board to serial USB connector of your PC. Open Arduino IDE Change Tools-> Board -> “WeMos D1 R2 & mini” If you don’t see this board in the list, Install the ESP8266 Package:

https://elementztechblog.wordpress.com/2016/10/14...

Go to GitHub to download the code: https://github.com/vakaati/smartterrarium

Change in the SSID and the password for your WIFI (Line 18 & 19)!

Set password for OTA upload in line 353 (default: PASSWORD)

First time You need to upload the sketch via USB, but this code supports OTA and you can upload the changes through your wifi connection.

Please vote me in the contest - top right - Thanks! :)

Comments

Stephen LEE (author)2017-01-17

Wow! That's good!

mkendall3 (author)2016-12-18

that is very creative and useful

vakaati (author)mkendall32016-12-22

Thank You, then vote me in the contest, please :)

mchambers5 (author)2016-12-17

What was the overall cost of this project?

vakaati (author)mchambers52016-12-17

less than 100$

AsemM3 (author)2016-12-17

are those Egyptian tortoises?

vakaati (author)AsemM32016-12-17

No, they are greeks.

jdahirkanehl (author)2016-12-08

What soil moisture sensor are you using for the plants? I find that the cheap two prong sensors (like SEN-13322) corrode quickly unless you remove them from the soil. I'm making my orchidarium smarter using the raspberry pi, sensors, and a mechanical switch https://www.youtube.com/watch?v=lvL9P1qYzSo&t=3s

vakaati (author)jdahirkanehl2016-12-09

I'm using this: https://www.aliexpress.com/item/Free-shipping-5se...

That was the last part of the terrarium, what i've built in. I will inform you about my experiences. The orchidarium project is great!

Build_it_Bob (author)2016-12-08

Amazing project; great results!

Bob D

zposner (author)2016-12-08

I wonder how you could do something similar with a fish tank

Swansong (author)2016-12-07

Awesome project and great instructable :) I'm sure the tortises are happy you built such a wonderful environment for them!

vakaati (author)Swansong2016-12-07

Thanks. They are the happiest tortoises all over the world! :D

jessicaholm (author)vakaati2016-12-08

Do they walk around with little smiles on their faces? Ha ha! Great terrarium!

vakaati (author)jessicaholm2016-12-08

Exactly :) And they are singing the "If You're Happy" all day long :)

ultrabob (author)2016-12-08

Very cool! What is the blue bin at the top? A planter?

vakaati (author)ultrabob2016-12-08

Yes, I planted some oregano into that, and the controller check the soil moisture with a sensor.

Yonatan24 (author)2016-12-08

Testudo Hermanni's! So cute! Love them!

ChrisS487 (author)2016-12-08

WOW! Amazing! Well Done and great instructions.

AdamB259 (author)2016-12-07

Nice!

MoórF (author)2016-12-07

Awesome!