Pages: [1] 2 3 ... 7   Go Down
Author Topic: Automated Reptile Control System(webserver, Data Logging, RTC and much more)  (Read 36937 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 5
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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         http://www.amazon.com/gp/product/B006H0DWZW/ref=oh_details_o09_s01_i00?ie=UTF8&psc=1
Arduino Ethernet Shield         http://www.amazon.com/gp/product/B006UT97FE/ref=oh_details_o09_s03_i00?ie=UTF8&psc=1
RTC Module            http://www.amazon.com/gp/product/B004G2IPOG/ref=oh_details_o08_s00_i00?ie=UTF8&psc=1
5x onewire temperature sensors      http://www.amazon.com/gp/product/B008RIOGP2/ref=oh_details_o04_s00_i00?ie=UTF8&psc=1
2x humidity sensors         http://sensing.honeywell.com/product%20page?pr_id=53944
6 relays            http://www.amazon.com/gp/product/B0057OC5WK/ref=oh_details_o09_s00_i00?ie=UTF8&psc=1
SD card in the Ethernet shield      http://www.amazon.com/gp/product/B001CQT0X4/ref=oh_details_o07_s00_i00?ie=UTF8&psc=1
7.5 volt power for the arduino      http://www.amazon.com/gp/product/B000Z31G3M/ref=oh_details_o04_s00_i00?ie=UTF8&psc=1
5 volt power for the relay coils   http://www.amazon.com/gp/product/B001PUSERA/ref=oh_details_o09_s01_i01?ie=UTF8&psc=1
2x humidifier            http://www.amazon.com/gp/product/B000634980/ref=oh_details_o04_s00_i00?ie=UTF8&psc=1
humidifier air pump         http://www.amazon.com/Tetra-77850-Whisper-Pump-100-Gallon/dp/B004PB8SRM/ref=sr_1_10?ie=UTF8&qid=1370537956&sr=8-10&keywords=aquarium+air+pump
3x under-the-tank heaters      http://www.amazon.com/gp/product/B0010OP4CY/ref=oh_details_o04_s00_i00?ie=UTF8&psc=1
heat lamp            http://www.amazon.com/gp/product/B000TZ1XH0/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1

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.



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




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



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




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 smiley-wink ). at 1 sample per 10 seconds, 24 hours of recording equates to approximately 3250 plus or minus 20 kB.



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.





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.





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



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/0twzm2aztgg8o22/webserver-1.3%2012-22-2013%20-%20Copy.zip


NOTE: POST WAS UPDATED WITH THE LATEST INFORMATION AVAILABLE. PREVIOUS INFORMATION WAS REPLACED AS REQUIRED.
« Last Edit: December 22, 2013, 09:31:02 pm by wallaceb » Logged

New River, Arizona
Offline Offline
God Member
*****
Karma: 19
Posts: 936
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Trying to keep my house under control http://www.desert-home.com/

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 223
Posts: 13896
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks very well done (+1),

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

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Full Member
***
Karma: 5
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-wink
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!
Logged

Offline Offline
Full Member
***
Karma: 5
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:









Logged

Offline Offline
Full Member
***
Karma: 5
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.17 KB - downloaded 239 times.)
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 223
Posts: 13896
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Decent piece of work!  be proud!
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Question: It possible this code to work on UNO ?

Thanks
Logged

Offline Offline
Full Member
***
Karma: 5
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 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
Logged

Offline Offline
Full Member
***
Karma: 5
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley-mr-green

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.
Logged

Aix en Provence, France
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Very Nice Work indeed do you have a set up diagram as well  smiley
Logged

Offline Offline
Full Member
***
Karma: 5
Posts: 112
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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:
https://www.dropbox.com/s/2hdyqq6l3xn3dol/Arduino.zip

hopefully the supplied link will work.
« Last Edit: February 14, 2013, 10:55:38 pm by wallaceb » Logged

Aix en Provence, France
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Zip worked fine, very nice.

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

Pages: [1] 2 3 ... 7   Go Up
Jump to: