14 NB-IoT Labs and Implementation
- SARA-N211: u-blox NB-IoT module (standalone NB-IoT only); UART AT command interface; used in lab exercises for basic NB-IoT connectivity
- Quectel BC660K-GL: Global NB-IoT module with 3GPP Release 14 features; ultra-low power (1.6 µA PSM); commonly used in production NB-IoT designs
- nRF9161 / nRF9160: Nordic Semiconductor LTE-M/NB-IoT SiP (System-in-Package); integrates ARM Cortex-M33 application processor + modem; eliminates need for external MCU
- SARA-R412M: u-blox multi-technology module (LTE-M + NB-IoT + 2G fallback); used for global deployments requiring technology fallback
- Lab Bench Setup: AT development requires: terminal emulator (Tera Term, minicom), USB-UART adapter (CP2102, CH340), 3.3V power supply (NB-IoT modules are NOT 5V tolerant)
- CoAP Client Library: libcoap (C), aiocoap (Python async), microcoap (embedded C); used for lab CoAP-over-NB-IoT data transmission exercises
- LwM2M Client: Eclipse Wakaama (C), Anjay (C), Eclipse Leshan (Java server); standard device management stack for production NB-IoT deployments
- Network Simulator: Software tools like NS-3 with NB-IoT module, or hardware RF attenuators to simulate different coverage conditions in lab environments
14.1 Learning Objectives
By the end of this chapter, you will be able to:
- Configure NB-IoT modules: Issue AT command sequences to initialize SIM7020, BC66, and other modules for network operation
- Establish network connectivity: Execute the attach procedure and diagnose registration failures using AT+CEREG and AT+COPS responses
- Implement power modes: Set T3412 and T3324 timer values via AT+CPSMS to optimize PSM and eDRX for target battery life
- Transmit sensor data: Construct and send UDP/CoAP payloads to cloud endpoints from NB-IoT devices
- Debug connectivity issues: Interpret AT+CSQ signal strength, AT+NUESTATS radio statistics, and AT+CGDCONT APN diagnostics
- Evaluate module selection: Compare NB-IoT modules by band support, power profile, and total cost of ownership for a given deployment scenario
14.2 Prerequisites
Before diving into this chapter, you should be familiar with:
- NB-IoT Fundamentals: Understanding NB-IoT technology basics, deployment modes, and architectural components is essential before implementing practical solutions
- NB-IoT Power and Channel: Knowledge of PSM, eDRX, and channel access mechanisms is required to properly configure power-saving modes in lab exercises
- Cellular IoT Fundamentals: Familiarity with cellular network concepts helps you understand SIM card activation, network registration, and carrier requirements
- Networking Basics: Basic networking knowledge including IP addressing and data transmission concepts is needed for cloud integration exercises
Deep Dives:
- NB-IoT Power and Channel - PSM/eDRX theory and battery calculations
- Cellular IoT Implementations - SIM7000/SIM7600 module programming
Comparisons:
- NB-IoT Comprehensive Review - Test your implementation knowledge
- Cellular IoT Comprehensive Review - Technology selection scenarios
Application Protocols:
- CoAP Fundamentals - Lightweight protocol for NB-IoT
- MQTT Fundamentals - Publish-subscribe over cellular
Related Labs:
- Cellular IoT Applications - Real-world deployment scenarios
- Mobile Wireless Labs - Spectrum analysis and link budget
Design:
- Prototyping Hardware - Development boards and modules
- Network Design and Simulation - Coverage planning
“Time to connect to a real cellular network!” said Max the Microcontroller, wiring up a SIM7020 module. “Well, almost real – we are using a simulator. But the AT commands and procedures are identical to what you would use with actual hardware.”
Sammy the Sensor asked, “What is the first thing we do?” Max walked through the checklist. “Step one: send AT and wait for OK – that confirms the modem is alive. Step two: AT+CPIN? to check the SIM card. Step three: AT+CSQ for signal strength. Step four: AT+CEREG? to see if we are registered on the network. Only after all four pass do we try sending data.”
“Configuring PSM is the most impactful part,” said Bella the Battery excitedly. “With AT+CPSMS=1, you tell the network you want Power Saving Mode. Then you set the TAU timer – that is how long I can sleep – and the Active Timer – how long to stay awake after transmitting. Set TAU to 1 hour and Active to 10 seconds, and I draw only 5 microamps for 99.7 percent of the time!”
Lila the LED offered debugging advice. “If registration fails, check the APN with AT+CGDCONT. If signal is weak, try AT+NCONFIG to enable coverage enhancement with extra repetitions. And always monitor AT+NUESTATS for detailed radio statistics – it tells you things like the number of retransmissions, which reveals hidden connectivity problems.”
Learning:
- Quizzes Hub - Hands-on implementation challenges
14.3 🌱 Getting Started (For Beginners)
If you’re ready to get hands-on with NB-IoT development, this section will guide you through practical implementation using common development boards and modules.
14.3.1 What Will You Learn?
Practical skills:
- Configure NB-IoT modules using AT commands
- Connect to carrier networks (Vodafone, T-Mobile, AT&T, etc.)
- Send/receive data to cloud platforms
- Implement PSM and eDRX power modes
- Debug connectivity issues
Analogy: Think of this chapter as moving from “reading about driving” (previous chapters) to “getting behind the wheel” – you’ll write real code and see data flowing to the cloud.
14.3.2 Hardware You’ll Need
Option 1: Low-cost starter (< $30)
- ESP32 DevKit ($8-12)
- SIM7020E NB-IoT module ($15-20)
- Breadboard + jumper wires
- USB cable
- NB-IoT SIM card (from carrier)
Option 2: All-in-one board ($40-60)
- LilyGO T-SIM7000G (ESP32 + SIM7000G NB-IoT + GPS)
- USB cable
- NB-IoT SIM card
Recommended for beginners: LilyGO T-SIM7000G – everything integrated, no wiring needed.
14.3.3 Getting an NB-IoT SIM Card
Carrier options (United States):
- T-Mobile: IoT SIM cards (1 MB/month free tier available)
- AT&T: IoT Data plans (starting $2/month)
- Hologram.io: Global IoT SIM (pay-as-you-go, works in 200+ countries)
Carrier options (Europe):
- Vodafone: IoT SIM cards (various plans)
- Deutsche Telekom: NB-IoT connectivity
- 1NCE: €10 for 10 years (500 MB total, popular for testing!)
Important: Make sure your SIM card supports NB-IoT specifically (not just LTE-M or regular LTE).
14.3.4 Quick Start: Send Your First NB-IoT Message (30 minutes)
Step 1: Connect hardware
ESP32 → SIM7020E Module
TX (GPIO17) → RX
RX (GPIO16) → TX
3.3V → VCC
GND → GND
Step 2: Test AT commands (Arduino Serial Monitor)
AT → OK (basic connectivity test)
AT+CPIN? → +CPIN: READY (SIM card detected)
AT+CGATT=1 → OK (attach to network - may take 30-60 seconds)
AT+CGATT? → +CGATT: 1 (attached successfully!)
Step 3: Send data to cloud (UDP example)
// Simple sketch to send "Hello NB-IoT!" every 60 seconds
#include <HardwareSerial.h>
HardwareSerial nb(1); // Use UART1
void setup() {
Serial.begin(115200);
nb.begin(9600, SERIAL_8N1, 16, 17); // RX=16, TX=17
delay(3000);
sendAT("AT");
sendAT("AT+CGATT=1"); // Attach to network
delay(30000); // Wait for attachment
}
void loop() {
// Send UDP packet to test server
sendAT("AT+CSOC=1,2,1"); // Create UDP socket
sendAT("AT+CSOSEND=0,12,\"Hello NB-IoT!\""); // Send data
Serial.println("Data sent!");
delay(60000); // Wait 60 seconds
}
void sendAT(String cmd) {
nb.println(cmd);
delay(1000);
while (nb.available()) {
Serial.write(nb.read());
}
}Expected result: After ~60 seconds (network attachment), you’ll see messages sent every minute. Battery life in this basic example: ~2-3 days (no PSM enabled yet).
14.3.5 Common Beginner Mistakes
1. “AT commands not responding”
- ✅ Check baud rate (usually 9600 or 115200)
- ✅ Verify TX/RX not swapped
- ✅ Ensure 3.3V power (NOT 5V - will damage module!)
- ✅ Add delay after power-on (3-5 seconds for module boot)
2. “Can’t attach to network” (AT+CGATT? returns 0)
- ✅ SIM card inserted correctly (chip facing down usually)
- ✅ SIM activated with carrier (check online portal)
- ✅ NB-IoT coverage exists in your area (check carrier coverage map)
- ✅ Wait longer (first attach can take 2-3 minutes in poor coverage)
3. “Battery drains in hours, not years!”
- ✅ You haven’t enabled PSM mode yet (radio stays on)
- ✅ Solution: Configure AT+CPSMS=1 (see labs below)
14.4 Videos
Key drivers for NB-IoT:
- Existing 2G/3G networks being sunset
- Need for low-cost, low-power IoT connectivity
- Leverage existing cellular infrastructure
- Provide carrier-grade reliability
- Support massive device deployments
14.4.1 NB-IoT Characteristics
NB-IoT key characteristics diagram
Target applications:
- Smart metering (electricity, water, gas)
- Smart cities (lighting, parking, waste)
- Asset tracking and logistics
- Agricultural monitoring
- Industrial IoT
- eHealth devices
14.5 Knowledge Check
Test your understanding of these networking concepts.
14.6 Hands-On Exercise: NB-IoT Power Budget Analysis
14.6.1 Exercise Objective
Calculate the battery life for an NB-IoT smart meter application.
14.6.2 Scenario
Smart electricity meter with the following requirements: - Reporting frequency: 4 readings per day (every 6 hours) - Payload size: 100 bytes (meter reading, power quality, diagnostics) - Power configuration: PSM enabled, T3412 = 6 hours - Battery: 3.6V, 5000 mAh (18 Wh) - Coverage: Normal (no extended repetitions needed)
14.6.3 Task 1: Current Consumption Profile
Typical NB-IoT module current consumption:
| State | Current | Duration per Cycle |
|---|---|---|
| PSM (deep sleep) | 5 µA | 6 hours - (active time) |
| Wake-up | 50 mA | 3 seconds |
| Network attach | 200 mA | 5 seconds |
| Data transmission | 220 mA | 10 seconds (100 bytes) |
| RRC Idle (after TX) | 15 mA | 20 seconds (T3324) |
For the smart meter scenario with 4 transmissions per day, average current consumption is:
\[I_{avg} = \frac{4 \times [(50 \times 3) + (200 \times 5) + (220 \times 10) + (15 \times 20)]}{86400} + 0.005 \approx 0.052 \text{ mA}\]
With 5000 mAh battery, theoretical life = \(\frac{5000}{0.052} \approx 96,154\) hours (≈11 years). Accounting for 80% aging efficiency, practical life = \(96,154 \times 0.8 \div 8760 \approx 8.8\) years. Reducing to 1 transmission/day extends this beyond 10 years.
14.6.4 Task 2: Energy Calculation per Day
Energy per transmission cycle:
Wake-up: \[E_{wake} = 0.050 \text{ A} \times 3 \text{ s} \times 3.6 \text{ V} = 0.54 \text{ Ws}\]
Network attach: \[E_{attach} = 0.200 \times 5 \times 3.6 = 3.6 \text{ Ws}\]
Transmission: \[E_{tx} = 0.220 \times 10 \times 3.6 = 7.92 \text{ Ws}\]
RRC Idle: \[E_{idle} = 0.015 \times 20 \times 3.6 = 1.08 \text{ Ws}\]
Active time per cycle: 3 + 5 + 10 + 20 = 38 seconds PSM time per cycle: 6 hours - 38s = 21,562 seconds
PSM energy: \[E_{psm} = 0.000005 \times 21,562 \times 3.6 = 0.388 \text{ Ws}\]
Total energy per cycle: \[E_{cycle} = 0.54 + 3.6 + 7.92 + 1.08 + 0.388 = 13.528 \text{ Ws}\]
Daily energy (4 cycles): \[E_{day} = 13.528 \times 4 = 54.112 \text{ Ws} = 0.015 \text{ Wh/day}\]
14.6.5 Task 3: Battery Life Calculation
\[\text{Battery life} = \frac{18 \text{ Wh}}{0.015 \text{ Wh/day}} = 1,200 \text{ days} \approx 3.3 \text{ years}\]
With battery aging and self-discharge (assume 80% efficiency): \[\text{Practical battery life} = 1,200 \times 0.8 = 960 \text{ days} \approx 2.6 \text{ years}\]
14.6.6 Task 4: Optimization for 10-Year Life
To achieve 10-year battery life (3,650 days), we need:
\[E_{day\_required} = \frac{18 \text{ Wh} \times 0.8}{3,650 \text{ days}} = 0.00395 \text{ Wh/day}\]
Options:
- Reduce reporting frequency to 1/day:
- \(E_{day} = 13.528 \text{ Ws} = 0.00376 \text{ Wh/day}\) ✓ Achieves 10 years!
- Increase battery size to 19 Ah (3.6V × 19 Ah = 68.4 Wh):
- With 4 readings/day: \(\frac{68.4 \times 0.8}{0.015} = 3,648 \text{ days} \approx 10 \text{ years}\) ✓
- Use external power (e.g., current transformer on power line):
- Harvest energy from measured circuit
- No battery limitations
Recommendation: For 10-year battery life, either reduce reporting to once daily OR use larger battery (19 Ah D-cell).
14.7 Visual Reference Gallery
These AI-generated SVG diagrams provide alternative visual representations of NB-IoT implementation concepts covered in this chapter.
14.7.1 NB-IoT Labs Implementation Overview
AI-generated diagram showing complete NB-IoT implementation workflow including hardware setup, AT command sequences, and cloud connectivity.
14.7.2 NB-IoT Technical Specifications
Technical specifications overview for NB-IoT implementation planning.
14.7.3 NB-IoT Data Rates
Data rate characteristics across different NB-IoT operation modes.
14.7.4 NB-IoT Coverage Reality
Real-world coverage scenarios for NB-IoT deployment planning.
NB-IoT leverages existing cellular infrastructure while optimizing for IoT use cases with deep indoor coverage and multi-year battery life.
AT commands provide low-level control of NB-IoT modules, enabling configuration of network parameters, power modes, and data transmission through a standardized interface.
Understanding modulation techniques helps explain why NB-IoT uses single-tone and multi-tone OFDMA while LoRa uses chirp spread spectrum – both achieve long range through different approaches.
Scenario: You’re designing an IoT product and need to select an NB-IoT module. Different modules offer different trade-offs in cost, features, power consumption, and global band support.
Step 1: Identify your deployment region and required bands
| Region | NB-IoT Bands | Typical Carriers |
|---|---|---|
| USA | B2 (1900 MHz), B4 (1700 MHz), B12 (700 MHz), B13 (700 MHz) | AT&T, Verizon, T-Mobile |
| Europe | B3 (1800 MHz), B8 (900 MHz), B20 (800 MHz) | Vodafone, Deutsche Telekom, Orange |
| China | B3, B5 (850 MHz), B8 | China Mobile, China Unicom, China Telecom |
| Global | B1, B2, B3, B5, B8, B12, B13, B18, B20, B28 | Multi-carrier roaming |
Step 2: Determine feature requirements
| Feature | When Needed | Module Impact |
|---|---|---|
| GPS/GNSS | Asset tracking, location-based services | +$5-10 cost, +50 mW power |
| Dual-mode (NB-IoT + LTE-M) | Future-proofing, mobility option | +$3-7 cost, more complex firmware |
| Extended temp (-40°C to +85°C) | Outdoor/industrial | +$2-5 cost, industrial-grade components |
| Integrated SIM (eSIM/iSIM) | Global deployments, SIM management | +$1-3 cost, simplifies logistics |
Step 3: Evaluate power consumption profiles
| Module | TX Current | PSM Sleep | Cost | Best For |
|---|---|---|---|---|
| Quectel BC66 | 220 mA | 3 µA | $6-8 | Ultra-low cost, Asia |
| u-blox SARA-N211 | 220 mA | 5 µA | $8-12 | Europe, industrial temp |
| SIMCom SIM7020E | 200 mA | 5 µA | $7-10 | Global, good availability |
| Nordic nRF9160 | 100 mA | 2.7 µA | $10-15 | Premium, GPS, dual-mode |
| Quectel BC95-G | 180 mA | 5 µA | $9-13 | Global multi-band |
Step 4: Calculate lifetime module cost (not just purchase price)
Example: 10,000 smart meter deployment, 10-year lifetime
| Cost Component | BC66 ($6) | SARA-N211 ($10) | nRF9160 ($13) |
|---|---|---|---|
| Module purchase | $60,000 | $100,000 | $130,000 |
| Development cost (amortized) | $10K (simple) | $15K (moderate) | $25K (complex SoC) |
| Certification (CE/FCC) | $8K | $8K | $8K |
| PCB assembly cost delta | $0 baseline | +$5K (tighter layout) | +$10K (multi-layer) |
| Total upfront | $78K | $128K | $173K |
| Support/RMA (2% failure) | 200 × $20 = $4K | 200 × $30 = $6K | 200 × $40 = $8K |
| 10-year TCO | $82K | $134K | $181K |
| Per-device TCO | $8.20 | $13.40 | $18.10 |
Real-World Selection Example:
Smart Agriculture Soil Sensors (5,000 units)
- Deployment: California farms (AT&T coverage)
- Update frequency: 4× daily
- GPS: Not needed (stationary)
- Temperature: -10°C to +50°C (moderate)
- Battery: 2× D-cell (19 Ah), 10-year target
- Budget: $60K module budget ($12/module)
Analysis:
- BC66: ❌ Asia bands only, doesn’t support US B12/B13
- SARA-N211: ✓ Has US bands, $10 fits budget, industrial temp overkill but acceptable
- nRF9160: ❌ $13 slightly over budget, GPS/LTE-M features unused
Winner: SIMCom SIM7020E ($7-10)
- Supports AT&T B12, Verizon B13
- Cost: 5,000 × $9 = $45K (well under budget)
- Power: 200 mA TX, 5 µA PSM (meets 10-year target)
- Availability: Good US distributor network
- Proven: Widely deployed in similar agriculture applications
Step 5: Validate with prototype testing
Before committing to 5,000-unit production: 1. Order 10 modules ($90) 2. Test in worst-case farm location (furthest from tower) 3. Measure actual current consumption with power profiler 4. Verify AT command compatibility with your firmware 5. Confirm carrier certification (AT&T has certified SIM7020E) 6. Run 1-week field trial with 5 prototypes
Key Lessons:
- Module cost is only 5-20% of total deployment cost (installation, connectivity, support dominate)
- Band support is non-negotiable - verify carrier frequencies before selection
- “Good enough” often beats “best” - SIM7020E at $9 vs nRF9160 at $13 both meet requirements
- Ecosystem matters - choose modules with good documentation, forums, and distributor support
- Always prototype with multiple modules when deciding between 2-3 finalists
14.8 Summary
- AT command configuration provides low-level control of NB-IoT modules (SIM7020, BC66, SIM7000) for network attachment, power mode configuration, and data transmission
- Network attachment process involves SIM card detection (AT+CPIN), network registration (AT+COPS), and GPRS attach (AT+CGATT) with typical connection times of 30-90 seconds
- PSM and eDRX configuration uses T3412 and T3324 timers to balance battery life and reachability, with proper settings enabling 10-15 year device lifetime on 5-10 Ah batteries
- UDP and CoAP protocols are preferred for NB-IoT due to low overhead compared to TCP, with CoAP providing RESTful semantics optimized for constrained devices
- Signal diagnostics (AT+CSQ, AT+COPS, AT+CEREG) are essential for troubleshooting connectivity issues, with RSSI > -100 dBm generally required for reliable operation
- Coverage enhancement modes (CE0, CE1, CE2) automatically adapt based on signal conditions, trading latency for deep coverage penetration in challenging RF environments
- Real-world deployment requires consideration of carrier selection, SIM provisioning, power budget analysis, coverage mapping, and field testing before large-scale rollout
14.9 Concept Relationships
This hands-on chapter connects theoretical NB-IoT concepts to practical implementation:
- AT command sequences translate abstract concepts like PSM, eDRX, and coverage enhancement into actual module configuration strings - understanding the theory enables proper parameter selection
- Power mode configuration (T3412, T3324 timers) directly impacts battery life calculations from earlier chapters - misconfiguration can reduce a 10-year design to 6 months
- Signal diagnostics (AT+CSQ, AT+CEREG) provide the real-world feedback loop that validates link budget calculations and coverage predictions
- Module selection depends on understanding band support, power consumption profiles, and feature trade-offs discussed in fundamentals
- Firmware updates over NB-IoT require careful data plan management and demonstrate the throughput limitations inherent in the 180 kHz bandwidth design
The gap between theory and practice often appears during field deployment - this lab chapter provides the troubleshooting tools to bridge that gap.
14.10 See Also
Theory Foundation:
- NB-IoT Fundamentals - Core concepts implemented here
- NB-IoT Power and Channel - PSM/eDRX theory behind AT commands
- NB-IoT Coverage Enhancement - Repetition mechanisms configured here
Hands-On Learning:
- NB-IoT Lab Simulation - ESP32 simulation for practice without hardware
- Cellular IoT Implementations - SIM7000/SIM7600 programming examples
Application Protocols:
- CoAP Fundamentals - Lightweight protocol for NB-IoT
- MQTT Fundamentals - Publish-subscribe over cellular
Related Labs:
- Cellular IoT Applications - Real-world deployment scenarios
- Prototyping Hardware - Development board selection
Common Pitfalls
Most NB-IoT modules operate at 3.3V and have 3.3V-only UART pins. Connecting a 5V Arduino or USB-UART adapter directly to a 3.3V NB-IoT module will permanently damage the UART input pins and potentially the modem IC. Always use a 3.3V-compatible USB-UART adapter (FTDI FT232R with VCC set to 3.3V) or a logic level shifter. Verify module VIO voltage specification before connecting any logic-level signals.
NB-IoT lab implementations that only test connectivity without measuring current consumption miss the core optimization objective. A lab that shows “data received on server” without measuring PSM entry current (<5 µA), registration current (10–50 mA), and transmission current (100–200 mA) is incomplete. Include a µA-resolution current measurement tool (Nordic PPK2, Otii Arc, or a 1Ω shunt resistor + oscilloscope) in every NB-IoT lab setup to validate power optimization.
NB-IoT module default UART baud rates vary by vendor: u-blox: 115200; Quectel: 9600 or 115200; Nordic nRF9160: 115200 (logged as CMUX format). A terminal at the wrong baud rate produces only garbage characters with no indication of the problem. Always check module documentation for default UART settings, or use autobaud detection by trying common rates (9600, 19200, 38400, 57600, 115200) with “AT” until you see “OK”.
AT commands have vastly different response times: AT (echo): <100 ms; AT+CEREG? (registration check): <300 ms; AT+CGDCONT (PDP configuration): <1 s; AT+CGACT=1 (PDP activate): 5–60 s; AT+NSOST (data send): 1–30 s in poor coverage. Firmware implementations with a single 1-second timeout for all AT commands will fail on commands requiring longer processing. Implement command-specific timeouts: use 300 ms for status queries, 10 s for connection operations, 60 s for data transmission in CE Mode B.
14.11 What’s Next
| Next Topic | Description |
|---|---|
| NB-IoT Comprehensive Review | Test your hands-on implementation knowledge with comprehensive quiz scenarios |
| NB-IoT Lab Simulation | Practice NB-IoT state machines and power calculations in a browser-based ESP32 simulator |
| Cellular IoT Fundamentals | Expand to LTE-M, 5G NR-IoT, and other cellular IoT technologies |
| CoAP Fundamentals | Implement lightweight request-response communication optimized for NB-IoT payloads |
| MQTT Fundamentals | Deploy publish-subscribe messaging patterns over NB-IoT cellular links |