3
votes

I am using Simcom SIM 808 to post data to Azure Iot Hub. My problem is that Azure Iot Hub requires a SAS string in the Authorization header, but I can not find a way to add this header. Anyone have experience with sim 808 and Azure iot? Is it possible to add the authorization string to the url?

I am using the SIM800 series AT command manual v 1.07.pdf for reference.

Header arguments that are supported is: CONTENT, USERDATA and some more.

1
Hi, Did you find an answer to this? I am stuck on the same problemGandhali Samant

1 Answers

1
votes

Here you can find a program I made to send data to my Azure IoT Hub via HTTPS using SIMCOM Modules (SIM800, SIM900...): https://developer.mbed.org/users/BorjaTarazona/code/Azure_SIM800_HelloWorld/

I had the same issue, my problem was that you need to write before your shared access signature "Authorization: ". You need to use the argument "USERDATA" and the command will look like this:

AT+HTTPPARA="USERDATA","Authorization: YourSharedAccessSignature"\r\n

The commands I use to send data to Azure via HTTPS with SIMCOM modules are:

Initialization

  1. Set context type: AT+SAPBR=3,1,"CONTYPE","GPRS"\r\n

  2. Set APN: AT+SAPBR=3,1,"APN","YourAPN"\r\n

  3. Open bearer: AT+SAPBR=1,1\r\n
  4. Query bearer: AT+SAPBR=2,1\r\n
  5. Enable HTTP functions: AT+HTTPINIT\r\n
  6. Enable SSL: AT+HTTPSSL=1\r\n

Data transmission

  1. Set bearer profile identifier: AT+HTTPPARA="CID",1\r\n
  2. Set the URL: AT+HTTPPARA="URL","YourURL"\r\n
  3. Set the shared access signature: AT+HTTPPARA="USERDATA","Authorization: YourSharedAccessSignature"\r\n
  4. Set Content-Type field in the HTTP header: AT+HTTPPARA="CONTENT","application/json"\r\n
  5. Set the JSON string to be sent: AT+HTTPDATA=StringLength,20000\r\nYourJSONString
  6. HTTP POST: AT+HTTPACTION=1\r\n