Sending ASCII from lopy4

  • Hi,

    I am trying to send the ascii from the lopy4 to the gateway. First the ascii.txt will be converted to the binary bits and then divided into the lora packets and the packets will be sent with delayed time. If any one of you have completed similar task or have any idea, I would appreciate your help. I am new to the micropython codings.

    I have also tried to program the following code;

    import binascii
    import struct
    ascii = 'SIGN.txt'
    with open(ascii, 'rb') as f:
        content =
        data = binascii.hexlify(content)
    l = len(data)
    print (l)
    hex_string = binascii.unhexlify(data)
    print (hex_string)
    print (len (hex_string))
    for l in range (0, l, 10):
        package = data[1:l+10]
        print (package) 

    Your help will be highly appreciated.

    Thank you

  • @phusy012 After a few packets there is an overflow in sending. You should set s.setblocking(True), to ensure, that the next transmission is not requested before the previous has been completed.

  • @robert-hh and any other experts


    Thank you for the response.

    The "gateway" I meant was my own Lora Built in Server. I am using the RAK831 Pilot Gateway and I have developed my own Built in Server.

    I took note of having no need to convert ascii to hex and wrote the new program code attached below;

    When I run the program on the Lopy4 board, it though sends some part of the ascii (I confirm since I receive some data in the node applications device data of LoRa Built in Server) but comes with the following error attached below:

    I tried to browse for error nature and reasons but could not get the clear picture. Please advise and will appreciate your help in advance.

    Thank you

  • @phusy012 Assuming that what you call "gateway" is not a TTN gateway, you can get some hints from the Lora-Lora example in the documentation:
    Also, for transmission you do not have to convert your data to a hex_string. That only doubles the data size and transmission time = air time, which is limited in LoRa.

Log in to reply

Pycom on Twitter