GSM/GPRS easy plug&play

Plug&play GPRS client for Industruino

Tom

To provide an easy plug&play example for the Industruino GSM/GPRS module, we're happy to point you to the TinyGSM library which includes an example 'Industruino' (in the folder 'more'). To use this example please install the following libraries, e.g. via the Arduino IDE Library Manager (Sketch > Include Library > Manage Libraries):

  • TinyGSM

  • ArduinoHttpClient

  • StreamDebugger (optional)

Then open the TinyGSM library example 'Industruino'.

But before trying the code, make sure your hardware is ready:

  • SIM card that supports 2G (and has PIN code disabled)

  • Insert the SIM card in the slot

  • Check the positions of 2 jumpers and switch on the PCB (default shipment status, known as 'IDC mode 2' in the documentation):

    • top jumper should be in LEFT position (SW)

    • middle switch should be in LEFT position (HW)

    • bottom jumper should be in TOP position

  • Attach the antenna

If you are only going to use SMS functions (no GPRS) then you can skip setting the APN, this sketch will still show you whether the SIM is registering on the network or not. If you do want data communication, you will need to modify the APN in the sketch in line 40, and also user and password, if any. In my case, APN is 'cmhk' and user/password are empty (China Mobile Hong Kong).

Upload the sketch, open de Serial Monitor, and you should see as below.

The sketch initialises the SIM800, connects to the 2G network, enables GPRS, and requests a file from a server.

If this works from the first time, congratulations, you can now modify it to do whatever you want.

If the sketch gets stuck at any point, it might be useful to see the underlying AT commands and replies that are sent over the Serial1 port. You can enable this by uncommenting the DUMP_AT_COMMANDS line (line 27). Then the Serial Monitor looks like this.

This can help you find out where exactly the problem is situated.

A note on the LED on the GSM/GPRS module: this indicates the network status of the SIM800:

  • fast blink (1s): searching for network

  • slow blink (3s): registered on network

  • very fast blink: GPRS enabled

Next to the LED there are 2 small buttons:
  • left button is the RESET of the SIM800

  • right button is the PWR button to switch on/off

The SSL option in the sketch does not seem to work; but we can make it work with a few modifications:
  • uncomment line 32: #define USE_SSL
  • change the server in line 47: const char server[] = "httpbin.org";
  • change the requested resource in line 48: const char resource[] = "/ip";
  • add a line before the GET request in line 114:   http.connectionKeepAlive();  // Currently, this is needed for HTTPS  -- TT added
This will connect to https://httpbin.org/ip and return the IP address of the SIM module.

For more information, also check the doc on github and our website.