I have a very simple project which uses TTGO T-Call ESP32 with SIM800L GPRS Module and RDM6300 RFID Module.
const char apn[] = "..."; // APN (example: internet.vodafone.pt) use https://wiki.apnchanger.org
const char gprsUser[] = "..."; // GPRS User
const char gprsPass[] = "..."; // GPRS Password
// SIM card PIN (leave empty, if not defined)
const char simPIN[] = "0000";
// TTGO T-Call pins
#define MODEM_RST 5
#define MODEM_PWKEY 4
#define MODEM_POWER_ON 23
#define MODEM_TX 27
#define MODEM_RX 26
// Set serial for debug console (to Serial Monitor, default speed 115200)
#define SerialMon Serial
// Set serial for AT commands (to SIM800 module)
#define SerialAT Serial1
// Configure TinyGSM library
#define TINY_GSM_MODEM_SIM800 // Modem is SIM800
#define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb
#include <TinyGsmClient.h>
TinyGsm modem(SerialAT);
// TinyGSM Client for Internet connection
TinyGsmClient client(modem);
void connectToApn(){
SerialMon.println("Connecting to: internet.vivacom.bg ... ");
while(!modem.gprsConnect(apn, gprsUser, gprsPass))
delay(500);
SerialMon.println("Successfully connected to: internet.vivacom.bg");
}
#define USERNAME "peepnee"
#define DEVICE_ID "vhR4bfqyo9Uqn2ONbgPv"
#define DEVICE_CREDENTIAL "n82Q94%MD5X%HQ0v"
#include <ThingerTinyGSM.h>
ThingerTinyGSM thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL, Serial1);
#include <rdm6300.h>
#define RFID_ESP8266_PIN 34
Rdm6300 rdm6300;
void setup() {
// Set serial monitor debugging window baud rate to 115200
SerialMon.begin(115200);
// Set modem reset, enable, power pins
pinMode(MODEM_PWKEY, OUTPUT);
pinMode(MODEM_RST, OUTPUT);
pinMode(MODEM_POWER_ON, OUTPUT);
digitalWrite(MODEM_PWKEY, LOW);
digitalWrite(MODEM_RST, HIGH);
digitalWrite(MODEM_POWER_ON, HIGH);
// Set GSM module baud rate and UART pins
SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
delay(3000);
SerialMon.println("Initializing modem...");
modem.init();
// Unlock your SIM card with a PIN if needed
if (strlen(simPIN) && modem.getSimStatus() != 3 ) {
modem.simUnlock(simPIN);
}
connectToApn();
// rdm6300.begin(RFID_ESP8266_PIN);
}
void loop() {
thing.handle();
// RFID TAG WAS SCANNED
if (rdm6300.get_new_tag_id()){
SerialMon.println("TAG WAS SCANNED!!!!");
SerialMon.println(rdm6300.get_tag_id(), HEX);
SerialMon.println("Wohooo!!!!");
}
//SerialMon.println("\n ~~~~~~Working~~~~~ \n");
}
If I run the above code in the controller - it works well and it connects both to GPRS internet and thinger’s IoT platform. But, if I uncomment this line 77:
// rdm6300.begin(RFID_ESP8266_PIN);
It gets connected to the Internet but can not connect to the Thinger’s IoT platform where I host my devices. Interesting observation is that when I take a look at the frequency of the iterations of the loop changes when I have line 77 uncommented. For example, I get 5 iterations in 10 seconds but if I comment that - then I get 50-60 iterations in 10 seconds.
I also tried to position this initiation line at different places in the setup but this is what I get:
modem.init()
>>rdm6300.begin(RFID_ESP8266_PIN);
connectToApn()
=> Modem doesn't get initialized (not connected to GPRS internet)
>>rdm6300.begin(RFID_ESP8266_PIN);
modem.init()
connectToApn()
=> Modem doesn't get initialized (not connected to GPRS internet)
>>rdm6300.begin(RFID_ESP8266_PIN);
SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
modem.init()
connectToApn()
=> IS IT CONNECTED TO THINGER: YES, IS IT READING TAGS: NO