Hi everyone, this is my first attempt to actually create something useful using an Arduino board. My first thought was an automatic terrarium control for my ball python so wish me luck...hopefully it won't burn down :)

WARNING: We are going to work with high voltage so be careful! Everything is on your own risk.


• Temperature measurement
• Humidity measurement
• Room temperature measurement
• Room humidity measurement
• Temperature control
• Light control (timer)
• Fan/Humidity control (in the future)
• Displaying all the values on LCD

I have some basic programming /engineering skills so I'm probably going to find out few things during the process I should do differently, but for now...

List of parts:

• Arduino NANO $2,30
• 4-Channel Relay $3
• DHT22/AM2302 Sensor $3,10
• DS3231 RTC Modul $1,00
• 1.8" TFT LCD Display $3,80
• 5V power adapter $1,00 (any mobile charger should do)
• 3x Power Socket ABB 5525N-C02347 $7,00
• Light DPDT On-Off Snap in Switch $1,50
• 2x Male + female 3,5mm jack connectors (for DHT22 sensors) ~$4
• Wires
• Box (when all parts arrive I will decide if the box/case will be 3D printed or bought somewhere). At the moment I have two designs in mind, we'll see which one is going to be used.

Step 1: Connecting the Components

This connection is simplified, the actual connection will probably use small breadboard and separate power to single components.

DS3231 RTC -> Arduino

VCC -> 5V
SDA -> A4
SCL -> A5
SQW -> (not used)
32K -> (not used)

LCD -> Arduino

LED -> 3V3
CSK -> D13
SDA -> D11
AO -> D9
CS -> D10
VCC -> 5V

DHT22 -> Arduino (terrarium)

VCC -> 5V
Data -> D2
NC -> (not used)

DHT22 -> Arduino (room)

VCC -> 5V
Data -> D3
NC -> (not used)

Relay board -> Arduino

IN1 -> D4
IN2 -> D5
IN3 -> D6
IN4 -> D7
VCC -> 5V

Arduino -> Power

VIN -> +5V
GND -> -5V

Step 2: Let's Start the Program...

At first I want to make sure that the temperature and humidity values coming from DHT22 sensors are correct and the code is able to control relays. So let's connect sensors and relay board to Arduino and upload the code.

I'm still waiting for some components to arrive. Once I have them, the instructable will continue...

Step 3:


I was really looking forward to create this device and I got almost everything working but then I got my hands on NodeMcu Lua 12e which was more suitable for this project (using a webserver). It was much easier than using ardunio; all I needed was the board and relay, no need for display or RTC module. I will post link to this instructable once it is done.

Update II:

Here is the promised link. Creating the TerraControl was really fun job! I have got many more ideas how to improve it so as I see it, it will be continuous Instructable. Enjoy and please share it with other!


<p>I assembled the LCD screen, Arduino, and one DHT22 to test and screen comes on shows graphics that's its suppose to for a second then goes all white. If I reset I get the same thing. Any suggesting on what might be going on? If I apply a different code to test the LCD, it works fine so I know the LCD screen is good. Any help would be greatly appreciated. </p>
<p>Are you using my code or modified? If modified, can you sent it? I discontinued this project because of NodeMcu but I can try and take a look.</p>
<p>Hello thanks for the reply, it was me I mistakenly set a pin as the same pin that one of the relay was using. Up and working with temp sensor. Now I just need to assemble the rest of the parts and test again. Thanks so much for sharing. </p>
<p>Hi, I'm glad to hear the problem is solved! Good luck and when you finish the project, please share! :)</p>
<p>Hi, your project is very interesting.</p><p>But I d'ont understand your code, how do you do for pinting in the LCD?</p><p>Thanks</p>
<p>Hi, the first version was only draft without LCD printing. I have added <br>version 1.1 where the LCD printing works. But it is still in progress so <br>the code is quite messy...sorry about that. Also, I'm not sure if I use <br>the same pins as in version 1, so mind the definitions. I'm now working <br>on 3d print and circuit board (sort of...), I expect big update in 1-2 <br>weeks.</p>
<p>thanks for your reply,</p><p>I updated your code with light et water control but i search the code for TFT LCD.</p><p>I found a code for a LCD but it isn't fun, i prefere a TFT.</p><p>If you have just a code for TFT, I take!</p><p>many thanks</p>
<p>Unfortunately I don't have any TFT to try this with and LCD is more fun for me :) If you study some basic examples for LCD you will get the idea pretty quickly...good luck!</p>
<p>I had a quick look at your code. You should add some hysteresis. Else you might encounter fast switching on/off for fan/heat etc.</p><p>As a side note: if else cascades must not be indented but with the same indentation. They are a different form of a case statement.</p>
<p>If you are using a Mac try CMD-T to get good indentation. On a PC it's probably Ctrl-T (just at a guess).</p>
<p>Thanks for the advice! Code is just a quick draft but I would not think of hysteresis at all... Can I contact you if I ran into some problems with the code?</p>
<p>Sure you can :-)</p>
<p>Please keep me posted on the code! This looks like what I'm planning to do with my aquarium: controlling the lights (by RTC) and measuring &amp; controlling the temperature.</p>
<p>Did it burn down? :)</p>
<p>I'm still on theoretical level so not yet :)</p>

About This Instructable




More by tomaskuchler:TerraControl - With NodeMCU Webserver Self-learning IR remote controlled switch Paper windmills 
Add instructable to: