Modem: SIM800L
Main processor board: WEMOS D1 Mini (ESP8266)
TinyGSM version: 0.11.7
Code:
#define TINY_GSM_MODEM_SIM800
#include <TinyGsmClient.h>
#include <Firebase_ESP_Client.h>
#include <Ultrasonic.h>
#include <SoftwareSerial.h>
// Provide the token generation process info.
#include "addons/TokenHelper.h"
// Provide the RTDB payload printing info and other helper functions.
#include "addons/RTDBHelper.h"
// Pin configuratuin for Ultrasonic Sensor
#define TRIG_PIN D2
#define ECHO_PIN D1
float distance = 0;
Ultrasonic ultrasonic(TRIG_PIN, ECHO_PIN);
// Var for voltage metter
int voltageValue;
float voltage;
// Insert Firebase project API Key
#define API_KEY ""
// Insert RTDB URL
#define DATABASE_URL ""
// Define Firebase Data object
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
// Pin configuration for SIM800L
SoftwareSerial SIM800L_Serial(12, 13, false, 128);
// Your SIM card PIN
#define SIM_PIN ""
// APN settings for your mobile network provider
#define GPRS_APN "internet"
#define GPRS_LOGIN ""
#define GPRS_PASSWORD ""
TinyGsm modem(SIM800L_Serial);
//TinyGsmClient client(modem);
unsigned long sendDataPrevMillis = 0;
int count = 0;
bool signupOK = false;
void setup() {
Serial.begin(115200);
delay(10);
Serial.println("Started Serial");
SIM800L_Serial.begin(115200);
delay(3000); // Give SIM800L some time to initialize
Serial.println("Started SIM800L Serial");
// Unlock SIM card with PIN
modem.simUnlock(SIM_PIN);
}
void loop() {
distance = ultrasonic.read();
voltageValue = analogRead(A0);
voltage = voltageValue * (7.2 / 1023.0)*2;
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
Serial.print("Voltage: ");
Serial.print(voltage);
Serial.println(" V");
//Send data through GPRS (SIM800L)
sendDataThroughGPRS();
}
void sendDataThroughGPRS() {
Serial.println("Connecting to GPRS");
if (modem.gprsConnect(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)) {
Serial.println("Connected to GPRS");
}
}
Scenario, steps to reproduce
Arduino IDE - LOLIN(WEMOS) D1 R2 mini board
Serial speed 115200
SIM800L connection to Wemos D1 mini (SIM800L RX to D6 and TX to D7)
SIM800L powered by 2x 18650 3.7v batteries through a voltage regulator (5V)
Wemos D1 powered by USB
SIM800L is connected to network (status LED flashes every 3 seconds).
SIM PIN is disabled
Expected result
I want to make SIM800L works with ESP8266 and finally sent data to Firebase via GPRS.
Actual result
Sensor readings work and are displayed in SERIAL. When I try to call the "modem.gprsConnect(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)" function, I get an error "Soft WDT reset":
23:02:58.198 -> ��n�r��n|�l�lbbrl�nB�nl�rl�l��Started standard Serial
23:03:01.242 -> Started SIM800L Serial
23:03:01.242 -> Distance: 25.00 cm
23:03:01.242 -> Voltage: 6.97 V
23:03:01.242 -> Connecting to GPRS
23:03:03.111 ->
23:03:03.111 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
[x] Question or request for help
Modem: SIM800L Main processor board: WEMOS D1 Mini (ESP8266) TinyGSM version: 0.11.7 Code:
Scenario, steps to reproduce
Expected result
I want to make SIM800L works with ESP8266 and finally sent data to Firebase via GPRS.
Actual result
Sensor readings work and are displayed in SERIAL. When I try to call the "modem.gprsConnect(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)" function, I get an error "Soft WDT reset":
bbrl�nB�nl
�rl�l��Started standard SerialI tried to use yield(); and delay(0); but not success.