to get the CSQ

  • Dear sir/mam,
    Could anyone please help me how can I get the CSQ of my network signal and how would I know that my board is connected the network?
    How can run the AT commands.

    Waiting for your positive reply.

  • Global Moderator

    @radheshyam0508 Look at the example in the documentation:
    which is similar to my little script I posted before. After connection, I tried a simple connection link to a PC I had set up as the server:

    data_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    port_number = 4567
    data_client.connect((ip_address, port_number))
    while True:
        msg = input("New message")
        if msg == "q":
        data_client.send(msg + "\r\n")

    I lost somehow the code of the matching "server", but it was minimal. I may have type that on-the-fly at a Python REPL.

  • @robert-hh
    sorry, but How would i know that my device is connected?

  • Global Moderator

    @radheshyam0508 Once the device is attached and connected, you can use the usual socket mechanism to communicate.

  • @robert-hh said in to get the CSQ:


    Thanks a lot Robert,
    Could you please send me the code for connecting the fipy NB-IoT module to the network.
    Because there is no tutorial or example code for NB-IoT.

    Thanks a lot for your help and support

  • Global Moderator

    @radheshyam0508 You could try this:

    from network import LTE

    Returns for me:
    '\r\n+CSQ: 25,99\r\n\r\nOK\r\n'
    returns the attach status. A typical small test script would be:

    from network import LTE
    import time
    import socket
    start = time.ticks_ms()
    lte = LTE()
    print("\nModem started, time needed (s): ", time.ticks_diff(time.ticks_ms(), start)/1000)
    start = time.ticks_ms()
    lte.attach(band=8, apn="")
    while not lte.isattached():
        print(".", end="")
    print("\nAttached!, time needed (s): ", time.ticks_diff(time.ticks_ms(), start)/1000)
    start = time.ticks_ms()
    lte.connect()       # start a data session and obtain an IP address
    while not lte.isconnected():
        print("-", end="")
    print("Connected!, time needed (s): ", time.ticks_diff(time.ticks_ms(), start)/1000)

Log in to reply

Pycom on Twitter