sim900 GSM

Hello everyone, I'm new in this forum, but I have looked for diferent programs since a few years.

I'm a french student and with my class, we have a project. We want to do an "Intelligent beehive". We would like to get informations about its weight, its temperature and its humidity and next, send the data we got to cosm or by sms with a sim900 GSM. However, even if we know how to get the informations, we don't know how to send it. We found some programs to send data, but it has to be connected to a computer.

I have an arduino Mega 2560, a sim900 GSM/GPRS, a DHT22 captor for humidity and temperature, two SEN-10245 sensors and a grove relay from seeed studio.

And so, I need some help for the program. The program has to get datas from the arduino, and write it in an sms or send it to cosm. But, the most important is that Arduino and the sim900 GSM have to be in standalone, and so, every hours, the sms has to be sent. I get some programs on these websites, but they don't work in standalone:

http://mchobby.be/wiki/index.php?title=GeekOnFire_GSM/GPRS_Shield http://www.cooking-hacks.com/index.php/documentation/tutorials/arduino-gprs-gsm-quadband-sim900 http://mchobby.be/wiki/index.php?title=SmsCommand http://mchobby.be/wiki/index.php?title=GeekOnFire_GSM/GPRS_Shield_SerialRelay2 http://www.open-electronics.org/gsm-gps-shield-for-arduino/

Thanks for your help.

Comment dit-on, en francais, "DO NOT CROSS-POST, IT WASTES TIME AND MAKES ME CROSS" ?

Sorry, I didn't know where I had to post it. And sorry, but, can you move it to the right place please?

I am working on a similar project http://arduino.cc/forum/index.php/topic,113534.0.html I am using the sim900 to upload to cosm each hour, during the day. I can probobly post some code if you are interested. I am not quite sure what you mean by it have to bee in standalone, care to explain?

Yes I'm interested. For sure :) Thanks What I mean by standalone is that Arduino and the module must work without a connection with the computer. It must work without USB connection. And so, Arduino and the sim900 have to work by their own.

Hi @LEGO-lars , Please DO post your code or point to it; I'd like to get a working example of this kind of use of the SIM900 on the http://ArduinoInfo.Info WIKI...

Hi all, Sorry for late answer. Here is the code I am using to send data to cosm.com in my project. Most of the code is copied from http://www.seeedstudio.com/wiki/GPRS_Shield_V1.0, but there are some small changes. This code will turn on the GPRS-module, upload the data, and then turn itself off again to save power.

void Upload2Cosm()
{
  //if GPRS-module is powered down, 
  //pulling the PWRKEY pin low for at least 1 second, will power up the GPRS module
  digitalWrite(powerKey, HIGH);
  delay(1100);
  digitalWrite(powerKey, LOW);
  delay(10000);
  
  Serial1.println("AT+CGATT?");
  delay(1000);

  Serial1.println("AT+CSTT=\"CMNET\"");//start task and setting the APN,
  delay(1000);

  Serial1.println("AT+CIICR");//bring up wireless connection
  delay(3000);

  Serial1.println("AT+CIFSR");//get local IP adress
  delay(2500);

  Serial1.println("AT+CIPSPRT=0");
  delay(3000);

  Serial1.println("AT+CIPSTART=\"tcp\",\"api.cosm.com\",\"80\"");//start up the connection
  delay(2000);

 //We need to calculate the length of the data we are sending.
  int dataLength = XX; //How many bytes you are sending
  
  Serial1.println("AT+CIPSEND");//begin send data to remote server
  delay(4000);

  Serial1.print("PUT /v2/feeds/(PUT YOUR COSM FEED-ID HERE).csv HTTP/1.1\r\n"); // 
  delay(500);
  
  Serial1.print("Host: api.cosm.com\r\n");
  delay(300);
  
  Serial1.print("X-PachubeApiKey: (PUT YOUR APIKEY HERE)\r\n");
  delay(300);
  
  Serial1.print("Content-Length: ");
  Serial1.println(dataLength);
  delay(300);
  
  Serial1.print("Connection: close\r\n\r\n");
  delay(300);
  
  
  
  ///////////////////////////////////////////////////////////
  //Serial print the data you want to upload to cosm here.
  //for example:
  Serial1.print("Temperature,");
  delay(100);
  Serial1.print(myDHT22.getTemperatureCInt()/10);
  Serial1.print(".");
  Serial1.println(myDHT22.getTemperatureCInt()%10);
  delay(200);
  Serial1.print("Moist,");
  delay(200);
  Serial1.print(myDHT22.getHumidityInt()/10);
  Serial1.print(".");
  Serial1.println(myDHT22.getHumidityInt()%10);
  delay(200);
  ///////////////////////////////////////////////////////
  
  
  Serial1.print("\r\n");
  delay(300);
  
  Serial1.println((char)26);//sending
  delay(5000);//waitting for reply, important! the time is base on the condition of internet 
  Serial1.println();

  Serial1.println("AT+CIPCLOSE");//close the connection
  delay(1000);

  Serial1.println("AT+CPOWD=1"); //Power down the GPRS module. Optional
  
}

A little tip at the end, which helped me a lot, and makes debugging a lot easier. If you are using SoftwareSerial or Serial1(mega), connect the tx from sim900 to tx0 on arduino. this way, all the commands and response from the sim900 will show up in the serial monitor.