New firmware release 1.6.7.b1 (LoRaWAN Nano Gateway with TTN example!!)


  • administrators

    Hello!

    We are very excited about this one. I know that many around here have been waiting patiently to see the LoPy work as a LoRaWAN Nano Gateway and connect it to servers like TTN, but guess what? we did it :-)

    The Nano gateway script is located here: https://github.com/pycom/pycom-libraries/tree/master/examples/lorawan-nano-gateway

    For the Nano Gateway itself you need nanogateway, config and main. The other 2 files are examples on how to setup the nodes either with ABP or OTAA join methods.

    Before trying the nano gateway make sure to update the LoPy to firmware version 1.6.7.b1 first!

    Features/characteristics of the Nano Gateway:

    • Single channel and single datarate (for now, multiple datarates on a single channel will come soon).
    • Support for Downlinks on any channel and DR.
    • OTAA and ABP.
    • Semtech packet forwarder protocol version 2.
    • NTP sync.

    The script uses multithreading and callbacks heavily, so it's a very nice example of the capabilities of the LoPy and MicroPython. The total RAM consumed is only around 22KB.

    Features to be added soon:

    • Ability to receive packets sent on any spreading factor.
    • Add an option to enable and disable debug messages.
    • Implement the .stop() method to gracefully stop and start the nano gateway at any moment.

    All comments and suggestions are more than welcome.

    Cheers,
    Daniel



  • @jmarcelino Thanks for clarifying.
    As for the second issue, this is now resolved (had to do with encryption on the LoRaWAN).



  • @RobTuDelft
    Though the process doesn't actually guarantee unique numbers there is a convention to add FFFE in the middle to expand the 48-bit MAC to the EUI64 expected by the Things Network.
    0_1494697690137_89649-pic1.png

    I'm not sure what you mean in the LoRa problem. Is this with mode=LoRa.LORA or mode=LoRa.LORAWAN? And what is the "the other end": another LoPy, a LoRaWAN network server or something else?



  • @jmarcelino Great, thanks. Machine unique ID/MAC (machine.unique_id()) can be used directly, without any changes or what is the convention here? Noticed the checkbox indeed.

    Now I have another quesiton pertaining LoRa transmission. When I send the payload ("hi") as lora_sock.send(bytes([0x68, 0x69])) or as lora_sock.send('hi') the payload ends up as cc26 for example on the other end; which if I translate to ascii again is not "hi". Any clue what is happening here?



  • @RobTuDelft
    Your gateway ID has to be a EUI64 (hexadecimal) e.g. 240ac4fffe008d44 which for now you can base on your WiFi hardware address.

    That's what TTN accepts too. Have you registered your gateway there as the packet forwarder type? They've changed this now to "I'm using the legacy packet forwarder" checkbox, make sure it's ticked.



  •  File "main.py", line 12, in <module>                                                                                  
      File "nanogateway.py", line 94, in start                                                                              
      File "nanogateway.py", line 161, in _push_data                                                                        
    ValueError: odd-length string
    

    My gateway id is 'gateway-rob', should I change that?



  • @bihut const() is a kind of Micropython directive, not a function. It's kind of similar to #define in C.



  • In the nanogateway.py file, where is the function const()?. Because const(2), const(1), etc. is not recognized.

    Thanks in advance.



  • This post is deleted!


  • @daniel
    I just upgraded my board and see - but no info about this version

    (sysname='WiPy', nodename='WiPy', release='1.6.8.b1', version='v1.8.6-504-gff1098f6 on 2017-03-13', machine='WiPy with ESP32')
    

    also after upgrade i now have:

    OSError: I2C bus error
    


  • Hi,

    Will the nano gateway work with any node or just Lopys? For example, will Multitech's mDot work?

    Regards,
    Javier



  • Hello,

    first of all, the LoraWAN Nano Gateway works great!!

    I used the HTTP Intergration of the TTN it post the received data to my PHP script and the PHP script placed the data in my own database.

    I have used the HTTP intergration below.

    https://www.thethingsnetwork.org/docs/applications/http/

    I see that is possible that I can receive also the Latitude, longitude and altitude of the device. without place this in the payload, but this is not implement in python script.
    Is it possible to implement this in python without put this values in the raw payload?

    "latitude": 52.2345,               // Latitude of the device
    "longitude": 6.2345,              // Longitude of the device
    "altitude": 2                            // Altitude of the device
    

    Best Regards,
    Mark



  • @livius

    Hello Livius.

    Here is what I see on my W UART REPL:

    I (146522) wifi: mode : sta (24:0a:c4:00:84:44)
    I (146523) wifi: sleep disable
    I (146650) wifi: n:1 0, o:6 0, ap:255 255, sta:1 0, prof:6
    I (147638) wifi: state: init -> auth (b0)
    I (147640) wifi: state: auth -> assoc (0)
    I (147643) wifi: state: assoc -> run (10)
    I (147662) wifi: connected with IANNIS, channel 1
    WiFi connected!

    Push ack
    I (157644) wifi: pm start, type:0

    Pull ack
    Pull ack
    Push ack
    Guru Meditation Error of type LoadProhibited occurred on core 0. Exception was unhandled.
    Register dump:
    PC : 0x400f6f9f PS : 0x00060b30 A0 : 0x800d8428 A1 : 0x3ffc5c30
    A2 : 0x000330d0 A3 : 0x3ffc666c A4 : 0x00000001 A5 : 0x00000000
    A6 : 0x00000000 A7 : 0x00000000 A8 : 0x800f5ed2 A9 : 0x3ffe96c0
    A10 : 0x00000001 A11 : 0x00000001 A12 : 0x3ffe21b0 A13 : 0x00000010
    A14 : 0x3ffe9830 A15 : 0x3ffe9790 SAR : 0x00000013 EXCCAUSE: 0x0000001c
    EXCVADDR: 0x000330d0 LBEG : 0x400f296c LEND : 0x400f2974 LCOUNT : 0x00000000

    Backtrace: 0x400f6f9f:0x3ffc5c30 0x400d8428:0x3ffc5c70 0x400d85b8:0x3ffc5c90 0x400d862b:0x3ffc5cb0 0x400d8b38:0x3ffc5ce0 0x400d8d52:0x3ffc5d00 0x400d7eff:0x3ffc5d40

    ================= CORE DUMP START =================

    Here is a coredump. I haven't copied it.

    ================= CORE DUMP END =================
    Rebooting...
    ets Jun 8 2016 00:22:57

    rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0x00
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:QIO, clock div:2
    load:0x3fff9010,len:8
    load:0x3fff9018,len:248
    load:0x40078000,len:4056
    load:0x4009fc00,len:920
    entry 0x4009fde4
    I (1542) wifi: wifi firmware version: 2a22b2d
    I (1558) wifi: pp_task_hdl : 3ffd72f8, prio:23, stack:8192
    I (1558) wifi: Init lldesc rx mblock:10
    I (1558) wifi: Init lldesc rx ampdu len mblock:7
    I (1560) wifi: Init lldesc rx ampdu entry mblock:4
    I (1565) wifi: sleep disable
    I (2553) wifi: frc2_timer_task_hdl:3ffdd348, prio:22, stack:2048
    I (2574) wifi: mode : softAP (24:0a:c4:00:84:45)
    MicroPython v1.8.6-493-g99ac80fe on 2017-03-03; LoPy with ESP32
    Type "help()" for more information.



  • @gerkez Ok, then you should not be experiance problems from rf reflections, and should be able to rule it out.
    I doubt you are working on a conductive table ;-)



  • @Shaun
    I am using a pycom expansion board with LoPy



  • @gerkez Are you using a custom base PCB (your own) or are you using the Pycom expansion PCB?
    I ask, as you may be running into the WiPy resetting due to rf reflections issue.



  • @zmrzli
    Which password do you mean?



  • @Colateral
    My problem was that password was not long enough. Once I changed it, it worked fine. It would be better if some indication was given about a problem from WiPy, but no big deal, once understood...!



  • @gerkez
    Try Arduino IDE -> COM port monitor instead



  • @livius
    Hello Livius,

    My pymakr doesn't work. Connection errors.
    So I use Putty. Problem is that the device reboots all the time, so I don't see anything on the UART REPL


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.