ESP32 + SIM7000G cellular field controller
An undocumented ESP32 field controller, moved from Wi-Fi to LTE-M by running its TCP/HTTP server on the cellular modem.
- LTE-Mcellular link on a SIM7000G
- TCP/HTTPserver running on the modem
Architecture · block diagram
- Main data path
- Logic
- Processor
- Memory
- Interconnect
- Off-chip
The story
A client had a field controller with a web dashboard over Wi-Fi, but some of the equipment is out of Wi-Fi range. The code came with no documentation. My job was to move the dashboard to cellular and keep it working the same way.
Challenges
With no documentation, my first step was to read the code and find out what it did. The SIM7000G takes AT commands, and the ESP32 side has no socket library. The equipment controller also uses its own binary UART protocol.
What I built
The web dashboard of the operator reaches the device over LTE-M. The SIM7000G runs a TCP/HTTP server on its own IP stack, which AT commands configure (CIPMUX, CIPSERVER, CIPSEND). The ESP32 talks to the modem over UART. An AT parser handles incoming +RECEIVE data and periodic link-status checks.
A command mapper turns dashboard commands (run, auto, manual, off, speed set-points) into binary UART frames for the equipment controller, and it drives the digital outputs. The dashboard and its files come from an SD card over SPI.
The hardest problem
With the server on the IP stack of the modem, the ESP32 never holds a socket. Requests arrive as AT responses and unsolicited +RECEIVE lines, and the parser must handle each one reliably. I added periodic link-status checks, a static-IP APN, DNS setup and an HTTPS client for outbound calls.
I brought the modem up from its serial AT logs, stage by stage: SIM, PDP context, network mode, registration and attach. I continued until it attached to the network reliably.
Result
The web control interface now runs over LTE-M, and the dashboard looks the same to the operator. Commands reach the equipment as binary UART frames, and the digital outputs respond. The codebase is now documented.
Where you'd find something like this
Remote pumps and motors
Agricultural and industrial equipment beyond Wi-Fi range
Related services