Gsm sim800l esp32


hi
I am having problems with the GSM SIM800L module, I want to use this GSM SIM800L module as a replacement for WiFi so that the data I send can be input to IFTTT. but the program I created doesn't run and doesn't even appear on the serial monitor. Using a SIM CARD is also appropriate and can still be used, but when using the GSM SIM8000L module it cannot run. what's the solution?

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <SoftwareSerial.h>

#define SIM800_TX_PIN 27
#define SIM800_RX_PIN 26

SoftwareSerial SIM800(SIM800_TX_PIN, SIM800_RX_PIN);

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme; // I2C

const char* IFTTT_API_KEY = "dUAMY_6tEaE9doYwCO0gl2OVmUL-bu4IjVilYf25L24";

void setup() {
  Serial.begin(9600);
  SIM800.begin(9600);

  if (!bme.begin()) {
    Serial.println("Could not find BME280 sensor, check wiring!");
    while (1);
  }

  delay(5000);

  connectGPRS();
}

void loop() {
  float temperature = bme.readTemperature();
  float humidity = bme.readHumidity();
  float pressure = bme.readPressure() / 100.0F;

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" °C");

  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println(" %");

  Serial.print("Pressure: ");
  Serial.print(pressure);
  Serial.println(" hPa");

  sendToIFTTT(temperature, humidity, pressure);

  delay(60000); // Wait for 1 minute before sending data again
}

void connectGPRS() {
  Serial.println("Connecting to GPRS...");
  SIM800.println("AT+SAPBR=3,1,\"Contype\",\"GPRS\"");
  delay(1000);
  SIM800.println("AT+SAPBR=3,1,\"APN\",\"indosatgprs\"");
  delay(1000);
  SIM800.println("AT+SAPBR=1,1");
  delay(5000); // Wait for GPRS connection
  Serial.println("Connected to GPRS");
}

void sendToIFTTT(float temp, float humidity, float pressure) {
  String url = "https://maker.ifttt.com/trigger/GSM_COBA/with/key/dUAMY_6tEaE9doYwCO0gl2OVmUL-bu4IjVilYf25L24";
  url += IFTTT_API_KEY;
  url += "?value1=";
  url += String(temp);
  url += "&value2=";
  url += String(humidity);
  url += "&value3=";
  url += String(pressure);

  Serial.print("Sending data to IFTTT: ");
  Serial.println(url);

  SIM800.println("AT+HTTPINIT");
  delay(2000);
  SIM800.println("AT+HTTPPARA=\"CID\",1");
  delay(2000);
  SIM800.print("AT+HTTPPARA=\"URL\",\"");
  SIM800.print(url);
  SIM800.println("\"");
  delay(2000);
  SIM800.println("AT+HTTPACTION=0");
  delay(10000); // Delay to ensure request is processed
  SIM800.println("AT+HTTPTERM");
}
1 Like

Please do not post in Uncategorized; see the sticky topics in https://forum.arduino.cc/c/using-arduino/uncategorized/184.

Topic has been moved.

The first step towards a solution spells: Schematics.

why are you using softwareserial on an ESP32 which has hardware serial ports?
try this code

// // SIM800L EVB ESP32 test using Serial2 (pins 16 Rx  and 17 Tx)

// connect so
// SIM800 5V to ESP32 5V
// SIM800 GND to ESP32 GND
// SIM800 VDD to ESP32 3.3v
// SIM80 TXD to ESP32 pin 16 Rx
// SIM800 TXD to ESP32 pin 17 tx

// AT+CGMI  returns the manufacturer's name
// AT+CGMM returns the MODEM model number
// AT+CGMR returns details of the software and model revision level
// AT+CGSN returns the MODEM's serial number

#include <Arduino.h>

// ESP32 example using HardwareSerial library to access Serial port 2 (pins 16 and 17)
// from https://programming.vip/docs/esp32-use-of-hardwareserial-library.html

#define SERIAL_BAUD 115200

HardwareSerial serial2(2);//Serial port 2

int distance = 0;

void setup() {
  //Initialize serial port 0
  Serial.begin(SERIAL_BAUD);
  //Initialize serial port 2
  serial2.begin(SERIAL_BAUD, SERIAL_8N1);
  Serial.println("\nSIM800 EVB to ESP32 Serial port 2 test");
}

void loop() {
  while (serial2.available() > 0) {
    uint8_t byteFromSerial = serial2.read();
    Serial.write(byteFromSerial);
  }
  while (Serial.available() > 0) {
    uint8_t byteFromSerial1 = Serial.read();
    serial2.write(byteFromSerial1);
  }
}

serial monitor output in response to AT commands

SIM800 EVB to ESP32 Serial port 2 test
at
OK
at+cgmi
SIMCOM_Ltd
OK
at+cgmm
SIMCOM_SIM800L
OK
at+cgmr
Revision:1418B05SIM800L24
OK
1 Like

how to checking connection internet sir?

do AT commands work?
e.g. AT+CCID should give the SIM ID number
AT+CSQ gives the signal quality

if AT commands work OK what does the serial monitor display when you run your code?

do AT commands it's work, cause Serial monitor displays the SMS ready and call ready commands (this picture). how about connect to internet, i don't understand this problem

what do you wish to do? try a web search for a topic, e.g. sim800l http get will give plenty of links

avoid posting screen images of text - they take a lot of storage and are difficult to read
post text using code tags </>

1 Like

okeyy, i will try it. thankyou sir

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.