Serial communication with GSM/GPRS expansion module?

Hello

How does serial communication work between IND.I/O baseboard and the GSM/GPRS expansion module through the 14 pin connector?

I can't use the Software Serial library as it woun't build when I use it to build for Industruino D21G board.

Do you have some example code to see if the communication is working?

Best regards

AtliGunnar
AtliGunnar
7
| 2 1 1
Asked on 11/30/17, 2:18 PM
0
vote
4298 Views

Hi, the GSM/GPRS is wired to work with the 2 hardware serials available on the D21G, there is no need for software serial.

'Serial' on D0/D1

'Serial1' on D10/D5

These 2 serials are connected to the SIM800 and to the RS232 port, and can be swapped with hardware switches, please have a look at the user manual p3 https://static.industruino.com/downloads/manuals/GSM_GPRS_for_Industruino_product_manual_April'2017.pdf

Example code for both configurations is available at https://github.com/Industruino/democode

 

You could also use the Adafruit FONA library, using the above hardware serial, and switch on debugging with these edits:

  #define ADAFRUIT_FONA_DEBUG   // in includes/FONAConfig.h

  #define DebugStream    SerialUSB  // in includes/platform/FONAPlatStd.h

Be aware that the Industruino GSM/GPRS module uses D6 as power on/off pin (it needs 1s HIGH), which is not the same as the Reset pin of the FONA library (pulled LOW for 0.1s in the library).

Tom
Tom
5675
| 1 1 3
Answered on 12/1/17, 1:53 AM
1
vote

Hi Tom Thank you for this answer, it helped a lot. I have a problem when i use GPRSwebclientTinyGSM_D21G_HardwareSerial1.ino. I get power to the modem and the LED starts to blink. It then gets to "Waiting for network..." but then it says fail and tries again. I also tried to use an example from TinyGSM called ATdebug and it doesn't work either. I don't quite understand why it does't connect to the network. Best regards

AtliGunnar
on 12/4/17, 1:58 PM

Hi Tom Thank you for this answer, it helped a lot. I have a problem when i use GPRSwebclientTinyGSM_D21G_HardwareSerial1.ino. I get power to the modem and the LED starts to blink. It then gets to "Waiting for network..." but then it says fail and tries again. I also tried to use an example from TinyGSM called ATdebug and it doesn't work either. I don't quite understand why it does't connect to the network. Best regards

AtliGunnar
on 12/4/17, 1:58 PM

Hi, so are you getting any AT commands to/from the modem? If yes, can you make sure you're using a 2G compatible SIM card and network.

Tom
on 12/4/17, 11:26 PM

No, i'm not getting any AT commands to/from the modem. In the ATdebug example I am using, it says "Module does not respond! Check your serial wiring or check the module is correctly powered and turned on ". I know that the module is turned on as there is a blue blinking LED light.

AtliGunnar
on 12/5/17, 9:45 AM

Hi, can you share which hardware configuration you are using (switches inside the module, see manual) and the first lines of your code that has the modem configuration, then we can check, thanks

Tom
on 12/6/17, 12:40 AM

Hi, I am using IDC mode 2 that is given in the manual. This is my code, which I use from the GPRSwebclientTinyGSM_D21G_HardwareSerial1.ino example. I should not need a user or a password. // Select your modem: #define TINY_GSM_MODEM_SIM800 //#define TINY_GSM_MODEM_SIM900 //#define TINY_GSM_MODEM_A6 //#define TINY_GSM_MODEM_M590 #include const int pwr_pin = 6; // Your GPRS credentials // Leave empty, if missing user or pass const char apn[] = "internet"; const char user[] = ""; const char pass[] = ""; // Use Hardware Serial on Mega, Leonardo, Micro #define SerialAT Serial // or Software Serial on Uno, Nano //#include //SoftwareSerial SerialAT(2, 3); // RX, TX TinyGsm modem(SerialAT); TinyGsmClient client(modem); const char server[] = "cdn.rawgit.com"; const char resource[] = "/vshymanskyy/tinygsm/master/extras/logo.txt"; int port = 80; void setup() { //turn on modem with 1 second pulse on D6. pinMode(pwr_pin, OUTPUT); digitalWrite(pwr_pin, HIGH); delay(1000); digitalWrite(pwr_pin, LOW); Serial.print("HEllO"); // Set console baud rate SerialUSB.begin(115200); delay(10); // Set GSM module baud rate SerialAT.begin(115200); delay(3000); // Restart takes quite some time // To skip it, call init() instead of restart() SerialUSB.println(F("Initializing modem...")); modem.restart(); // Unlock your SIM card with a PIN //modem.simUnlock("1234"); }

