B4R Tutorial Http requests with GSM shield

This example shows how to send http requests with a GSM shield. I've tested it on a shield with SIM900 module. This can be very interesting for outdoor IoT solutions where there is no local network.

There are no special libraries involved. The communication with the GSM shield is done by sending AT commands.

I've used an Arduino Mega which have more memory available.
Clicking on a connected button causes the Arduino to send a http request to Firebase push service.

SS-2017-07-06_18.15.10.jpg


The connections are:
5v and gnd (same pins on the shield)
- Arduino 10 to shield 7
- Arduino 11 to shield 8
(pins 7 and 8 on the Mega cannot be used with SoftwareSerial)

Getting the right sequence of commands was more difficult than expected. You can see it in the GSM module.

You need to update the APN value which should be provided by mobile network provider.

The module sends a POST request. You can change the main code to send a different message to different servers based on your needs.

The AT commands are documented here: http://simcom.ee/documents/SIM900/SIM900_TCPIP_Application Note_V1.02.pdf
 

Attachments

  • GSMPushMessages.zip
    3.3 KB · Views: 1,211
Last edited:

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
@Erel This for take in evidence e new library for sim800/sim900.that do thinks that other libraries don't do.

This library implements:

* True http through sim800/sim900 at command
* Transparent tcp
* EthernetClient api implemented with sim800Client
* sim800/sim900 RTC management

https://github.com/r-map/rmap/tree/master/arduino/sketchbook/libraries/sim800

take a look at examples https://github.com/r-map/rmap/tree/master/arduino/sketchbook/libraries/sim800/examples

so with this patched PubSubClient library
https://github.com/r-map/rmap/tree/master/arduino/sketchbook/libraries/PubSubClient
and those define in PubSubClient.h

// if use sim800 client
#include "sim800Client.h"
#define TCPCLIENT sim800Client
// if use arduino_uip or etherclient
//#include "Client.h"
//#include "Stream.h"
//#define TCPCLIENT Client

You can publish and subscribe to a MQTT broker.
https://elementztechblog.wordpress.com/2016/07/18/arduino-mqtt-library-for-sim800-gsm-modem/
 

Ilya G.

Active Member
Licensed User
Longtime User
@Erel This for take in evidence e new library for sim800/sim900.that do thinks that other libraries don't do.

This library implements:

* True http through sim800/sim900 at command
* Transparent tcp
* EthernetClient api implemented with sim800Client
* sim800/sim900 RTC management

https://github.com/r-map/rmap/tree/master/arduino/sketchbook/libraries/sim800

take a look at examples https://github.com/r-map/rmap/tree/master/arduino/sketchbook/libraries/sim800/examples

so with this patched PubSubClient library
https://github.com/r-map/rmap/tree/master/arduino/sketchbook/libraries/PubSubClient
and those define in PubSubClient.h

// if use sim800 client
#include "sim800Client.h"
#define TCPCLIENT sim800Client
// if use arduino_uip or etherclient
//#include "Client.h"
//#include "Stream.h"
//#define TCPCLIENT Client

You can publish and subscribe to a MQTT broker.
https://elementztechblog.wordpress.com/2016/07/18/arduino-mqtt-library-for-sim800-gsm-modem/

Is it possible to wrap this library?
 

truerad

New Member
This example shows how to send http requests with a GSM shield. I've tested it on a shield with SIM900 module. This can be very interesting for outdoor IoT solutions where there is no local network.

There are no special libraries involved. The communication with the GSM shield is done by sending AT commands.

I've used an Arduino Mega which have more memory available.
Clicking on a connected button causes the Arduino to send a http request to Firebase push service.

SS-2017-07-06_18.15.10.jpg


The connections are:
5v and gnd (same pins on the shield)
- Arduino 10 to shield 7
- Arduino 11 to shield 8
(pins 7 and 8 on the Mega cannot be used with SoftwareSerial)

Getting the right sequence of commands was more difficult than expected. You can see it in the GSM module.

You need to update the APN value which should be provided by mobile network provider.

The module sends a POST request. You can change the main code to send a different message to different servers based on your needs.

The AT commands are documented here: http://simcom.ee/documents/SIM900/SIM900_TCPIP_Application Note_V1.02.pdf

I really need more detailed and complete information to try this.

particularly as it relates to the Firebase push service
how to set up for this.
Process_Globals:
    Public API_KEY() As Byte = "aaaatb2P9zCPxnDhT_DjDfV9o__wA51nhR4-uyxiLhcwg"
    Public APN As String = "Telkomsel"
    Public Link As String = "/fcm/send"
    Public Host As String = "fcm.googleapis.com"
please explain the function of each constant above.
And what variables should I change.

Note. I have prepared all the necessary equipment.
 

Attachments

  • WhatsApp Image 2020-08-12 at 20.29.31.jpeg
    WhatsApp Image 2020-08-12 at 20.29.31.jpeg
    79.8 KB · Views: 295
Top