Arduino stops working after running the software

Hello,

I assembled the code below using UIPethernet library, it reads four temperature sensors dht11 and puts the values in a spreadsheet google docs. My problem is that when compiling the Arduino IDE shows that consumes 76% of memory. The Arduino only run the code once, I believe for lack of memory, is there anything I can do to make it work better?

#include <DHT.h>
#include <UIPEthernet.h>

#define DHTPIN 3
#define DHT1PIN 2 // pino que estamos conectado
#define DHT2PIN 4 // pino que estamos conectado
#define DHT3PIN 5 // pino que estamos conectadog3

#define DHTTYPE DHT11 // DHT 11
#define DHT1TYPE DHT11 // DHT 11
#define DHT2TYPE DHT11 // DHT 11
#define DHT3TYPE DHT11 // DHT 11

DHT dht(DHTPIN, DHTTYPE);
DHT dht1(DHT1PIN, DHT1TYPE);
DHT dht2(DHT2PIN, DHT2TYPE);
DHT dht3(DHT3PIN, DHT3TYPE);

char devid[] = "v0BAAC63B4E69044" ;  // THIS IS THE DEVICE ID FROM PUSHINGBOX

int del=300;  // Amount of seconds delay between posting to google docs.

char postmsg[30];
char server[] = "api.pushingbox.com";
EthernetClient client;

void setup()
{
  delay(100000);
   uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
  Ethernet.begin(mac);
  delay(1000);
  dht.begin();
  dht1.begin();
  dht2.begin();
  dht3.begin();
}
 
void loop(){
     delay(4000);// aguarda 4 segundos
  
    int umid1 = dht.readHumidity();
    int temp1 = dht.readTemperature();
    int umid2 = dht2.readHumidity();
    int temp2 = dht2.readTemperature();
    int umid3 = dht3.readHumidity();
    int temp3 = dht3.readTemperature();
    int umid4 = dht1.readHumidity();
    int temp4 = dht1.readTemperature();

 // Post to Google Form.............................................
  if (client.connect(server, 80)) 
  {
    sprintf(postmsg,"GET /pushingbox?devid=%s&status=%d&umid1=%d&temp2=%d&umid2=%d&temp3=%d&umid3=%d&temp4=%d&umid4=%d HTTP/1.1",devid,temp1,umid1,temp2,umid2,temp3,umid3,temp4,umid4);// NOTE** In this line of code you can see where the temperature value is inserted into the wed address. It follows 'status=' Change that value to whatever you want to post.
    client.println(postmsg);
    client.println("Host: api.pushingbox.com");
    client.println("Connection: close");
    client.println();
   delay(3000);
     client.stop();

  }
  delay(1000);
  
}
sprintf(postmsg,"GET /pushingbox?devid=%s&status=%d&umid1=%d&temp2=%d&umid2=%d&temp3=%d&umid3=%d&temp4=%d&umid4=%d HTTP/1.1",devid,temp1,umid1,temp2,umid2,temp3,umid3,temp4,umid4);

All that in 29 characters?
Good job!

Far more sensible would be something like

    client.print (F("GET /pushingbox?devid=));
    client.print (devid);
    client.print (F("&status="));
    client.print (temp1);

etc.

Each sensor have 2 numbers, sample: 22

#define DHTTYPE DHT11 // DHT 11
#define DHT1TYPE DHT11 // DHT 11
#define DHT2TYPE DHT11 // DHT 11
#define DHT3TYPE DHT11 // DHT 11

Isn’t this silly? 4 names for the same value?

DHT dht(DHTPIN, DHTTYPE);
DHT dht1(DHT1PIN, DHT1TYPE);
DHT dht2(DHT2PIN, DHT2TYPE);
DHT dht3(DHT3PIN, DHT3TYPE);

If you are going to number variables, number ALL of them.

 delay(100000);

Why?

   sprintf(postmsg,"GET /pushingbox?devid=%s&status=%d&umid1=%d&temp2=%d&umid2=%d&temp3=%d&umid3=%d&temp4=%d&umid4=%d HTTP/1.1",devid,temp1,umid1,temp2,umid2,temp3,umid3,temp4,umid4);// NOTE** In this line of code you can see where the temperature value is inserted into the wed address. It follows 'status=' Change that value to whatever you want to post.

Can you count? How many characters are you trying to stuff into postmsg? How many can it hold? If the first answer is more than the second answer, can you imagine why the Arduino stops working?

I have 4 DHT11 sensors so they appear 4x. This delay of 100,000, it is because I just want the loop to run every 100 seconds. The number of characters you want to send by post is 16, if I put "postmsg char [30];"It works once, if I put "postmsg char [60];" the values are all 0

if I put "postmsg char [60];" the values are all 0

Why 60? Why not 120? Or 240?

This delay of 100,000, it is because I just want the loop to run every 100 seconds.

So, you put it in setup(). Hmmm. Something wrong with your logic.

The number of characters you want to send by post is 16

Horseshit. GET /pushingbox?devid= all by itself is more than 16 characters. And that includes NO data.

if I put "postmsg char [60];" the values are all 0

Well, obviously that won't even compile, so that conclusion must be based on wishful thinking.

After running well beyond the end of the postmsg array, call strlen() to get the length of the string. Print the result. If the value printed, plus 1 for the terminating NULL, is less than the defined length of the array, you ARE overwriting memory you don't own, and expected behavior IS the result. And, I know for a fact that you are writing more than 30 (or even 60) characters into the array.

Thank you, after using strlen, I saw that the array needed to size 120.

Thanks again for the help