AtliGunnar
on 12/6/17, 8:38 AM

Hi all,

My GPRS seems to work fine (initializes properly, card is detected, SIM takes the pin number, connects to network, everything peachy-rosy) but seems unable to send Short messages. By the way I did not even try to connect to GPRS for now. I just want to send an SMS.

My program instruction goes like this : FEM_ACTN[0] = modem.sendSMS(TCM_NSMS[0], TCM_DESC[51]);

where :

FEM_ACTN[0] is the result of the "modem.sendSMS" command (returns false every time)

TCM_NSMS[0] is a string : the number of the phone I want to send the message to (I tried +33[7 digits], +33[8 digits] and [8 digits] formats to no avail).

TCM_DESC[51] is the string that I want to send in the SMS, never exceeds 80 caracters.

And of course, nothing arrives on the other phone ...

The SIM card is from one of my phones. It has SMS and data capability, so I don't think this is the issue.

The CPU is a D21G, 1.6 version I use for development. I use Mode 1 configuration in the GPRS/GSM module. Nothing is connected to the RS485 port (that will come later).

Ideas, anyone ?

Didier, DG2R

Didier DORGUIN
Didier DORGUIN
172
| 4 1 3
Answered on 2/8/18, 6:09 PM
0
vote

Sorry, I didn't know it would come all in one text here is a better organized answer.

I am using IDC mode 2 that is given in the manual. This is my code, which I use from the GPRSwebclientTinyGSM_D21G_HardwareSerial1.ino example. I should not need a user or a password. 

// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_M590

#include <TinyGsmClient.h>

const int pwr_pin = 6;

// Your GPRS credentials
// Leave empty, if missing user or pass
const char apn[]  = "internet";
const char user[] = "";
const char pass[] = "";

// Use Hardware Serial on Mega, Leonardo, Micro
#define SerialAT Serial

// or Software Serial on Uno, Nano
//#include <SoftwareSerial.h>
//SoftwareSerial SerialAT(2, 3); // RX, TX

TinyGsm modem(SerialAT);
TinyGsmClient client(modem);

const char server[] = "cdn.rawgit.com";
const char resource[] = "/vshymanskyy/tinygsm/master/extras/logo.txt";

int port = 80;

void setup() {

  //turn on modem with 1 second pulse on D6. 
  pinMode(pwr_pin, OUTPUT);
  digitalWrite(pwr_pin, HIGH);
  delay(1000);
  digitalWrite(pwr_pin, LOW);

  Serial.print("HEllO");
  
  // Set console baud rate
  SerialUSB.begin(115200);
  delay(10);

  // Set GSM module baud rate
  SerialAT.begin(115200);
  delay(3000);

  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  SerialUSB.println(F("Initializing modem..."));
  modem.restart();

  // Unlock your SIM card with a PIN
  //modem.simUnlock("1234");
}

 

AtliGunnar
AtliGunnar
7
| 2 1 1
Answered on 12/6/17, 8:57 AM
0
vote

Hi, please remove the line Serial.print("HEllO"); With IDC mode 2 you should be using the example with 'Serial' not 'Serial1' https://github.com/Industruino/democode/blob/master/GPRSwebclientTinyGSM_D21G_HardwareSerial/GPRSwebclientTinyGSM_D21G_HardwareSerial.ino But the code above looks fine, it has 'Serial' You have to keep in mind that the power button switches on OR off, so if your modem was on and you run the program, it will switch it off and the program will fail. Also, you need to power the INDIO via Vin with at least 8V. If still no luck, try with the IDC mode 1 (change 2 hardware switches on the board), and example for Serial1.

Tom
on 12/7/17, 1:48 AM

Hi, Tom. Thanks for this! It worked as soon as I uploaded an empty sketch, unplugged the INDIO, changed to IDC mode 1 and then powered it on again and uploaded the example for Serial1. I assume the problem was that I didn't know that the power button switches the device off aswell.

AtliGunnar
on 12/7/17, 8:53 AM

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

42 follower(s)

Stats

Asked: 11/30/17, 2:18 PM
Seen: 4298 times
Last updated: 2/9/18, 8:04 AM