Connection via AT Commands

I’m having difficulty getting the nuts and bolts of the connection to work for sending the connection message. The BYOT documentation isn’t giving the detailed info for making a connection manually at the command level. It only references pre built libraries for everything but a command control modem. I can establish a connection to the socket:

AT#SD=1,0,1883,“mqtt.mydevices.com”,0,0
CONNECT

Then I try and send a POST command to connect to the application. I get nothing, then it times out.

POST / “{userName:”“”“cd853e90-75ed-11e7-b0bc-87cd67a1f8c7"”“”password:“”““37400ec5e771e809922bc3ee6f805e0d3839ff9d””“”}"

Nothing happens. I check my thing in the dashboard and it doesn’t ever acknowledge the connection. Nor do I ever recieve the connection ACK message.

Am I not sending enough data elements?
Is there a list of required elements?
Is there an example of someone doing it with a AT command connection?

Are you trying to send an HTTP POST command? That will not work because the BYOT connection uses MQTT, not HTTP. To get it to work you’d need to create a TCP connection and then send and handle the appropriate MQTT messages to establish MQTT communication.

To do this with the MQTT libraries we have you would need to provide your own networking implementation as mentioned here for the C library:

And here for the C++ library:

Basically it would require replacing the example Linux code for creating a TCP connection and reading and writing data with your own implementation using AT commands.

If you’d rather implement it all using AT commands that would require more work to support the MQTT protocol. I found this repo that seems to use AT commands for MQTT with a SIM800. Perhaps that would be helpful:

And here is a repo that seems to use AT commands with a couple different MQTT libraries.
https://github.com/r-map/rmap/tree/master/arduino/sketchbook/libraries/sim800

This example seems to use PubSubClient for MQTT:
https://github.com/r-map/rmap/blob/master/arduino/sketchbook/libraries/sim800/examples/mqtt_basic/mqtt_basic.ino

And here is one that uses Paho MQTT client, which is the basis for the Cayenne libraries so it may be helpful as a guide if you plan to try and implement networking using the Cayenne libraries as mentioned in the documentation links above.
https://github.com/r-map/rmap/blob/master/arduino/sketchbook/libraries/MQTTClient/examples/sim800Hello/sim800Hello.ino

2 Likes

A different low level serial ‘AT command’ level ?
I have had some success using the ttyAMA0 / ttyS0 off the GPIO port of Raspberry Pi + pyserial + splitcsv in a few lines of python.
~ Andrew

Hi there,

@jburhenn I know it is a late thread, but the first link you posted is not working for me, it redirect to me to getting started login page.

So guys I am in the same boat I want to use a different microcontroller + Cellular modem to connect to cayenne, but I did not have enough luck to find some guide or similar to reach my goal

@Estarrosa Hey, you can try this link for info about implementing new network code using C:

And here is the one for C++:

Thanks for the info @jburhenn but my device is not based on Linux, or esp8266 and itself TCP stack

It shouldn’t matter if it’s based on Linux. For example some work was done to add Windows platform support here: https://github.com/myDevicesIoT/Cayenne-MQTT-CPP/tree/feature/windows/src/Platform/Windows.

You’d need to add support for networking and timer code for your board as described in the docs: Cayenne Docs