B4R Tutorial Http requests with GSM shield

Discussion in 'B4R Tutorials' started by Erel, Jul 6, 2017.

Similar threads

B4R Tutorial GSM / GPRS - Control the Arduino with SMS messages
Other GSM Shield
B4R Question libraries for gsm shield
B4R Question GSM/GPRS Shield
B4R Question GSM Shield
  1. Erel

    Erel Administrator Staff Member Licensed User

    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.

    [​IMG]

    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
     

    Attached Files:

    Last edited: Jul 6, 2017
  2. Johan Hormaza

    Johan Hormaza Active Member Licensed 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/
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice