A feature-rich ESP32-based IoT gateway that combines WiFi, MQTT, GSM connectivity, and SMS/voice call capabilities. Built for the LilyGo T-Call A7670E board with the A7670 cellular modem.
- WiFi Connectivity: Easy setup via WiFiManager captive portal
- MQTT Communication: Bidirectional MQTT messaging with auto-reconnect
- GSM/LTE Modem: Full A7670 modem support via TinyGSM
- SMS Gateway: Send and receive SMS messages via MQTT commands
- Voice Calls: Make, receive, and manage voice calls remotely
- USSD Support: Query network information and balance
- Event Publishing: Real-time event notifications (calls, SMS) to MQTT
- NTP Time Sync: Automatic time synchronization
- mDNS Support: Device discovery on local network
Tested on: LilyGo T-Call A7670E
- Modem UART: TX=27, RX=26
- Modem Control: PWR=4, DTR=32, RESET=5, RING=33
- LED: GPIO 13
- PlatformIO (with Espressif32 platform v6.12.0)
- Python package
intelhex(for esptool):~/.platformio/penv/bin/pip install --upgrade intelhex
- TinyGSM (included in
lib/) - StreamDebugger v1.0.1
- WiFiManager v2.0.17
- ArduinoJson v7.3.0
Edit src/constants.h to configure:
#define NETWORK_APN "your-apn" // GSM APN
#define MQTT_SERVER "mqtt://your-server" // MQTT broker URL
#define MQTT_USER "username"
#define MQTT_PASSWORD "password"
#define MQTT_COMMAND_TOPIC "esp32/commands"
#define MQTT_EVENT_TOPIC "esp32/events"# Build
pio run
# Upload
pio run --target upload
# Monitor
pio device monitorSend JSON commands to control the device:
{
"action": "sms",
"number": "+491234567890",
"message": "Hello from IoT device!"
}{
"action": "call",
"number": "+491234567890"
}{
"action": "hangup"
}{
"action": "accept"
}{
"action": "ussd",
"code": "*100#"
}The device publishes events with ISO8601 timestamps:
{
"timestamp": "2025-11-03T10:15:30Z",
"mac": "AC1518B62E50",
"event": "call",
"number": "+491234567890"
}{
"timestamp": "2025-11-03T10:15:35Z",
"mac": "AC1518B62E50",
"event": "call_update",
"status": "ESTABLISHED"
}{
"timestamp": "2025-11-03T10:20:00Z",
"mac": "AC1518B62E50",
"event": "sms",
"message": "SMS content here"
}- WiFi Setup: Device creates AP
AutoConnectAPon first boot - Connect to AP and configure WiFi credentials
- Device connects to WiFi and MQTT broker
- Subscribe to command topic to control device
- MQTT Disconnect after SMS: Fixed by filtering URC messages (only read lines starting with
+) - esptool.py error: Requires
intelhexPython package with Espressif32 v6.12.0+
- Check broker URL, credentials, and network connectivity
- Monitor serial output for error messages (115200 baud)
- Verify SIM card is inserted and unlocked
- Check APN configuration for your carrier
- Ensure antenna is connected
# Clean and rebuild
pio run -t clean
pio runThis project uses TinyGSM library (Apache License 2.0). See individual library licenses in lib/ directory.
Issues and pull requests are welcome!
Created for IoT gateway applications with ESP32 and cellular connectivity.