Automated Reptile Control System(webserver, Data Logging, RTC and much more)

UPDATE: NOW SUPPORTS EITHER ARDUINO WIFI 101 SHIELD OR ARDUINO ETHERNET SHILED REFER TO THIS POST FOR DETAILS SHARED BETWEEN THE TWO PROJECTS REFER TO POST #3 FOR DETAILS ON JUST THE WIFI VERSION

i have been working on a home project to automate the control of my ball python cage. the cage has three under-the-tank heaters, humidifier, heat lamp, and UV light.

the arduino system is composed of the following: Arduino Mega 2560 Arduino Ethernet Shield RTC Module 5x onewire temperature sensors 2x humidity sensors 6 relays SD card in the Ethernet shield 7.5 volt power for the arduino 5 volt power for the relay coils 2x humidifier humidifier air pump 3x under-the-tank heaters heat lamp

with airtight / water tight Hoffman enclosure (ebay, no link available)

the system is controlled and monitored through a web server running on the arduino. the system has 9 different pages: 1.) System Overview -- allows the user to see the current temperatures from the 5 onewire sensors, the average cage ambient temperature (average of sensors 4 and 5), to see if the sensors are currently functioning, the status of the relays (on/off) and the average humidity within the cage The images used to signify if the relays are on/off as well as the images used to signify if the temperature sensors are good/bad are stored on the SD card and read off the SD card.

|500x133

2.)Temperature Adjust - allows the user to configure the system to use either degrees F or degrees C as the temp scale. It also allows the user to control the on/off temperature settings for the three under-the-tank heaters connected to relays 1 through 3, and the heat lamp connected to relay 4. the settings can be configured for both day-time and night-time to simulate lower temperatures at night if the user desires all data entry areas have logic to determine if the entered values are acceptable. if they are not, the web-page details the issue the user all user settings are saved to EEPROM

|500x127 |500x133

3.)Humidity Adjust - allows the user to configure the system's humidifier on/off settings for both day time and night time all data entry areas have logic to determine if the entered values are acceptable. if they are not, the web-page details the issue the user all user settings are saved to EEPROM

|500x112

4.)Date/Time Adjust - allows the user to set the system's day, month, year, day of the week, and time zone. the system also allows for the hour, minute, and seconds to be updated over the internet through a NTP server. the code is written so a specific IP is not required for the NTP server. instead it uses DNS to resolve the IP of time.nist.gov as it is resolved to all of the server addresses in a round-robin sequence to equalize the load across all of the servers. the system automatically always connects to the internet every 24 hours to update its time again to correct for any drift associated with the RTC The page also allows the user to configure when the UV light turns off and on signifying when the system considers it either "day time" or "night time" all user settings are saved to EEPROM

|500x157

5.)Data Logging Adjust - allows the user to enable or disable data logging, allowing the system to log one sample every 10, 20, 30, 40, 50, or 60 seconds. This page also explains all the details of the SD card inserted into the Ethernet shield if no SD card is present, it will tell you and prevent the user from data logging. if the SD card is present, but not formatted, it will tell the user and prevent data logging if the SD card is present, formatted, but cannot be accessed for one reason or another it will tell the user and prevent data logging it tells the user the size of the SD card in kilobytes and megabytes it tells the user the amount of space used on the SD card in both kilobytes and megabytes, verified to read the same value as windows explorer it has a progress bar that shows the percentage of SD card space used data logging enable/disable settings are not saved to EEPROM. data logging must be enabled manually every time the system powers up. allows for the log files to be individually deleted off the SD card if desired (image does not show this part of the form as i have not updated the image i am using in this post ;) ). at 1 sample per 10 seconds, 24 hours of recording equates to approximately 3250 plus or minus 20 kB.

|500x150

6.)View Recorded Data - lists all the log files on the SD card so the data can be viewed and downloaded by the user. the system creates a different log file every day of logging is enabled. the files are named for the month, day and year so the user can easily look back at what happened with the system at a specific time with ease.

|500x118

|500x59

7.)I/O Setup- allows the user to decide how the 6 relays are controlled - either automatic, or manual. each relay can be configured independently. when the relay is set for manual control, then the user can press a button to turn it on or off when the system powers up, all relays are configured to be controlled by the system by default. any time the system restarts, resets, or is power cycled, the relays would have to be set back to manual control if manual control is desired.

|500x144 |500x141 |500x138

8.)Network Setup - allows the user to configure the system for static settings or DHCP. even if using DHCP, the system shows the user the IP address, subnet mask, default gateway, and DNS server. if the system is using static settings, all user settings are saved to EEPROM

|500x116

9.)System Information - gives a system up-time counter in years, months, days, hours, seconds. also displays the MAC address of the system. Displays if there were any instances in which the temperature sensors malfunctioned. any time any sensor malfunction is detected, the counter will increase. The system will also send an e-mail indicating to the user that a sensor is not working and needs to be checked. finally, displays the available system RAM

latest code revision: https://www.dropbox.com/s/uxf89wcth826cj0/2.0%206-6-2016%20experimental.zip?dl=0

NOTE: POST WAS UPDATED WITH THE LATEST INFORMATION AVAILABLE. PREVIOUS INFORMATION WAS REPLACED AS REQUIRED.

Very nice. You must really like that snake! Or, maybe you hate having to adjust the environment every 15 minutes.

Looks very well done (+1),

