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

hi, any idea why I am only getting Middle Ground temp reading although Cold and Middle sensors connected.
Two one wire sensors with 4,7k resistors on each.

thanks!

You only need one 4k7 but I don't know if this is the cause of your problem.

mkcinek:
hi, any idea why I am only getting Middle Ground temp reading although Cold and Middle sensors connected.
Two one wire sensors with 4,7k resistors on each.

thanks!

i honestly do not know. i myself have one 4.7k resistor per sensor as well since each data line goes to its own dedicated I/O pin. do you have the sensors connected to the correct pin? have you tried to make sure the sensors that are not working, work correctly when connected to the I/O pin of one that does?

wallaceb:

mkcinek:
hi, any idea why I am only getting Middle Ground temp reading although Cold and Middle sensors connected.
Two one wire sensors with 4,7k resistors on each.

thanks!

i honestly do not know. i myself have one 4.7k resistor per sensor as well since each data line goes to its own dedicated I/O pin. do you have the sensors connected to the correct pin? have you tried to make sure the sensors that are not working, work correctly when connected to the I/O pin of one that does?

As far as I know one wire sensors are attached to 22,24,26, 28,30 pins.
Only getting Middle Ground readings, however after switching from Celsius to Fahrenheit I can get readings wherever sensor is connected, do you work on F or C?
thanks!!!

i keep mine in F the entire time. i just checked, and it is doing the same thing on my system when set to C.... i will have to look into what is going on.

found the issue

change the current code:

void CONVERT_TEMP(byte Sensor_PIN, byte & temp_whole, byte & temp_fract, byte & temp_status) {
  OneWire  dSensor1(Sensor_PIN); 
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
  int HighByte, LowByte, TReading, SignBit, Tc_100;
  
  
  if ( !dSensor1.search(addr)) {
    dSensor1.reset_search();
    delay(250);
    temp_whole = 0;
    temp_fract = 0;
    temp_status = 0;
    badsensorcount ++;
    return;
  }

  if ( OneWire::crc8( addr, 7) != addr[7]) {
      temp_whole = 0;
    temp_fract = 0;
    temp_status = 0;
    badsensorcount ++;
    return;
  }

  // The DallasTemperature library can do all this work for you!

  dSensor1.reset();
  dSensor1.select(addr);
  dSensor1.write(0x44,0);         // start conversion, without parasite power on at the end
  
  delay(1000);     // maybe 750ms is enough, maybe not
  // we might do a dSensor1.depower() here, but the reset will take care of it.
  
  present = dSensor1.reset();
  dSensor1.select(addr);    
  dSensor1.write(0xBE);         // Read Scratchpad

  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = dSensor1.read();
  }

  LowByte = data[0];
  HighByte = data[1];
  TReading = (HighByte << 8) + LowByte;
  SignBit = TReading & 0x8000;  // test most sig bit
  if (SignBit) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's comp
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25
  
  if (temp_scale == 1){//if using degrees F, the celcius reading from the sensor must be converted
     temp_whole = (int)(((Tc_100)*(1.8))+3200)/100;
     temp_fract = (int)(((Tc_100)*(1.8))+3200)%100;
     if (temp_whole > 32){
       temp_status = 1;//if the temperature is above 32 degrees F, then the sensor is OK
     }else{
       temp_status = 0;//the sensor must be bad as the temperature must never get down as low as 32 degrees F, the snake would die!!
     }
   }else{//if using degrees C, the temp reading is good as is.
     middle_temp_whole = Tc_100/100;
     middle_temp_fract = Tc_100%100;
     if (temp_whole > 0){
       temp_status = 1;//if the temperature is above 0 degrees C, then the sensor is OK
     }else{
       temp_status = 0;//the sensor must be bad as the temperature must never get down as low as 0 degrees C
     }
   }
}

to

