Démarrer
Câblage vers l’ESP32
| Broche du capteur | Broche ESP32 | Statut | Rôle |
|---|---|---|---|
| VCC | External 4V | Requis | Alimentation stable (PAS depuis ESP32 !) |
| GND | GND | Requis | Sol (partagé avec ESP32) |
| TXD | GPIO16 (RX2) | Requis | Module de transmission à la réception ESP32 |
| RXD | GPIO17 (TX2) | Requis | Module reçu de la transmission ESP32 |
| RST | GPIO5 | Optionnel | Réinitialiser le contrôle (facultatif) |
| NET | External Antenna | Requis | Connexion d'antenne GSM |

Code
Aucune bibliothèque à installer.
#include <Arduino.h>
// Define baud rate for Serial communication
#define SERIAL_BAUD 115200
#define SIM800_BAUD 9600 // SIM800L default baud rate
// Initialize Serial2 (UART2) on ESP32 (RX=16, TX=17)
HardwareSerial serial2(2);
void setup() {
// Initialize Serial Monitor
Serial.begin(SERIAL_BAUD);
delay(1000); // Small delay to stabilize serial
// Initialize SIM800L Serial (Serial2)
serial2.begin(SIM800_BAUD, SERIAL_8N1, 16, 17); // TX=17, RX=16
delay(1000);
Serial.println("
SIM800 EVB to ESP32 Serial port 2 test");
Serial.println("Sending AT commands to check communication...
");
// Send AT command and check response
sendATCommand("AT"); // Check if module is responding
sendATCommand("AT+CGMI"); // Get manufacturer name
sendATCommand("AT+CGMM"); // Get module model number
sendATCommand("AT+CGMR"); // Get firmware version
sendATCommand("AT+CGSN"); // Get serial number
}
void loop() {
// Read data from SIM800L and print to Serial Monitor
while (serial2.available() > 0) {
Serial.write(serial2.read());
}
// Read data from Serial Monitor and send to SIM800L
while (Serial.available() > 0) {
serial2.write(Serial.read());
}
}
// Function to send AT command and wait for response
void sendATCommand(const char *command) {
Serial.print("Sending: ");
Serial.println(command);
serial2.println(command); // Send command to SIM800L
delay(1000); // Wait for response
// Print response from SIM800L
while (serial2.available()) {
Serial.write(serial2.read());
}
Serial.println("----------------------");
}
Brochage
| Broche | Type | Description |
|---|---|---|
| VCC | Power | Entrée d'alimentation3,4 V à 4,4 V (PAS 5 V !) |
| GND | Power | Connexion à la terre |
| TXD | Communication | Transmission UARTEnvoie des données depuis le module (se connecte à ESP32 RX) |
| RXD | Communication | Réception UARTReçoit les commandes (se connecte à ESP32 TX) |
| RST | Control | Réinitialiser la brocheRéinitialisation basse active |
| NET | Control | Indicateur d'état du réseauPatin de connexion d'antenne externe |

Caractéristiques
Le SIM800L est un module de communication GSM/GPRS qui prend en charge la transmission vocale, SMS et données. Il est idéal pour les applications IoT nécessitant une connectivité sans fil sur les réseaux GSM quadri-bande.
Fonctionnalités
- Connectivité GSM quadri-bande – Fonctionne dans le monde entier sur les réseaux 850/900/1 800/1 900 MHz.
- Compact et faible consommation – Idéal pour les applications IoT alimentées par batterie.
- Communication polyvalente – Prend en charge les SMS, les appels vocaux et le transfert de données GPRS.
- Prêt pour Internet – Prise en charge intégrée de TCP/IP, HTTP, FTP et MMS pour la communication en ligne.
| Caractéristique | Valeur |
|---|---|
| SIM Card | Supports 1.8V and 3V SIM cards |
| Interface | UART (AT Command) |
| Dimensions | 15.8mm x 17.8mm x 2.4mm |
| Voltage Range | 3.4V to 4.4V |
| Frequency Bands | Quad-band 850/900/1800/1900MHz |
| Protocol Support | TCP/IP, HTTP, FTP, MMS |
| Temperature Range | -40°C to +85°C |
| Current Consumption (Sleep Mode) | 0.7mA |
