HTTP Request (e.g. to Thingspeak) using Arduino and Sim900 GSM Module

Sim900 module connected to Arduino
– Sim900 GND to Power-Supply GND
– Sim900 5V to Power-Supply 5V (not Arduino 5V, can be up to 2A!)
– Sim900 GND to Arduino GND
– Sim900 TXD to Arduino PIN 2
– Sim900 RXD to Arduino PIN 3

Using a Softserial passthrough sketch @4800baud

Initial configuration using AT commands


//Set to European Mode 900/1800
AT+CBAND="EGSM_DCS_MODE"
//Set to fixed Baudrate 4800
AT+IPR=4800

AT-Command-Set for HTTP-request


AT
//Should reply ok if ready

//Unlocking SIM
AT+CPIN=1234

//AT+CPIN?

//Should reply +CREG: 0,1 if ok
AT+CREG?

//Configure bearer 1 (change to your datat; this is for Congstar Germany by T-Mobile)
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","internet.t-mobile"
AT+SAPBR=3,1,"USER","t-mobile"
AT+SAPBR=3,1,"PWD","tm"

//Open bearer 1
AT+SAPBR=1,1

//Check bearer 1 (should reply IP)
AT+SAPBR=2,1

//Start HTTP using bearer 1
AT+HTTPINIT
AT+HTTPPARA="CID",1

AT+HTTPPARA="URL","http://api.thingspeak.com/update?api_key=1234&field1=1&field2=12"

//HTTP GET
AT+HTTPACTION=0

//Echo HTTP response
//AT+HTTPREAD

Advertisements

One thought on “HTTP Request (e.g. to Thingspeak) using Arduino and Sim900 GSM Module

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s