(nitpicking - Automated Reptile Environment Control System - makes a better acronym arecs that's an anagram of scare ;)

WIFI VERSION:

i am waiting for my wifi 101 shield to arrive. since the wifi shield does not have an SD card slot like the ethernet shield did, and i wanted to clean up the physical look of my work, i have used a mega protoshield to hold an SD card board, the RTC, a and all of the headers for my temperature probes.

you can see what i designed here:

and you can see the result here:

you can also see what it looks like when paired with my existing ethernet shield.

i made sure to use pin 5 for my new protoboard SD chip select pin so it did not interfere with the SD shield.

please note! what i have shown above is electrically not compatible with the ethernet based project unless you edit the pin assignments used by the temperature probes to the following:

#define CSG1wirepin 38
#define MSG1wirepin 44
#define HSG1wirepin 42
#define AA11wirepin 46
#define AA21wirepin 48

and change the SD card initialization to the following if you do not want to use the SD card in the ethernet shield:

if (!card.init(0, 5)){

ORIGIONAL RESPONSE BELOW, THIS POST HAS BEEN EDITED TO ADD MORE DETAIL ON NEW WIFI VERSION OF THE SYSTEM

draythomp: Very nice. You must really like that snake! Or, maybe you hate having to adjust the environment every 15 minutes.

i like making things such as this, but need a reason.... cough.... excuse ;)

Hello, really nice project! Can you explain how can you positioning the values into the tables of your html pages? Do you need to refresh the page everytime you want see if there was a change in the reads, or the page is always "connected" to arduino?

THANKS!!

blastboot: Hello, really nice project! Can you explain how can you positioning the values into the tables of your html pages? Do you need to refresh the page everytime you want see if there was a change in the reads, or the page is always "connected" to arduino?

THANKS!!

currently the code is written so you need to refresh the page any time you want to see what the current readings are. it would be very easy to add the HTML "refresh" tag to the code to get it to auto refresh.

i have finished my enclosure and posted some images below:

i attached my code and the different libraries i used

some things are not done, and i know if a few bugs that need to be fixed, but i would say 98% of everything is working fine.

note: written in IDE version 1.0

Arduino.zip (105 KB)

Decent piece of work! be proud!

Hi everyone "wallaceb" you have done a very good job here.

Question: It possible this code to work on UNO ?

Thanks

gvaf: Hi everyone "wallaceb" you have done a very good job here.

Question: It possible this code to work on UNO ?

Thanks

unfortunately no. the entire sketch currently uses 106,000 bytes of FLASH, too much for the UNO. However with that said, most of the 106,000 bytes is the PROGMEM storage of the HTML pages. If the sketch was somehow changed to pull the HTML off the SD card instead, it might fit, but i have not checked.

Is it me or is there an issue with the Arduino.zip file? When I try to open it, it seems it is invalid... I could benefit from this code. I'm looking for tabulating code to be able to show status of things and then yet to be able to set values via the web.

tb

i have actually completed my code. i added more functionality and fixed bugs.

in the data logging adjust page, i added the ability to delete selected data files and fixed a bug in my used space calculation. now the webpage displays the exact same value as windows explorer does. :grin:

i also added another page for system information that includes system up-time, MAC address, number of sensor malfunctions if any, and the amount of free system RAM.

there were about 10 bugs that i found over the course of testing which appear to be fixed. there is still a bug in that the watch dog timer will reset the unit ever 1-2 days if i have data logging enabled, but not if it is off. i am looking into that.

with this said, tonight when i get off work, i will post all the code directly on this page.

Very Nice Work indeed do you have a set up diagram as well :)

ericklil:
Very Nice Work indeed do you have a set up diagram as well :slight_smile:

are you referring to a system schematic?

i cannot paste my code into the page because of a 9500 character limit. i am going to try uploading it to a file service

edit:

hopefully the supplied link will work.

Zip worked fine, very nice.

System schematic would be grand, looks well thought out in the pictures.

Wallaceb, That is a very nice project. One of the absolute best I have ever seen! True genius. Peter

106K flash is really large :P, use microSD instead!

it looks great!!!

however after uploading the code I can not get into it- DHCP on my router does not seem to see it.

What would be the way to set the static ip in the code ?

thanks!

ODwyerPW: Wallaceb, That is a very nice project. One of the absolute best I have ever seen! True genius. Peter

thanks very much for the complement 8)

mkcinek: it looks great!!!

however after uploading the code I can not get into it- DHCP on my router does not seem to see it.

What would be the way to set the static ip in the code ?

thanks!

:fearful: oops.. i forgot to post the code i used to "program" the EEPROM for all the "default" settings. when i get home later tonight i will post that code :grin:

iouzzr: 106K flash is really large :P, use microSD instead!

with 256 k of available memory i was not going to worry about it. i originally thought to use the SD card, but decided that PROGMEM coding would be easier to code and control and faster with respect to I/O since the processor would not have to read a byte from SD card, store it locally, then send it to the Ethernet shield.

robtillaart: Looks very well done (+1),

(nitpicking - Automated Reptile Environment Control System - makes a better acronym arecs that's an anagram of scare ;)

thanks for pointing that out. i made the upadtes to the code. have not gotten to changing the pictures in the post though

edit: added a link to the initialization sketch.

download this to the arduino, it will configure all the EEPROM. download the normal code to the arduino and the web-page default URL is static at 192.168.1.200 you can then configure all the settings to your likings.

https://www.dropbox.com/s/we0tnxp3h0w90al/webserverinit.rar

edit:

i am adding more stuff to my code from here: http://arduino.cc/forum/index.php?topic=134868.0

to make the downloading of log files MUCH faster. i will post the new code soon

for anyone who is trying to use my code, there was a fairly large bug that was cause by my attempt to reduce the amount of RAM usage. this bug would make any page forms submitted to not process properly.

i have subsequently corrected the bug. the latest version of ALL code is in the link below, the libraries i use, the EEPROM initialize code, and the latest working code that i have.

https://www.dropbox.com/s/3e75754ivc1m0by/Arduino_2-24-2013.zip