Hi. I am trying to connect my Arduino Uno through the ArduinoTinyGsm library following the steps described in the documentation but I can not make that connection. I have edited the code of the library in order to adapt it to my Shield (sim900):
Hi @patric74, please, enable the debug output from the sketch to see what is happening. And make sure the board can talk with the SiM900 in the selected pins and baudrate. You may try first a simple sketch sending some AT commands and looking to responses…
You can check too the status of the led, if it has one, I don’t know this modem, I’ve used the SIM800, and the blink of the led, says a lot of information (if it is connected to mobile network, if is negotiating, if it is in data mode… etc), so is a good indicator, and of course try to connect with simple sketch, in order to verify that the modem is working ok, have enough signal, data coverage, etc…
In the manual you will find AT commands, so I recommend you look for ones to check signal power, and status of the modem.
I am using a gsm sim900 which also carries a led. In principle this works correctly since the LED blinks when connected so I will review the steps related to programming through the sketches you mentioned and referred. I will comment on the results obtained. Thank you.
Hello. I have activated the debug and this is the result obtained through the serial monitor:
[NETWORK] Starting connection…
[NETWORK] Network Status: 4
[NETWORK] Restarting Modem…
[NETWORK] Waiting for Network…
[NETWORK] Network Connected!
[NETWORK] Connecting to APN…
[NETWORK] Cannot connect to APN!
[NETWORK] Cannot connect!
[NETWORK] Starting connection…
[NETWORK] Network Status: 1
[NETWORK] Connecting to APN…
[NETWORK] Cannot connect to APN!
[NETWORK] Cannot connect!
…
…and does not respond.
This is the code I am using:
// Select your modem:
//#define TINY_GSM_MODEM_SIM800
#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_M590
// uncomment line for debug
#define _DEBUG_
// Can be installed from Library Manager or https://github.com/vshymanskyy/TinyGSM
#include <TinyGsmClient.h>
#include <ThingerTinyGSM.h>
// Emulate Serial1 on pins 10/11 if HW is not present (use interrupt pin in RX for better performance)
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(2, 3); // RX, TX
#endif
#define USERNAME "usuario"
#define DEVICE_ID "device"
#define DEVICE_CREDENTIAL "credencial"
// use your own APN config
#define APN_NAME "servidor.es"
#define APN_USER "servidor"
#define APN_PSWD "servidor"
// set your cad pin (optional)
//#define CARD_PIN ""
ThingerTinyGSM thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1);
void setup() {
// uncomment line for debug
Serial.begin(9600);
// Serial for AT commands (can be higher with HW Serial, or even lower in SW Serial)
Serial1.begin(9600);
// set APN (you can remove user and password from call if your apn does not require them)
thing.setAPN(APN_NAME, APN_USER, APN_PSWD);
// set PIN (optional)
// thing.setPin(CARD_PIN);
// resource input example (i.e, controlling a digitalPin);
pinMode(13, OUTPUT);
thing["led"] << digitalPin(13);
// resource output example (i.e. reading a sensor value)
thing["millis"] >> outputValue(millis());
// more details at http://docs.thinger.io/arduino/
}
void loop() {
thing.handle();
}
is the one you set in your sketch? Notice that even the APN is correct, GSM modems can be somehow sensible to power supplies, or antennas. I have a SIM800 working with an Arduino Nano, but I have to set an external antenna as the wire provided in the board was not enough.
It is currently the only one I use. Also use a power supply to supply the power supplied by the connection to the laptop and an antenna. I will review the parameters and comment on the result.
Can you post a picture of your board? Did you tried to use it before to connect to the internet? I think it is better to start with a simple sketch to be sure that everything in the hardware side it is correct. In the TinyGSM library used by Thinger, there are some good hints:
Used repeatedly and worked correctly. It is true that the TinyGSM library I am using I have inserted from the library manager of Arduino Ide and may not have been installed correctly. I will do it manually through the shared link. Thank you very much and comment results.
If this is your shield, it is using the Quectel M10 modem, which is not compatible with SIM900 nor TinyGSM library. This board is directly compatible with the Arduino Library, so I think I can adapt it to connect to thinger.
It would be great to be able to adapt it to work with Thinger.
In this regard, i was able to perform the diagnostics referred to in the TinyGSM (Diagnostico) library and I get:
Initializing modem…AT
OK
AT+CFUN=0
+CPIN: NOT READY
OK
AT+CFUN=1,1
OK
AT
AT
OK
AT&FZE0
AT&FZE0
OK
AT+CPIN?
+CPIN: READY
OK
Waiting for network…AT+CREG?
+CREG: 0,2
OK
AT+CREG?
+CREG: 0,2
OK
AT+CREG?
Call Ready
+CREG: 0,2
OK
AT+CREG?
+CREG: 0,2
OK
AT+CREG?
+CREG: 0,2
OK
AT+CREG?
+CREG: 0,1
OK
OK
Connecting to movistar.esAT+CIPSHUT
+CME ERROR: 100
AT+SAPBR=3,1,“Contype”,“GPRS”
+CME ERROR: 100
AT+SAPBR=3,1,“APN”,“movistar.es”
+CME ERROR: 100
AT+SAPBR=3,1,“USER”,“MOVISTAR”
+CME ERROR: 100
AT+SAPBR=3,1,“PWD”,“MOVISTAR”
+CME ERROR: 100
AT+CGDCONT=1,“IP”,“movistar.es”
,following the GSM error list, that error (CME ERROR: 100) is ‘Unknown error’ and I have not been able to find references on how to solve it. Thank you very much.