Pygate custom firmware



  • Hi,
    I've buyed a pygate with wipy for build a gateway lora custom.
    But I found out that the code pygate it's on firmware!
    I should send the packet lora from HTTP url on my web site.
    It's possible custimized this code?
    Thanks a lot



  • This post is deleted!


  • @Stefano-Floriani Please also have a look at the suggestions @jcaron made which I did not think about. Im not aware of any LNS implementations on Micropython, but the raw LoRa solution could be viable for your situation

    If, after that, you're still looking to compile your own firmware, have a look at the readme page on the github repository: https://github.com/pycom/pycom-micropython-sigfox. If you have no experience writing C code its going to be a steep hill to climb and I would suggest to make use of a local Chirpstack server, or using LoRa raw instead, we have some examples there: https://docs.pycom.io/tutorials/networks/lora/lora-mac/, https://docs.pycom.io/tutorials/networks/lora/lora-mac-nano-gateway/



  • @Gijs

    I don't never compilated a firmware, Can kindly You help me with example code http post and procedure for compilated firmware? Thanks a lot



  • @Stefano-Floriani Note that the LNS (LoRaWAN Network Server) as implemented by TTN or others does quite a few things which aren't done by the gateway:

    • It keeps a record of active devices, applications, keys, etc.
    • It manages multiple gateaways
    • It manages network configurations (channels, frequencies, data rates, downlink settings...)
    • It deduplicates data when the same frame is received via multiple gateways
    • It manages ACKs for confirmed frames
    • It manages timing of downlinks and selection of which gateway to send them through
    • It manages ADR if in use
    • It handles encryption/decryption of frame contents.

    A pure gateway in LoRaWAN mode does not see the contents of frames, that data is encrypted between the end-device and the LNS, so the gateway can't send any of that data to a URL directly.

    So you have the following options:

    • Run a (simplified, probably) LNS on the gateway. You'd probably have to ditch a few features. No idea if there are any LNS implementations in (micro)python or C/C++ that could be incorporated and if the LoPy has enough ressources for that. You'd probably have to change the way you configure and manage the whole thing.
    • Do not use LoRaWAN but raw LoRa and do you own stuff. No idea if the Pygate can easily be modified to do this.

    It's nearly certainly much easier and in the long run much more flexible to run an LNS (e.g. chirpstack) which will manage the gateway and forward received frames to the URL you want.



  • You'll indeed need to change the firmware to send a HTTP Post request instead. The change is minor I think, around this line: https://github.com/pycom/pycom-micropython-sigfox/blob/Dev/esp32/pygate/lora_pkt_fwd/lora_pkt_fwd.c#L1798, but you'll have to check that. I believe the JSON packet is already formatted, its probably just the protocol you need to change, if you set the server address to your own



  • @Gijs

    machine.pygate_init(buf)
    Hi, this is the only code to manage the gateway, I would like to modify the firmware to be able to direct the data of my devices lora via http and not ttn server or other ..
    I write on json config my url http and send only via http.
    It's possible.
    Thanks a lot



  • Sorry, Im not sure what you mean, could you perhaps clarify for me what it is you want to achieve? I might have misunderstood your question



  • @Gijs

    But I found out that the code pygate it's on firmware! I should send the packet lora from HTTP url on my web site. It's possible customized this code? This is my question!
    Thanks



  • You can run a local version of the Chirpstack service, and from there you should be able to integrate with a webhook to generate the http post you mention. Have a look at their documentation

    It should also be possible to modify the firmware to generate a HTTP Post in the format you're looking for, but Im guessing you're not looking for that.



  • @Gijs
    Hi,
    I don't want to use a remote gateway server but only a local one that sends data to my site via http post.
    Thanks a lot



  • If you're running a gateway server, like Chirpstack: https://www.chirpstack.io/, on your local server, there should be no issue in changing the server address in the configuration


Log in to reply
 

Pycom on Twitter