Abstract
The growing adoption of the Internet of Things (IoT) demands scalable, energy-efficient communication for autonomous devices. Narrowband IoT (NB-IoT), as a low-power wide-area technology, offers reliable connectivity but remains difficult to integrate in MicroPython systems due to the absence of high-level GSM libraries. This paper introduces a modular, object-oriented MicroPython library that abstracts AT command handling, automates network configuration, and supports protocols such as MQTT and Blynk. The architecture features a layered, hardware-agnostic core and device-specific adapters, enhancing portability and extensibility. The library includes structured exception handling and automated retries to improve system reliability. Empirical validation using a Raspberry Pi Pico and SIM7020E module in a typical IoT scenario demonstrated an up to 81% reduction in implementation time. By providing a reusable and extensible framework, this work improves developer productivity, enhances error resilience, and establishes a solid foundation for rapid NB-IoT application development. Future directions include cross-hardware validation and AI-assisted code and test generation.