#include <HardwareSerial.h>
HardwareSerial sim800(1); // UART1
#define RXD2 16 // ESP32 RX ← SIM800 TX
#define TXD2 17 // ESP32 TX → SIM800 RX
unsigned long lastCheck = 0;
void setup() {
Serial.begin(115200);
sim800.begin(9600, SERIAL_8N1, RXD2, TXD2);
Serial.println("SIM800 Communication Test Started");
}
void loop() {
// Auto send AT every 3 sec
if (millis() - lastCheck > 3000) {
Serial.println("Sending: AT");
sim800.println("AT");
lastCheck = millis();
}
// Read from SIM800 → Serial Monitor
while (sim800.available()) {
char c = sim800.read();
Serial.write(c);
}
// Send from Serial Monitor → SIM800
while (Serial.available()) {
char c = Serial.read();
sim800.write(c);
}
}
but i am not getting any response from the SIM800L module. I am using a dedicated 5V 2A external power supply for it and ESP32 is powered by USB, and have common GND. Why am I not receiving anything.
16:14:27.437 -> Sending: AT
16:14:30.442 -> Sending: AT
16:14:33.446 -> Sending: AT
16:14:36.420 -> Sending: AT
16:14:39.449 -> Sending: AT
16:14:42.461 -> Sending: AT
16:14:45.424 -> Sending: AT
16:14:48.435 -> Sending: AT
16:14:51.455 -> Sending: AT
// // 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(115200);
delay(3000);
//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
at
OK
at+cgmi
SIMCOM_Ltd
OK
at+cgmm
SIMCOM_SIM800L
OK
at+cgmr
Revision:1418B05SIM800L24
OK