BLOG / ESP8266 / Send HTTP Requests Over LTE with A7670E …
Article de blog

Send HTTP Requests Over LTE with A7670E and ESP8266

Viktor Build ~3 min read

AT commands, APN setup, and a 12-step flow to get your ESP8266 online over 4G — no Wi-Fi needed.

// Voir sur YouTube

AT commands is the protocol you use to talk to cellular modules. It stands for attention commands — a standardised language that goes back to dial-up modems. The A7670E is a modern LTE module that speaks the same language. You send it a command over UART, it sends back a response. That's it.

This is about making a real HTTP GET request over a live SIM card, from an ESP8266, using nothing but AT commands typed in over serial. No libraries, no abstractions — just the raw flow.

Parts

  • ESP8266 (NodeMCU v2 or similar)
  • A7670E LTE module
  • SIM card with a data plan
  • A capacitor (recommended — the module can spike to 2A)
  • USB power + jumper wires

Wiring

You only need three wires between the ESP8266 and the module:

  • GND → GND
  • D5 (ESP RX) → A7670E TX
  • D6 (ESP TX) → A7670E RX

TX goes to RX and vice versa. Power from USB. If the SIM card is inserted, you'll see the module LED flash when it powers up. The capacitor goes across the power rail — the current draw can spike hard during network activity, and without it you'll get random resets.

Sketch

The sketch sets up a software serial port on D5/D6 at 9600 baud and bridges it to the hardware serial (USB). Type go into the monitor and it starts forwarding — everything you type goes to the module, everything the module replies comes back to you. Upload with:

pio init --board nodemcuv2
pio run -t upload && pio device monitor -b 9600

Full sketch is on GitHub — link in the description.

The HTTP flow

Once you're in the serial bridge, run these commands in order. Steps 1–7 set up the connection. Steps 8–12 are the actual HTTP request — you can repeat those for different URLs without redoing the setup.

  1. AT — ping the module. Should return OK. If it doesn't, check wiring and baud rate.
  2. AT+CPIN? — check SIM status. You want +CPIN: READY. Anything else means the card isn't seated properly.
  3. AT+CSQ — signal quality. The first number is 0–31. Anything 15 or above is usable. 99 means the module can't read signal yet.
  4. AT+CREG? — network registration. 0,1 means registered on the home network. 0,5 is roaming. 0,3 is denied — usually a carrier lock or no coverage.
  5. AT+CGATT=1 — attach to the packet data network. Think of it as turning on mobile data.
  6. AT+CGDCONT=1,"IP","internet" — set your APN. Replace internet with your carrier's APN. Croatian carriers: A1 uses internet, T-Com uses web.ht.hr, Tele2 uses internet.tele2.hr.
  7. AT+CGACT=1,1 — activate the data context. This is where the module connects to the carrier and gets an IP. If this fails, the APN is wrong or there's no data on the SIM.
  8. AT+HTTPINIT — start an HTTP session. If you get ERROR, a previous session is still open — run AT+HTTPTERM first.
  9. AT+HTTPPARA="URL","http://httpbin.org/ip" — set the URL.
  10. AT+HTTPACTION=0 — execute a GET request. You get OK immediately, then a few seconds later: +HTTPACTION: 0,200,31. That's method, HTTP status, and response byte count.
  11. AT+HTTPREAD=0,31 — read the response body. Use the byte count from the previous step. You'll get back the raw response — in this case your public IP in JSON.
  12. AT+HTTPTERM — close the session. Always do this. If you skip it, the next AT+HTTPINIT will fail.

That's the whole flow. A complete reference of all A7670E commands — including SMS, MQTT, GPS, and HTTPS — is linked in the description.

If something doesn't work, the most common issues are: wrong APN, SIM with no data plan, or a power supply that can't handle the current spikes. If you get it working or hit a weird error, come share it in the Discord — link's below.

Rejoins la communauté sur Discord

Pose des questions, partage tes projets et discute avec d'autres makers.

Rejoindre Discord — c'est gratuit

Ce tutoriel t'a plu ?

Soutiens la chaîne sur Patreon et accède en avant-première aux projets, build logs et plus encore.

Soutenir sur Patreon →