[SOLVED]Logging multiple temp sensors questions(step by step)

I'm commenting out:

// sprintf(pageAdd,"/update?key=XXXXXXXXXXX&field1=%u&field2=%u&field3=%u",temp0,temp1,temp2); 

//  if(!getPage(server,pageAdd)) Serial.print(F("Fail "));
//  else Serial.print(F("Pass "));

I'm using Mega

With a Mega, you should be ok on memory then. Does the log look ok now, or is it still malfunctioning?

after removing the lines what I have sent before, the first attempt is failed, and then ok.(second to sixth...)
and logfile ok too

vespapierre:
after removing the lines what I have sent before, the first attempt is failed, and then ok.(second to sixth...)
and logfile ok too

So the SD log works as long as you don't call the getPage function? And getPage works all the time?

yes.

this is not commented out:

 byte getPage(IPAddress ipBuf,char *page)
{
  int inChar;
  char outBuf[128];

  Serial.print(F("connecting..."));

  if(client.connect(ipBuf,80))
  {
    Serial.println(F("connected"));

    sprintf(outBuf,"GET %s HTTP/1.0\r\n\r\n",page);
    client.write(outBuf);
  } 
  else
  {
    Serial.println(F("failed"));
    return 0;
  }

  // connectLoop controls the hardware fail timeout
  int connectLoop = 0;

  while(client.connected())
  {
    while(client.available())
    {
      inChar = client.read();
      Serial.write(inChar);
      // set connectLoop to zero if a packet arrives
      connectLoop = 0;
    }

    connectLoop++;

    // if more than 10000 milliseconds since the last packet
    if(connectLoop > 10000)
    {
      // then close the connection from this end.
      Serial.println();
      Serial.println(F("Timeout"));
      client.stop();
    }
    // this is a delay for the connectLoop timing
    delay(1);
  }

  Serial.println();

  Serial.println(F("disconnecting."));
  // close client end
  client.stop();

  return 1;
}

OK, we are down to two main things. It is either the sprintf, or the call to getPage. Uncomment the sprintf statement, but leave the call to getPage commented out. Does the SD log do ok?

with that sprintf , the first log attempt is failed, than ok. logfile ok too! ( just getpage function is commented out)

OK. Uncomment the getPage function and try it with a very simple page, like Google home page.

you mean change the IP address to google.com 's IP and use getpage as the same? :

if(!getPage(server, pageAdd)) Serial.print(F("Fail "));
//  else Serial.print(F("Pass "));

Use Google's home page with "/" for a page. Comment out your sprintf, and use a simple one for a test. It is something right in there causing the fail.

sorry Tim, I don't understand ... can you send me the function?

new infos: if I put the getpage before logfile, log failed all the time...

changed the ip to google.com's ip
and function is:

sprintf(pageAdd, "/");

if(!getPage(server,pageAdd)) Serial.print(F("Fail "));
 else Serial.print(F("Pass "));

return code from google is 302 and

logfile is:
2012-12-03,22:19:51,4,4,4;

2012-12-03,22:20:59,5,3,3;
2012-12-03,22:21:16,5,3,3;

I tried to change the size of the pageAdd from 140 to 139 and 141 with the original server....az API said max size can be 140...
what the hell can be the problem...I do not beleive that it cannot be solved...voaaaa....

there was no wire.begin() during the code...

We've tried about everything else, so try switching the two function calls. Call getPage() first, then logFile().

Already tried...in that case all the log action is failed...I don't believe this :~ should we need to modify pinmodes or input/output?

Does anybody havy any idea about this issue? :~
Tim thanks a lot or you!

FYI: I do not believe it is the SD and w5100 causing the problem. I use these two together all the time, and they work good together at the same time. I use them for a FTP passive client to transfer files to and from my FTP/Apache server.

Maybe try removing all but one of the other devices, and see where it starts working again.

I have lost my faith a bit...Tim you mean I should change other devices to output and put it to high?
Can you send me yiur code just to check? Maybe i should change my concept and send csv instead of sending file...
I don't beleive nobody has tried a same project... :~

You are in new territory getting that many devices working on the same Arduino. Maybe it is the power supply? Try disconnecting the other hardware and see if the code still works. It won't save/send the correct readings, but may help determine the cause of the SD fail. It uses memory and power when active.

edit: You are using:
SD
w5100
RTC
3 temperature sensors.

I've never tried that many devices before.

they are on the same shield :frowning: I cannot disconnect them...maybe is it possible in the code?

All on the same shield? That is unusual.

Try using just the SD, w5100 and RTC part of the code. Use dummy values for the temperature sensors. Does that work?

Without having all the equipment here, it is hard to troubleshoot.