I have easily managed to connect the M95 GSM module to an Arduino and can communicate. I want to have a very basic way of posting data to a website from the Arduino. It seems the AT commands are suppose to be easy to use.
I can send basic commands like AT etc very easy and get the reply. Now I want to post data and it does not work. Here is the sequence I use, in Arduino code:
Serial.println("Talking to Modem: AT");
mySerial.println("AT");
delay(1000);
// I get correct response: OK
Serial.println("Check if SIM is locked");
mySerial.println("AT+CPIN?");
delay(1000);
// I get correct response: +CPIN: READY
Serial.println("Setting up URL");
mySerial.println("AT+QHTTPURL=31,30");
mySerial.println("www.somedomain.co.za/api/");
delay(2000);
// I get response: OK. Not too sure if the /api/ must be in the URL
Serial.println("Sending Data");
mySerial.println("AT+QHTTPPOST=31,30,10");
mySerial.println("usersID=2");
delay(2000);
// Get the response: CONNECT
Serial.println("Read Response");
mySerial.println("AT+QHTTPREADS=30");
// Get the response: CME ERROR: 3 (Cause for PPP/IP Stack)
I'm not too sure what next to do:
- Why do I have to send string lengths before I post the URL? Why can't I just post the complete URL? Is there an AT command to just post an URL?
Best Answer
It will work,
first of all you have to set the access point called APN. Then Also you should use AT+QHTTPREAD instead AT+QHTTPREADS which is wrong command.