void CONVERT_TEMP(byte Sensor_PIN, byte & temp_whole, byte & temp_fract, byte & temp_status) {
  OneWire  dSensor1(Sensor_PIN); 
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
  int HighByte, LowByte, TReading, SignBit, Tc_100;
  
  
  if ( !dSensor1.search(addr)) {
    dSensor1.reset_search();
    delay(250);
    temp_whole = 0;
    temp_fract = 0;
    temp_status = 0;
    badsensorcount ++;
    return;
  }

  if ( OneWire::crc8( addr, 7) != addr[7]) {
      temp_whole = 0;
    temp_fract = 0;
    temp_status = 0;
    badsensorcount ++;
    return;
  }

  // The DallasTemperature library can do all this work for you!

  dSensor1.reset();
  dSensor1.select(addr);
  dSensor1.write(0x44,0);         // start conversion, without parasite power on at the end
  
  delay(1000);     // maybe 750ms is enough, maybe not
  // we might do a dSensor1.depower() here, but the reset will take care of it.
  
  present = dSensor1.reset();
  dSensor1.select(addr);    
  dSensor1.write(0xBE);         // Read Scratchpad

  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = dSensor1.read();
  }

  LowByte = data[0];
  HighByte = data[1];
  TReading = (HighByte << 8) + LowByte;
  SignBit = TReading & 0x8000;  // test most sig bit
  if (SignBit) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's comp
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25
  
  if (temp_scale == 1){//if using degrees F, the celcius reading from the sensor must be converted
     temp_whole = (int)(((Tc_100)*(1.8))+3200)/100;
     temp_fract = (int)(((Tc_100)*(1.8))+3200)%100;
     if (temp_whole > 32){
       temp_status = 1;//if the temperature is above 32 degrees F, then the sensor is OK
     }else{
       temp_status = 0;//the sensor must be bad as the temperature must never get down as low as 32 degrees F, the snake would die!!
     }
   }else{//if using degrees C, the temp reading is good as is.
     temp_whole = Tc_100/100;
     temp_fract = Tc_100%100;
     if (temp_whole > 0){
       temp_status = 1;//if the temperature is above 0 degrees C, then the sensor is OK
     }else{
       temp_status = 0;//the sensor must be bad as the temperature must never get down as low as 0 degrees C
     }
   }
}

i realized i never put up pictures of my entire final setup

It looks great, everything is organized as it should be - but where is the snake :wink: ?

Have you update your code recently ?

mkcinek:
It looks great, everything is organized as it should be - but where is the snake :wink: ?

Have you update your code recently ?

the snake only like to come out at night :sleeping:

my latest will be uploaded later tonight. only a few small things have been tweaked, and i re-added corrected code so the RTC will update off NTP servers once a day.

sorry, forgot to upload the code:

https://www.dropbox.com/s/eyg6vdv6dt0ut9b/Arduino5-26-13.rar

let me know if you have any issues.

ok, i have made several changes

1.) corrected an issue where the heat lamp would not properly turn off
2.) modified the system so the images used on the main page to signify if the relays are on/off and if the temperature sensors are good/bad are no longer pulled off my photobucket account, but are pulled directly off the SD card.

latest code, now "officially" at version 1.1 dated 6/6/3013 can be found at Dropbox - 1.1 - 6-6-2013.zip - Simplify your life

Great !!!

Thanks for an update, will install it now.

Hi,

Just wondering if you made any changes to the sketch?
Are you working on other great arduino projects?
Thanks!

mkcinek:
Hi,

Just wondering if you made any changes to the sketch?
Are you working on other great arduino projects?
Thanks!

i have not made any changes. it has been working exactly as i want, and i have not found any issues after running constantly for 2.5 months without interruption.

i have created another project here:
http://forum.arduino.cc/index.php?topic=183000.0

Hello WALLACEB,

First of all it is the best arduino project seen by me. You did a good job.
I have some issue and I dont know where is the problem and maybe you can help me:

In both situation I only use the arduino mega + RTC + Ethernet shiel + microSD 4GB

  1. In first situation after I upload webserverinit I see on serial monitor that all parameters are ok, after that I upload the webserver code and also this one on serial monitor is ok. I ping the IP and is working very well. The isue is after I browsing thrue webserver pages the webpage (after 1-2 min) is not responding.

  2. After one week of pause I re-upload all the codes again because in this week I use arduino for other projects and the situation is like this: arduino respond on ping, did not open any webpage anymore and few seconds after I try to open the webpage is start pulsing fast the orange led on the ethernet shiel (the one near pin 13) and I can't do nothing.

