27 Cellular IoT Practical Knowledge
Key Concepts
- AT+CEREG: AT command for checking NB-IoT/LTE-M network registration status; response +CEREG:
where stat=1 means registered home, stat=5 means registered roaming - AT+CSQ: Signal quality query returning RSSI (0–31 scale, 99=unknown) and BER; map to dBm: RSSI=-113+2×value; readings <10 indicate poor signal conditions
- SARA-R4/SARA-R5: u-blox cellular IoT modules for NB-IoT/LTE-M respectively; used in production IoT devices with USB/UART AT command interface
- Quectel BG96: Multi-technology cellular module supporting LTE-M, NB-IoT, EGPRS, and integrated GNSS; widely used for asset tracking and cellular IoT development
- Network Registration States: 0=not registered searching, 1=registered home, 2=not registered but searching, 3=registration denied, 5=registered roaming — critical states for application logic
- OTDOA (Observed Time Difference of Arrival): LTE positioning method using timing measurements from multiple base stations; achieves 50–200 m accuracy without GPS for asset tracking
- AT+QCFG: Quectel extended configuration command for setting RAT (Radio Access Technology) preference, band selection, and operating mode; critical for network optimization
- Current Measurement Validation: Verify PSM operation by measuring quiescent current with µA-resolution ammeter; NB-IoT PSM should show <5 µA; any higher indicates PSM failed to activate
For Beginners: Hands-On Cellular IoT
This chapter provides practical knowledge for working with cellular IoT modules:
- AT Commands: The standard way to control cellular modems
- Troubleshooting: How to diagnose and fix common connectivity issues
- Module Selection: Choosing the right hardware for your project
- Real-World Scenarios: Practice exercises based on actual deployment challenges
Work through the examples and quizzes to build confidence before your first deployment.
Sensor Squad: The AT Command Toolkit
“AT commands are how you talk to a cellular modem,” explained Max the Microcontroller, typing on a serial terminal. “Every command starts with AT – short for Attention. Then you add specific instructions. It is like texting the modem and getting text messages back.”
Sammy the Sensor watched the screen. “What are the most important commands?” Max listed them. “AT+CEREG tells you if the device has registered with the network. AT+CSQ shows signal strength. AT+CGDCONT sets up the data connection. And AT+COPS lets you pick which carrier to use. These four commands solve 80 percent of connectivity problems.”
“Module selection matters too,” added Lila the LED. “The SIM7020 is great for NB-IoT only – small, cheap, low power. The SIM7070 handles both NB-IoT and LTE-M, giving you flexibility. And the Quectel BG96 is the Swiss army knife – it does NB-IoT, LTE-M, and even has a GPS receiver built in.”
Bella the Battery shared troubleshooting wisdom. “When things do not work, check in order: Is the SIM card activated? Is the antenna connected? Is the signal strong enough? Is the APN configured correctly? These four checks solve 90 percent of problems. Do not start debugging your code until the hardware basics check out.”
27.1 Learning Objectives
By the end of this chapter, you will be able to:
- Execute AT Commands: Construct and interpret AT command sequences for network registration, signal measurement, and PDP context activation
- Diagnose Connectivity Failures: Apply a systematic troubleshooting workflow to resolve registration, PDP context, and signal quality issues
- Justify Module Selection: Evaluate cellular modules (SIM7020, SIM7000G, BG96, SIM7600) against project requirements including mobility, power budget, and data rate
- Interpret Signal Metrics: Convert CSQ values to RSSI in dBm and assess link margin for NB-IoT/LTE-M deployments
- Contrast Technology Trade-offs: Analyze cost, coverage, and infrastructure differences between cellular IoT and LoRaWAN for specific deployment scenarios
27.2 Prerequisites
Required Chapters:
- Cellular IoT Technology Selection - Technology comparison
- Cellular IoT Power and Cost Optimization - PSM, eDRX, and cost analysis
Technical Background:
- Basic understanding of NB-IoT and LTE-M
- Familiarity with serial communication
- Understanding of IP networking basics
Estimated Time: 30 minutes
27.3 AT Commands Reference
AT (Attention) commands are the standard interface for controlling cellular modules.
27.3.1 Essential AT Commands
| Command | Description | Example Response |
|---|---|---|
AT |
Test communication | OK |
AT+CREG? |
Network registration status | +CREG: 0,1 (registered) |
AT+CSQ |
Signal quality | +CSQ: 18,99 (good signal) |
AT+CGDCONT |
Define PDP context (APN) | OK |
AT+CGACT |
Activate PDP context | OK |
AT+CGPADDR |
Show IP address | +CGPADDR: 1,"10.0.0.1" |
AT+CPSMS |
Configure PSM | OK |
AT+CEDRXS |
Configure eDRX | OK |
AT+CNMP |
Set network mode | OK |
AT+CMNB |
Set NB-IoT/LTE-M mode | OK |
27.3.2 Network Registration Status (+CREG)
The second value in +CREG: 0,X indicates registration status:
| Value | Meaning |
|---|---|
| 0 | Not registered, not searching |
| 1 | Registered, home network |
| 2 | Not registered, searching |
| 3 | Registration denied |
| 4 | Unknown |
| 5 | Registered, roaming |
27.3.3 Signal Quality (+CSQ)
The first value (0-31) maps to RSSI:
| CSQ Value | RSSI (dBm) | Quality |
|---|---|---|
| 0-1 | < -111 | No signal |
| 2-9 | -109 to -95 | Marginal |
| 10-14 | -93 to -85 | OK |
| 15-19 | -83 to -75 | Good |
| 20-31 | > -73 | Excellent |
| 99 | Unknown | Error |
Formula: RSSI (dBm) = -113 + (2 × CSQ value)
Putting Numbers to It
Let’s calculate signal quality from AT+CSQ readings. If your module returns +CSQ: 18,99, the first number maps to RSSI using the formula:
\[\text{RSSI (dBm)} = -113 + (2 \times \text{CSQ value})\]
For CSQ = 18: \[\text{RSSI} = -113 + (2 \times 18) = -113 + 36 = -77 \text{ dBm}\]
This is good signal quality (15-19 range). For comparison: - CSQ = 10 → RSSI = -93 dBm (marginal for NB-IoT) - CSQ = 25 → RSSI = -63 dBm (excellent)
The link budget tells us if communication succeeds. With RSRP = -77 dBm and NB-IoT sensitivity of -141 dBm (CE Level 2), the link margin is:
\[\text{Margin} = -77 - (-141) = 64 \text{ dB}\]
This 64 dB margin means the device can tolerate 64 dB of additional path loss (walls, distance) before losing connectivity. Since each concrete wall adds ~20 dB loss, this signal can penetrate 3 walls reliably.
27.3.4 Basic Connection Sequence
// 1. Test communication
sendAT("AT");
// Response: OK
// 2. Check SIM status
sendAT("AT+CPIN?");
// Response: +CPIN: READY
// 3. Check network registration
sendAT("AT+CREG?");
// Response: +CREG: 0,1 (registered)
// 4. Check signal quality
sendAT("AT+CSQ");
// Response: +CSQ: 18,99 (good signal, -77 dBm)
// 5. Configure APN
sendAT("AT+CGDCONT=1,\"IP\",\"iot.1nce.net\"");
// Response: OK
// 6. Attach to GPRS
sendAT("AT+CGATT=1");
// Response: OK
// 7. Activate PDP context
sendAT("AT+CGACT=1,1");
// Response: OK
// 8. Get IP address
sendAT("AT+CGPADDR=1");
// Response: +CGPADDR: 1,"10.0.0.123"27.3.5 LTE-M Fleet Tracker Configuration
void configureLTEMTracker() {
// Set LTE-only mode
sendAT("AT+CNMP=38");
delay(1000);
// Select Cat-M1 (LTE-M)
sendAT("AT+CMNB=1");
delay(1000);
// Automatic operator selection (for handover)
sendAT("AT+COPS=0");
delay(1000);
// Configure APN
sendAT("AT+CGDCONT=1,\"IP\",\"iot.carrier.com\"");
delay(1000);
// Enable eDRX for battery backup (not PSM due to frequent updates)
sendAT("AT+CEDRXS=1,4,\"0101\""); // Wake every 81.92s
delay(1000);
Serial.println("LTE-M tracker configured:");
Serial.println("- Mode: LTE-M (Cat-M1) with handover support");
Serial.println("- Power: eDRX enabled for battery backup");
}27.4 Troubleshooting Common Issues
27.4.1 Issue 1: Network Registration Fails
Symptom: +CREG: 0,0 or +CREG: 0,2 (not registered)
Diagnostic Steps:
// Check signal
sendAT("AT+CSQ");
// If CSQ < 10: Signal too weak
// Check SIM
sendAT("AT+CPIN?");
// If not "READY": SIM issue
// Check operator
sendAT("AT+COPS=?");
// Lists available networks
// Force registration
sendAT("AT+COPS=1,2,\"310410\""); // Example: AT&TSolutions:
- Improve antenna placement (near window)
- Add external antenna (3-5 dBi gain)
- Check SIM activation with carrier
- Verify NB-IoT/LTE-M coverage in area
27.4.2 Issue 2: PDP Context Activation Fails
Symptom: Module registers (+CREG: 0,1) but HTTP/MQTT fails with timeout
Diagnostic Steps:
// Check PDP context
sendAT("AT+CGDCONT?");
// Should show configured APN
// Check IP address
sendAT("AT+CGPADDR=1");
// If empty: PDP not activated
// Check attachment
sendAT("AT+CGATT?");
// Should be +CGATT: 1Solutions:
// Correct sequence:
sendAT("AT+CGDCONT=1,\"IP\",\"YOUR_APN\""); // Configure APN
sendAT("AT+CGATT=1"); // Attach to GPRS
sendAT("AT+CGACT=1,1"); // Activate PDP contextCommon APNs:
| Provider | APN |
|---|---|
| 1NCE | iot.1nce.net |
| Hologram | hologram |
| Twilio | wireless.twilio.com |
| Soracom | soracom.io |
27.4.3 Issue 3: Poor Signal Quality
Symptom: CSQ < 10 (marginal signal), frequent disconnections
Solutions:
- Add external antenna: 3-5 dBi gain improves signal by +3-5 dB
- Relocate device: Move closer to window (indoor attenuation 10-30 dB)
- Check carrier coverage: Use carrier coverage maps
- Try different carrier: Dual-SIM modules can switch carriers
RSRP Thresholds for NB-IoT/LTE-M:
| RSRP (dBm) | Quality | Action |
|---|---|---|
| > -80 | Excellent | Optimal |
| -80 to -100 | Good | Acceptable |
| -100 to -110 | Fair | Consider antenna |
| -110 to -120 | Marginal | External antenna needed |
| < -120 | Poor | Relocate device |
27.5 Module Selection Guide
27.5.1 Recommended Modules by Use Case
| Use Case | Module | Technology | Key Features |
|---|---|---|---|
| Smart Meters | SIM7020 | NB-IoT | Ultra-low power, deep coverage |
| Asset Tracking | SIM7000G | LTE-M + GPS | Global bands, mobility |
| Fleet Management | BG96 | LTE-M/NB-IoT + GPS | Dual-mode, global |
| Video Surveillance | SIM7600 | 4G LTE | High bandwidth |
| Industrial Gateway | RM500Q | 5G | Multi-Gbps, ultra-low latency |
27.5.2 Module Comparison Table
| Feature | SIM7020 | SIM7000G | BG96 | SIM7600 |
|---|---|---|---|---|
| Technology | NB-IoT | LTE-M/NB-IoT | LTE-M/NB-IoT | 4G LTE |
| Data Rate | 127 kbps | 375 kbps | 375 kbps | 10 Mbps |
| PSM Sleep | 3 µA | 7 µA | 5 µA | N/A |
| GPS | No | Yes | Yes | Yes |
| Price | $8-12 | $15-20 | $20-25 | $35-45 |
| Best For | Static sensors | Mobile tracking | Dual-mode | High BW |
27.6 Practical Exercises
27.6.1 Exercise 1: Mobile Fleet Tracking Scenario
Scenario: A logistics company needs to track 500 delivery vehicles across the country, reporting location and diagnostics every 5 minutes while vehicles move at highway speeds (60-120 km/h).
Requirements Analysis:
| Requirement | NB-IoT | LTE-M | Decision |
|---|---|---|---|
| Mobility (60-120 km/h) | No handover | Full handover (160 km/h) | LTE-M |
| 5-min GPS updates | OK | OK | Either |
| Firmware OTA (200 KB) | 6.4s (250 kbps) | 1.6s (1 Mbps) | LTE-M |
| Real-time alerts | 1.6-10s latency | 10-15 ms latency | LTE-M |
Conclusion: LTE-M is required for mobile applications with handover support.
Implementation:
// LTE-M configuration for fleet tracker
sendAT("AT+CNMP=38"); // LTE-only mode
sendAT("AT+CMNB=1"); // Cat-M1 (LTE-M)
sendAT("AT+COPS=0"); // Automatic operator selection (for handover)
sendAT("AT+CGDCONT=1,\"IP\",\"iot.carrier.com\""); // APN
sendAT("AT+CEDRXS=1,4,\"0101\""); // Wake every 81.92s for battery backup27.6.2 Exercise 2: Cellular vs LoRaWAN Comparison
Scenario: Smart parking deployment (1,000 sensors, report every 5 minutes, 10-year battery life)
Cost Analysis:
| Factor | Cellular (NB-IoT) | LoRaWAN |
|---|---|---|
| Module | $10 | $15 |
| SIM/Activation | $5 | $0 |
| Data Plan (10 yr) | $10-100 | $0 |
| Gateway | N/A | $500 shared |
| Per Device | $25-115 | $16-17 |
| 1,000 Devices | $25K-115K | $16K-22K |
Battery Life:
| Technology | PSM Sleep | Battery Life |
|---|---|---|
| NB-IoT | 10 µA | 10+ years |
| LoRa | 1-2 µA | 10+ years |
Conclusion: LoRaWAN is 2-5x cheaper for localized deployments where gateways can be installed. Cellular wins for global coverage and no gateway infrastructure.
27.7 Knowledge Check
27.8 Visual Reference Gallery
AI-Generated Figures: Cellular IoT Technologies
These AI-generated SVG figures provide alternative visual representations of cellular IoT concepts covered in this chapter.
Cellular IoT Technology Comparison
Cellular Handoff Process
IoT Cellular Modem Architecture
Cellular IoT Evolution
Worked Example: Troubleshooting NB-IoT Connection Failure in Underground Parking
Scenario: A smart parking deployment uses 200 NB-IoT sensors in an underground parking garage (2 levels below ground). 45% of sensors fail to connect, showing AT+CEREG? → +CEREG: 0,2 (searching but not registered). You need to diagnose and fix the issue within 48 hours before the client cancels the contract.
Step 1: Collect diagnostic data from working vs non-working sensors
Working sensor (surface level):
AT+CSQ
+CSQ: 18,99 // RSSI = -113 + (2 × 18) = -77 dBm (good)
AT+CEREG?
+CEREG: 0,1 // Registered on home network
AT+COPS?
+COPS: 0,2,"310410",9 // AT&T, LTE-M/NB-IoT mode
Non-working sensor (underground level B2):
AT+CSQ
+CSQ: 6,99 // RSSI = -113 + (2 × 6) = -101 dBm (marginal)
AT+CEREG?
+CEREG: 0,2 // Searching, not registered
AT+COPS=? // Scan for networks (takes 3 minutes)
+COPS: (2,"AT&T","AT&T","310410",9) // Network visible but weak
Analysis: CSQ=6 (-101 dBm) is below NB-IoT’s typical registration threshold (-100 dBm for normal coverage). Underground sensors need coverage enhancement.
Step 2: Enable NB-IoT Coverage Enhancement Mode
Configure sensors for extended coverage (CE mode):
// Force NB-IoT and enable all coverage levels
AT+NCONFIG="CELL_RESELECTION",0 // Disable cell reselection
AT+NCONFIG="CR_0354_0338_SCRAMBLING",TRUE // Enable coverage enhancement
AT+NCONFIG="CR_0859_SI_AVOID",FALSE // Disable system info reduction
AT+CFUN=1,1 // Radio reset to apply changesAfter configuration:
AT+NUESTATS
Signal power: -105 dBm // Weaker than surface but now sufficient
Coverage Enhancement: 2 // CE Level 2 (max repetitions)
Uplink repetitions: 128×
Downlink repetitions: 2048×
TX time per message: ~12 seconds // vs 2 seconds in normal coverage
Result: 38 out of 45 failed sensors now register successfully (84% recovery rate).
Step 3: Address remaining 7 sensors with no improvement
Deepest corner sensors still show CSQ < 5 (< -103 dBm). Options:
Option A: Install indoor small cell (rejected - cost $15K)
Option B: External antenna per sensor ($30/sensor)
- Deploy 3 dBi external antenna on each problem sensor
- Route antenna cable to nearest stairwell (closer to surface)
- Signal improvement: -105 dBm → -98 dBm (+7 dB gain)
- Cost: 7 × $30 + installation labor = $350
- Result: All sensors connect
Option C: Relocate 7 sensors to higher coverage areas
- Move from parking spots to nearby columns/walls with better signal
- Acceptable loss: 7 parking spots unmonitored (3.5% of 200)
- Cost: $0
- Result: 193/200 functional (96.5% coverage)
Step 4: Optimize power consumption for CE Level 2
Deep underground sensors use CE Level 2 (128-2048× repetitions), increasing TX energy 100-500×. Adjust PSM timers:
Before (standard config):
AT+CPSMS=1,,,00100100,00001111 // TAU=24h, Active=30s
Battery life estimate: 0.8 years (CE Level 2 drains battery)After (optimized for CE Level 2):
AT+CPSMS=1,,,01100100,00000101 // TAU=6h, Active=10s
// Rationale: Shorter TAU means more frequent but shorter transmissions
// reduces per-message energy cost by using fresher channel estimates
// Also: Reduce reporting frequency: once every 2 hours instead of hourly
Battery life estimate: 3.2 years (acceptable for underground deployment)Step 5: Document deployment parameters for future reference
| Zone | CSQ Range | CE Level | Repetitions | TX Time | Battery Life | Coverage |
|---|---|---|---|---|---|---|
| Surface | 15-25 | 0 | 1× | 2s | 12 years | 100% |
| B1 | 10-14 | 1 | 8-32× | 4-8s | 8 years | 98% |
| B2 (90%) | 6-9 | 2 | 128× | 12s | 3.2 years | 96% |
| B2 (10%) | < 5 | N/A | - | - | - | External antenna |
Final Solution Summary:
- 193 sensors: Standard NB-IoT with CE enhancement
- 7 sensors: External antenna + cable routing to stairwell
- Total additional cost: $350 (vs $15K small cell)
- Estimated battery life: 3-12 years depending on depth
- Coverage achieved: 100% (200/200 functional)
Key Lessons:
- Always enable CE modes for challenging RF environments (AT+NCONFIG)
- CSQ < 10 requires intervention - either CE enhancement or external antenna
- Underground deployments: budget 2-4× lower battery life than outdoor sensors
- Small improvements in signal (-105 → -98 dBm) can make the difference between working and non-working
- Document per-zone parameters for future maintenance and battery replacement planning
27.9 Summary
This chapter covered practical cellular IoT knowledge:
- AT Commands: Essential commands for module control including
AT+CREG,AT+CSQ,AT+CGDCONT,AT+CPSMS - Signal Interpretation: CSQ values map to RSSI via formula: RSSI (dBm) = -113 + (2 × CSQ); target CSQ >= 15 for reliable operation
- Troubleshooting: Common issues include network registration failure (check signal/SIM), PDP context problems (configure APN correctly), and poor signal (add external antenna)
- Module Selection: SIM7020 for static NB-IoT sensors, SIM7000G for mobile LTE-M tracking, BG96 for dual-mode global deployments
- Technology Comparison: LoRaWAN offers 2-5x lower TCO for localized deployments; cellular wins for global coverage and mobility
Next Steps:
- Get a SIM7000 module and IoT SIM card (Hologram or 1NCE)
- Test basic AT commands and network registration
- Implement MQTT communication to cloud broker
- Enable PSM/eDRX and measure power consumption
- Deploy a real-world cellular IoT sensor project
27.10 Concept Relationships
AT command implementation connects to: Cellular IoT Overview architecture (AT+CEREG checks MME registration), Power Optimization (AT+CPSMS/AT+CEDRXS configure timers), and Technology Selection (AT+CNMP/AT+CMNB select NB-IoT vs LTE-M mode). Module selection links to NB-IoT Applications and LTE-M Lab deployment scenarios.
27.11 See Also
- Cellular IoT Technology Selection - Module selection criteria
- Cellular IoT Power Optimization - PSM/eDRX AT commands
- NB-IoT Fundamentals - NB-IoT AT command specifics
- LoRaWAN Overview - Alternative LPWAN technology
Common Pitfalls
1. Sending AT Commands Before Module Initialization Complete
Cellular modules require 1–5 seconds after power-up before they respond to AT commands. Sending AT+CEREG? immediately after asserting PWRKEY low results in no response or garbage characters, causing firmware state machine confusion. Wait for the module’s power-on indication (e.g., “RDY” URC for Quectel modules, “+SYSSTART” for u-blox) before sending any AT commands. Set a 10-second hardware timeout as a fallback if the ready indication is not received.
2. Not Parsing URC (Unsolicited Result Code) Messages
Cellular modules asynchronously emit URCs for network events: +CEREG:5 (roaming registration), +CREG:0 (connection lost), +QIURC: “recv”,0 (data received), +CTZV: (time zone change). Firmware that only polls AT commands and discards unsolicited lines misses critical events like unexpected disconnection or incoming data. Implement a separate UART receive buffer that checks each incoming line against known URC prefixes before assuming it is a response to the last AT command.
3. Assuming AT+CGDCONT APN Takes Effect Immediately
Setting the APN with AT+CGDCONT does not immediately reconnect using the new APN. The device must deactivate the current PDP context (AT+CGACT=0,1) and reactivate it (AT+CGACT=1,1) or restart the module. Changes to APN configuration that are not followed by PDP context reconnection continue using the old APN until the module resets. Always follow APN changes with explicit PDP context management commands and verify connectivity with AT+CGPADDR.
4. Not Implementing Watchdog Reset for Cellular Module Lockup
Cellular modules occasionally lock up due to modem firmware bugs, memory corruption, or unexpected network events. A module that stops responding to AT commands cannot recover without a hardware reset (PWRKEY toggle or module VCC power cycle). Always implement: AT command timeout watchdog (trigger reset if no response in 60 s), periodic heartbeat check (AT every 60 s), and hardware reset capability from MCU GPIO. Log reset events for field diagnostics.
27.12 What’s Next
Now that you understand cellular IoT technologies, explore application-layer protocols:
| Next | Chapter | Description |
|---|---|---|
| 1 | MQTT | The most widely-used IoT messaging protocol for cellular connectivity |
| 2 | CoAP | Lightweight request-response protocol optimized for constrained NB-IoT devices |
| 3 | AMQP | Advanced message queuing for enterprise IoT and reliable delivery |
| 4 | NB-IoT Fundamentals | Deep dive into Narrowband IoT technology and AT command specifics |
| 5 | LoRaWAN Overview | Alternative LPWAN technology for cost comparison with cellular IoT |
Related Chapters
Deep Dives:
- NB-IoT Fundamentals - Narrowband IoT deep dive
- Cellular IoT Fundamentals - Core cellular concepts
Comparisons:
- NB-IoT vs LTE-M - Technology comparison
- LoRaWAN vs Cellular - LPWAN alternatives
- IoT Protocols Review - Cross-technology analysis
Application Protocols:
- MQTT Fundamentals - Messaging over cellular
- CoAP Protocol - Lightweight protocol for NB-IoT
Learning:
- Quizzes Hub - Cellular IoT assessments
- Videos Hub - Cellular technology tutorials