The Things Network dual-channel up&downlink gateway

Beginning of 2016 our IoT group was looking for ways in which to send sensor data to our cloud servers. At that time we found TheThingsNetwork (in short TTN), which is based on LoRa, to be a good choice to start with.

Next step was to setup a gateway that would be usable within our offices but also at home and customer sites to work and demonstrate. That’s why we decided to build our own low-cost gateways. One of the downsides of such so-called single channel gateways is the fact that they do not support the full channels and SF spectrum of the TTN. So we looked a bit further and found a Raspberry Pi Hat that can support 2-channels.

This Raspberry Pi Hat is manufactured and sold by Uputronics: Raspberry Pi+ LoRa(TM) Expansion Board

WP_20160510_08_57_22_Rich.jpg

Somewhere in April we started on developing the Uputronics gateway version of the single channel gateway made by Thomas Telkamp and it was finished beginning of May 2016. This was still the single channel one and shortly after we modified the code so it could support both RFM95 chips for 2 downlink channels.

Later in 2016, we wanted to demonstrate uplink functionality to the TTN network as well so we adapted yet again the code so it would support up and downlink and also some extra features, including:

  • Config file for Pin definition, network interface (eth0/wlan0)
  • Service for systemd (debian jessie minimal)
  • Install service using make install and make uninstall
  • Control for On board Led’s CE0, CE1 activity, Internet and Lan sensing
  • Sensing network interface connectivity
  • Counter for packets received and sent since last start
  • Downlink support in a separate thread
  • LoRA functions in separate file
  • Compile time variables in header file
  • Will support ABP and OTAA (latter not completely due to channel restraint)

You can download the Gateway software from Github here: link


14 reacties op ‘The Things Network dual-channel up&downlink gateway

  1. Hi Hans,

    your code doesn’t work for me (Dragino LoRa/GPS hat on RPi3, see output:

    Jun 25 17:40:28 RPiSIX systemd[1]: dual_chan_pkt_fwd.service holdoff time over, scheduling restart.
    Jun 25 17:40:28 RPiSIX systemd[1]: Stopping Lora Packet Forwarder…
    Jun 25 17:40:28 RPiSIX systemd[1]: Starting Lora Packet Forwarder…
    Jun 25 17:40:28 RPiSIX systemd[1]: Started Lora Packet Forwarder.
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Unrecognized transceiver: Success
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: server: .address = router.eu.thethings.network; .port = 1700; .enable = 1
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: server: .address = router.eu.staging.thethings.network; .port = 1700; .enable = 0
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Gateway Configuration
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Dual Channel Gateway (contact@whatever.com)
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Dragino LoRa/GPS hat on RPi 3
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Latitude=50.69827271
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Longitude=6.09635305
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Altitude=274
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Interface: wlan0
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Trying to detect module CE0 with NSS=6 DIO0=7 Reset=0 Led1=unused
    Jun 25 17:40:28 RPiSIX dual_chan_pkt_fwd[8181]: Transceiver version 0x00
    Jun 25 17:40:28 RPiSIX systemd[1]: dual_chan_pkt_fwd.service: main process exited, code=exited, status=1/FAILURE
    Jun 25 17:40:28 RPiSIX systemd[1]: Unit dual_chan_pkt_fwd.service entered failed state.

    Seems that transceiver could not detected.

    Kind regards,
    Hans

    Like

  2. I’m using same setup, RPi3 with uputronics 2x Hope RFM96 LoRa chip. I installed your dual channel packet forwarder from github. RXing works fine, i see both channels with chip CE0 and CE1 working with my TTN node. But i don’t see any TXed packets on the gateway (checking syslog entries), wenn i send downlink data from my TTN application to the node. How can i verify / debug the downlink function?

    Like

  3. i checked journal of dual_chan_pkt_fwd and traced udp prot 1700. I see the “rxpk” entries in the journal and on port 1700. But there is no “txpk” traffic. So it looks like that TTN does not route TX traffic to the gateway. The tx frame counter in the ttn gateway console page sticks to 0. Don’t know what’s going wrong here. There should be no other TTN gateway in range of the test node, so i expect TTN to deliver TX traffic over my gateway. But no traffic for some reason.

    Like

    1. Please check the settings of your firewall/router. You need to be sure that the gateway can go outbound on udp port 1700 for uplink and the router/firewall routes inbound 1700 udp to your gateway for downlink.

      Like

  4. Hi, im triying to run your code but im failing i dont know why, in the first test only detect me one of two rmf95, i dont have the uputronics hat but i have two rfm95 im put the connection in the place that you put in the global json conf,
    unfortunately dont recognize nothing 😦 and i dont know why, i understand the wiringpi map i have a raspberry zero and is the same that a raspberry pi, please help me!

    Like

Geef een reactie op lefebvre Reactie annuleren