It is any problem because I did not conect any temp senzor yet and only I want to play with the webpage?

Please advice me.

Thank you very much
Dan

barbudancristian:
Hello WALLACEB,

First of all it is the best arduino project seen by me. You did a good job.
I have some issue and I dont know where is the problem and maybe you can help me:

In both situation I only use the arduino mega + RTC + Ethernet shiel + microSD 4GB

  1. In first situation after I upload webserverinit I see on serial monitor that all parameters are ok, after that I upload the webserver code and also this one on serial monitor is ok. I ping the IP and is working very well. The isue is after I browsing thrue webserver pages the webpage (after 1-2 min) is not responding.

  2. After one week of pause I re-upload all the codes again because in this week I use arduino for other projects and the situation is like this: arduino respond on ping, did not open any webpage anymore and few seconds after I try to open the webpage is start pulsing fast the orange led on the ethernet shiel (the one near pin 13) and I can't do nothing.

It is any problem because I did not conect any temp senzor yet and only I want to play with the webpage?

Please advice me.

Thank you very much
Dan

specifically off the top of my head, it sounds a lot like the issues i had when accessing the web pages from my smart phone's browser. in andriod, the stock browser would always cause the arduino Ethernet shield to not respond anymore. If i used firefox on my andriod, then everything worked fine.

with that said, i have used IE and firefox without issues. what browser are you using?

what i would do to see what the issue is to add a serial print command at the beginning of every function. that way you can see how the functions are called, and then you can see which function the arduino stops responding at.

Thank you for fast response.
I use Safari on iMac and also on the same iMac I use Chrome. I will test with Firefox today.

Question: Is mandatory to connect the sensors and the relay shield or the webserver must work also without this stuff connected? I did not connect yet the sensors because right now I have only two for temp and only relay shield with 4 relays....

Thank you

barbudancristian:
Thank you for fast response.
I use Safari on iMac and also on the same iMac I use Chrome. I will test with Firefox today.

Question: Is mandatory to connect the sensors and the relay shield or the webserver must work also without this stuff connected? I did not connect yet the sensors because right now I have only two for temp and only relay shield with 4 relays....

Thank you

everything else will still work without sensors or the relays attached. The main system screen will just show all the sensors as offline by showing red circles and the temperatures will all show zero. if no humidity sensor is connected, the feedback will display random results depending on what the analog input is floating at.

i wonder if the Safari might be causing the issues, hopefully firefox will fix it. I have not tried chrome on my systems. i assume there is some large bug in how the code handles the different browser HTTP traffic, but i have not figured it out.

You have right with Firefox work fine. Please tell me I try to translate the webpage in my language and I deal with strange issue.
You make for View Recorded Data one HTML. I try to translate it in htmldata.h changing the code into this:
"<Table border = "1">"
""
"<td align = "center">Date"
"<td align = "center">Time"
"<td align = "center">Temperatura 1"
"<td align = "center">Temperatura 2"
"<td align = "center">Temperatura 3"
"<td align = "center">Medie Temperatura Ambient"
"<td align = "center">Umiditate Medie"
"<td align = "center">Releu 1"
"<td align = "center">Releu 2"
"<td align = "center">Releu 3"
"<td align = "center">Releu 4"
"<td align = "center">Releu 5"
"<td align = "center">Releu 6"
"";
After I re-upload the code, the HTML report is no changed on table header showing me like the original one.
Please tell me where is the mistake.

Thanks

It's OK now the header translation for Recorded data table. The code for this was in web server.ino not in htmldata.h . But why is also in the htmldata.h ?
Another questions:

  1. Main page "System Overview" have an refresh time? seems to remain unrefreshed and I have to right click on it and choose Reload page to see any change in temp .
  2. Can I change the date format from M/D/Y to D/M/Y like we use in our country?

Thank you again and sorry to kill you with those question.

P.S. I see when I chose to open recorded data file that the system give command to relay for short time. Why when is open the html page with the table the system act the relays?