ATOM-DTU-NB-IOT no connect to sim7020G Module

  • Hi
    I try to run the following code on a Atom-DTU NB-IOT

    from m5stack import *
    from m5ui import *
    from uiflow import *
    from base.DTU_NB import DTU_NB
    import time

    print('init module.....')
    dtu_nb = DTU_NB()
    print('dtu initialized.....')

    "dtu initialized..." is never printed, if i connect via usb/serial and enter ctrl-C i get the following output:

    init module.....
    Traceback (most recent call last):
    File "", line 30, in <module>
    File "base/", line 31, in init
    File "base/", line 42, in ischeck_IP
    File "libs/simcom/", line 265, in send_at_cmd
    File "libs/simcom/", line 274, in wait_at_cmd_ok
    MicroPython d725c2ac8-dirty on 2022-10-13; M5Stack with ESP32
    Type "help()" for more information.

    while i'm not shure if my sim card is working for nb-iot and not just for LTE, was hoping to be able to communicate with the sim7020G to get some information.
    what could be wrong?

  • Hello @roadfox

    the Init NB-IoT DTU block (aka dtu_nb = DTU_NB()) executes the below conversation with the modem and if it doesn't get the proper responses repeats the commands forever.

    > ATE0
    < OK
    > AT+CPIN?
    < +CPIN: READY
    < OK
    < +CGCONTRDP: 1,5,"myapn","",,"",""
    < OK

    So make sure that your SIM card doesn't have a PIN set and works for NB-IoT.

    From my experience SIM cards for NB-IoT are different from SIM cards for smartphones.


  • Hi Felix
    Thanks for the fast response!
    I'm pretty sure it is the SIM, while pin is removed the card is probably not valid for NB-IOT. I can also not figure out how to get an NB-IOT compatible SIM card here in Switzerland, seems to be an "enterprise thing" :-(

    Before i return the Device and try with the Lora version, is there an easy way for me to test if communication with the sim7020G is ok, so setting up the correct serial and issue an AT command in mycropython by hand?

    Tried to find the source code for base/ but without success.


  • Hello @roadfox

    I've put together an example which sends an AT command when the M5Atom button is pressed and then waits for the OK response or times out.

    BTW: I am using an NB-IoT SIM card from IoT Creators - they offer a free testkit.


  • @felmue
    thank you so much. was able to verify that the sim7020G is responding

    < AT
    < OK

    so next to find a sim card which works...

  • Hello @roadfox

    you are welcome. I am glad it worked for you.

    Please let me know what you find regarding NB-IoT SIM card.


  • Hello @roadfox

    in case you are still looking for a suitable NB-IoT SIM card. I recently got one from Miotiq which works fine for me. See here for more detail.