8 years, 9 months ago.

Compatibility with SIM900

Hi all,

I am developing device based on Nucleo-F401RE and SIM900 GPRS module. Now, I want to add MQTT subscribe functionality in it, and I think this code will be a good basis.

My understanding from the code, there are two steps in achieving GPRS MQTT. First, connect interface (SIM900) to network. Second, initialize MQTT client and connect to server.

I am done with first step and have successfully connect SIM900 to network (as the module get IP address). Although, I use simple AT command (illustrated by code below) to bring connection up:

//set operator apn, username, password
sim900.printf("AT+CSTT=\"apn\",\"username\",\"password\"\r\n");
rcvReply(rcv,5000);
DBG.printf("rspn[CSTT]:%s",rcv);

//bring up wireless connection
sim900.printf("AT+CIICR\r\n");
rcvReply(rcv,3000);
DBG.printf("rspn[CIICR]:%s",rcv);

//get local ip address
sim900.printf("AT+CIFSR\r\n");
rcvReply(rcv,3000);
DBG.printf("rspn[CIFSR]:%s",rcv);

Now, the problem is related initializing MQTT client and connecting it to server. If I put:

PubSubClient mqtt(serverIpAddr, port, callback);

then my program hangs. I already dig the code, and even setup debug port in PubSubClient.cpp where "PubSubClient" definition resides. However, my program didn't go in there.

My questions:

  1. Has anybody tried this code working with either SIM900 or other GPRS module? Please give me links or explanation to do that.
  2. Please provide alternative library for SIM900 MQTT or SIM900 firmware that support MQTT if any.

Thanks for your time to answer my questions!

Question relating to:

Arch GPRS MQTT demo arch gprs, MQTT

1 Answer

8 years, 9 months ago.

The code works with Arch GPRS (SIM900) to connect opensensor.io (an MQTT server). Although it's not stable.

Or you may take a look at https://developer.mbed.org/teams/ublox/code/Cellular_HelloMQTT/