LoRaWAN Adventures with the SX1303

As already told on the last and latest IoTHappyHour, I had some experience in working with SigFox. For those who don’t know: It was basically the competition to LoRa, however with providers similar to Cellphone companies and “company installed cellular towers”. If you look at the coverage map, this technology is quite well established in europe - but not yet existing in the US: Coverage | Sigfox
And its also a bit sad, because you have no control over your data - let alone having all the stuff open source and enable the user to create their own gateways…

So… after the long run I thought: “Maybe I try LoRa too”. The only thing that really kept me away, was cost: I friend of mine actually asked me today: “Why the hell is this stuff so expensive?” - and I actually have no answer for this. Spoiled by ESP8266 and other modules which run for just a buck per module - and are not really expensive as devboards, LoRa ones quickly run up to 20 bucks or more - per piece. Thats without a sensor or anything. Time will tell if this can get down :slight_smile: .

However - I thought the time is right. And right it is - the new SX1303 module backed Gateway has been introduced in form of the RAK5146 - the latest and greatest in gateway technology. I meant - if I am spending more than 100 bucks for a module, I also wanted to have the latest one.

The problem with technology, especially “bleeding edge” one is the fact that for most of the time, nothing is “turn key” and ready. While the “old” SX1302 / RAK2287 module came with its own RPi Hat and everything, this module is very naked. There is a high chance that the SPI version of the module might work with the RAK2287 RPi Hat - however, the SX1303 includes a new technology called L(isten)B(efore)T(alk) to reduce crosstalk. And LBT is only available on the USB version, which is currently not supported for balena. And it does NOT work with the RAK2287 RPi Hat, which does only connect the SPI bus (for the module), the UART (for the GPS module) and power.
(Basically adding a RAK USB module to the SPI/RAK2287 hat might either not work or damage both the RPi and the module, so please don’t try that).

The first thing after ordering the RAK5146 with USB, LBT and GPS was trying to find the “missing link” to even be able to plug this module into something and connect it to the PC. Luckily, Mini PCI-Express does support multiple protocols, among one is just basic USB. And as the RAK5146 does work with that, I found these two converters:

Module One
Ali -

Amazon (de) -

Module Two / Hat

Amazon (de)

Basically both are Mini PCI-Express USB to USB converters.
In theory, you just need to plugin the RAK5146 (USB version) and also plugin a Micro USB/USB C to the other side - and the other end to you Raspberry Pi and it will make a connection.

Please be aware:
a) the first module comes with antennas. They are for LTE/GSM and might kill your module, as its with the incorrect wave length. In EU, e.g., I need 868 MHz ones and are salvaging some antennas from my SigFox devboards for the LoRa Signal. the GPS module build into the RAK5146 with GPS is actually a ZOE-M8Q - thats not a pure GPS, but a GNSS receiver. For the second antenna, you will need to buy an external GNSS antenna, if you want to use it with this enclosure.

However, I choose the second / head version one. Why? Because its cheaper and could be mounted onto the RPi. Also, both antenna connectors look like RP-SMA ones instead of the SMA antenna I got around here, so… I would need to replace them anyway. Also, its smaller, got USB-C as connector and can be easily mounted - and if I want an enclosure, I just print one :wink:

So, currently in the mail pipe is the RAK5146 USB with LBT and GPS, the RPi Hat, additional “pigtail to SMA” connectors, a short 15 cm USB-C to USB-A cable, an external, active GNSS antenna and 2 CubeCells - because I am inpatient. I also received 6x RFM95W modules today, which I can use to design my own sensors and will probably abuse a big part of the Tinynode design - if I find the time.

Now all we need is to wait about two weeks for the stuff to arrive, plug everything together and see what works - and what doesn’t :slight_smile:

Cheers,

Nico

2 Likes

This is not correct @nmaas87 :slight_smile:

balena supports USB concentrators. However it’s not supported by the original basicstation repository made by Semtech. Having said that, we are looking for developers from the community to contribute on this :wink:

And why don’t you try this concentrator with the Fin USB mPCIE?

Thanks @mpous for the correction.
Yeah, I just found the RAK Gateway repo ( https://github.com/RAKWireless/rak_common_for_gateway ) and it seems to support all kinds of different RAK devices. I think as soon as the module arrives I will start testing in this way to (hopefully) get it up and running.
However, I did open up a ticket on the original repo, asking for support: https://github.com/lorabasics/basicstation/issues/121
However, they did not support the SX1302 via USB yet… Maybe because of LBT only available on USB, this could be the thing needed for them to move forward…

I guess I will also try it with the Fin when I got it here - but its always good to be able to just use the module independently for quick testing (e.g. on a big Laptop with Linux :slight_smile: ). But still… lets see when the module arrives.

For completeness sake, there is also a “manufactured” USB dongle solution from RAK with either the RAK2287 or RAK5146 in it - RAK7271/RAK7371 Portable Developer LoRaWAN Gateway | SX1302/SX1303 LoRa Gateway Solution – RAKwireless Store - however, there is no info on whether the RAK5146 version comes with LBT support or not. From the manual, which states that it does only come with one antenna (the LoRa one) - I think these modules are also without GPS. Hence I more happily build such a dongle myself with the parts shown above (Extra bonus: You can just plug it into any WWAN mini PCI-E slot on your Fin or Laptop and it should work)

1 Like

Awesome! looking forward to see this project balenified :wink:

So, yesterday I received two CubeCells as well as some other hardware (the Geeek Pi WWAN Hat, some SMA/U.fl Pigtails, a very short USB A/USB C cable for the hat, an external active GNSS antenna). Today I tried a CubeCell - I was sure I had no available LoraWAN node in my area - but https://ttnmapper.org/ showed me otherwise. However… trying it with one of the CubeCells and even a stronger antenna, I could not receive anything. So the “real” map on the main thingsnetwork site is correct and there is “just nothing” in this area. I am still waiting for my RAK5146 to ship and I must say I am a bit disappointed by RAK: There was no indication that it wasn’t in stock and I received no email whatsoever about checkout / shipment or similar, even though I opted into everything. Maybe it was just the weekend :wink: - but I am sometimes very impatient when it comes to new tech and toys :laughing:

1 Like

Take it easy and keep us updated :slight_smile:

1 Like

Having said on Sunday that I got no info about shipment - changed on monday - and already on tuesday I got my card. So I need to say I was surprised by FedEx performance - only RAK needed 3 days to actually reflect on that :wink:

So, yesterday evening I put the RAK5146 into my Mini PCI Express to USB connector and tried to install the gateway ( https://github.com/RAKWireless/rak_common_for_gateway ) to a freshly installed Raspberry Pi OS Lite. I actually figured out a lame error (execution bit for the installer for RAK5146 was not set, so the overall setup failed…) and send a PR for that. I could install the overall system with a packet forwarder to TTN and also received some of my packets from my CubeCell. Nice! However - this was not stable. The packet forwarder tells me its working, but… it does not receive anything from the CubeCell. I don’t know what broke, according to TTN the gateway is online, but it does not react to anything. Powercycling does not help and the CubeCell also seems to be fine.

Outside of this scope, I felt the really painful area of not having a specializied hat for the RAK5146 USB version. Only the USB version comes with LBT, so I got that. But miniPCI Express interfaces like implemented on my converter board or the balenaFin only can use the USB part - the rest of the RAK5146 interface is actually laid out in a way that it does not interfere with a “real” miniPCI Express interface and does give out all important interfaces on reserved and “dead” pins of the header. Like the i2c and uart interface which you will need to the GPS to work. Like the PPS pin you will need to get GPS working with the needed precision. Its really sad that neither a hat nor firmware (like for the RAK2287 RAK2287 Quick Start Guide | RAKwireless Documentation Center) is available at launch, making this product not yet useful for the “not-tinkerer/hacker”.
I am currently thinking about soldering the needed cabling for the GPS support myself onto the carrier and route it manually to the RPi, which seems to need this input.

It also makes clear, that the RAK7271/RAK7371 does not have a GPS output on the rendered box, because its probably just the stripped down “USB without GPS” version - but its still unclear if its the LBT enabled version, or not.

So I am still looking for a really working software for the baking hot board - and thinking about soldering to these really small miniPCI Express pins to get more usage out of the board :laughing:

1 Like

@xoseperez maybe you are interested on this :point_up_2: :slight_smile:

1 Like

OK, I actually spent too many hours on my RAK5146-226 - but got no consistent results.
The USB Hat and the balenaFin basically give access to the modem itself, but not the GPS or GPS-PPS signal - and the reset seems to be handled via the USB controller chip that does the SPI conversion. I did not get replies to some questions I asked in the form, neither to the emails I wrote. I am actually a bit astonished to see a company as big as RAK pushing out a product for sale without any support or having the needed ecosystem in place to support it / run it.

I have not yet used another product by RAK, only heard good things about them - and I hope the situation will change for the better, but for this moment in time, the RAK5146 is just not usable.

Lets get into it:
a) Schematics/Block-Diagram
The first thing I try to understand is - how is everything working on a hardware level / connected before I even try to look into firmware files. Mind you, there are multiple versions of the RAK5146:

  • SPI (always without LBT)
    • with GPS
    • without GPS
  • USB
    • with LBT
      • with GPS
      • without GPS
    • without LBT
      • with GPS
      • without GPS

RAK only provides one - hell of a lot - bad diagram for that: RAK5146 WisLink LPWAN Concentrator Datasheet | RAKwireless Documentation Center - you can not figure out what is actually available on my RAK5146-226 (EU868, USB/LBT/GPS version) on which pinout of the miniPCI Express.

b) The Pin situation
After going back and forth I am thinking it should be like this: even if using the USB version (and hence no GPIO pins available, meaning no GPS I2C, no GPS UART, no GPS PPS), the SX1303 module should still be internally receiving ONLY the PPS signals - and you cannot use the normal time them for your RPi or balenaFin if you not craft your own adapter board. (“UART and I2C Interface - RAK5146 integrates a ZOE-M8Q GPS module which has UART and I2C interface. The PINs on the golden finger provide a UART connection and an I2C connection, which allows direct access to the GPS module. The PPS signal is not only connected to SX1303 internally but also connected to the golden finger which can be used by the host board.”) - so from the block diagram it looks like the GPS module has no connection to the SX1303 other than the PPS one.

The RAK5146 USB(!) firmware however needs the GPS via UART/I2C to timesync - so… you’re in a bad spot there. I am actually now adding a second GPS module to the balenaFin to get a current time, because NTP sync is not “good enough” (even though the source code only parses the NMEA sentences, so it is not even getting “sub-second timing”, while the SX1303 gets PPS from its module…). So this scenario is hardware design and firmware-wise just… no.

c) I installed the best thing I could find ( https://github.com/RAKWireless/rak_common_for_gateway ) - followed their guide - and no data was received at TTN. I manually changed the server_address in the config file and restarted and got the thing online - but the documentation did not call me to do that and I had to figure this out on my own. I wonder what else might be wrong in their global_config and similar json files their lora_pkt_fwd uses?

d) TTN performance
I got two CubeCells with me and tried a lot,… sometimes the board receives something, sometimes not. I tried the last 4 days like… every available angle - and best performance of the RAK5146 is - that it works like… unreliably a bit - then again not. Running it through the night reveals massive drops, like 20 or 100 packets lost regarding the frame counters.

So, the disappointment is really there - I was looking forward to finally be able to plant my sensors with LoRa within my own walls and take readings every 5-10 minutes - but it looks like for hours the gateway does not work a all, then again a bit, then nothing.

What would be needed to fix this?
a) Clear block-diagram, instructions and how tos to get this thing working under both situations (SPI and USB versions)
b) Official, tested and working firmware
c) An RPi Hat to be able to really use the LBT version (its only available with USB!) and GPS to its complete potential. Its bad if you buy stuff (like with GPS module) and cannot use it. I wonder how other “normal” WWAN gateways will be able to use this - probably not at all…

Its a rough ride and I hope RAK follows up and helps with the situation.

Cheers,

Nico

2 Likes

Hi there,

I’m Jose, Solutions Architect at RAK. Marc Pous kindly pointed me to your post here. Sorry you are having a bad experience. I just saw you post in our own forum last Friday, unfortunately the RAK forum team doesn’t usually work over the weekend so I think that’s what happened here.

The RAK5146 is a new product and still considered a little bit specialised, in that it works great for customers who understand it (we have customers buying 1000s of them right now) but maybe not ready for general use yet. I think other companies would probably mark it as Professional product or OEM but that’s not so common at RAK, although not a bad idea to introduce those designations.

For general use right now I’d definitely recommend the RAK2287 instead.

For the RAK5146 USB version you will not have access to the GPS or PPS signals using a generic USB miniPCI adapter, you’d need a specialised HAT which we don’t currently offer. For example for PPS you need access to pin 19 on the miniPCIe edge connector.

Outside of the fine timestamping function the standard SX1302 HAL from Semtech should work over USB: https://github.com/Lora-net/sx1302_hal this will give you the packet forwarder

Note none of the balena repos will support the USB version either

2 Likes

Hi Jose,

thanks for the answer.
As far as I see it, it looks like your linked repo was include in the one from RAK for implementing RAK5146 support ( https://github.com/RAKWireless/rak_common_for_gateway ).

It is understood that it is a new product, but given the correct drivers and implementation, the RAK5146 USB should be working without issues.

At the moment I am not able to achieve this in a consistent form, neither with a balenaFin running Raspberry Pi OS Buster, nor a Raspberry Pi 4 running Buster using the USB miniPCI Express adapter. In both cases, the lora_pkt_fwd is online without issues, but does only receive data from both CubeCells when it “feels like it”. I don’t know it the RAK5146 unit sent out to me is actually just DOA in some form (its also running the 1.0.0 firmware which was preinstalled) - but it does not look good.
I am just thinking about how to diagnose the problem further and how to get it working.

Cheers

1 Like

I think your miniPCIe adapter may be interfering with the operation (maybe the MCU_RESET pin is connected through the edge connector and causing sporadic resets)

If you are using a board with a Pi HAT pinout your best bet is to get our RAK2287 HAT Connect concentrator modules to Raspberry Pi using the RAK2287 Pi HAT – RAKwireless Store. This will route the GPS pins to the Pi while keeping the other safely.

Then you can connect the Pi to the RAK5146 USB via the microUSB connector you see on the HAT (using a standard USB-A to MicroUSB cable)

Where are you based? Feel free me to DM me your address and I’ll see if we can forward one of these HATs to you.

3 Likes

Thanks Jose,

I sent you a PM - thanks for your support!

OK guys, I have a tons of updates, but I will start small.

The “RPi Hat” from Jose
I sent @jmarcelino my contact data a week ago - haven’t heard from him since, but I really hope he is going to send me one of his RPi Hats and let me test if this does help out. Fingers crossed :slight_smile: - because if my unit would be really DoA, this would even hurt more if I have to have it replaced, as… seen with the next point X.x

German Tax Situation / Warning for direct orders from RAK
A fair warning to all german companies and individuals thinking about buying at RAKs store - RAK does sadly not yet handle the 01.07.2021 changes to postal services / imports from non-EU states into Germany, which means your delivery will become more expensive than you thought. I bought my RAK5146 for 99 USD, plus 24.37 USD shipping (and got 10 USD off with code WELCOMEBACK10 - which is available on the internet, thanks RAK!). The card arrived in less than a week - and now, two weeks after the delivery by FedEx I had to pay additional 32,99 USD in taxes. Problem is that, if the company does not take care of our “VAT” / Umsatzsteuer and register this parcel at our customs - you will need to pay a handling fee with FedEx and additionally 19% of the overall cost. Thats if you’re staying below 150 € (currently about 175,87 USD total) - otherwise it will become even more expensive and more taxes will apply.

Other companies from China like Banggood and Aliexpress now have a solution in place, so if you’re buying for less than 150 €, I would suggest trying to order from RAK Wireless official store at Aliexpress - or your local seller. However, I could not yet find a german reseller, so… just a fair warning. Its not the love letter you want to find weeks after the fact in your mail :frowning: .

Gateway EUI on the rak_common_for_gateway
That was a cool one. I was doing multiple installations of the gateway software on different sd cards, because sometimes the RAK Wireless repo broke on install. Funnily, the Gateway EUI (so the “Serial number” at TTN) always changed. So I asked @mpous for that. According to his code, the Gateway EUI is computed from the active network card of your SBC. Which is interesting. This did match my second installation (the official firmware, see below) - but not my first installation. And my first install, which had a nice name registered on TTN right now (which I did not wanted to give up :wink: ) - that did not work…

So! Where the soldering iron is the GW EUI coming from on the https://github.com/RAKWireless/rak_common_for_gateway installation? Easy!

You always have the nice gateway-version command… Which is showing you the ID you want to know…

pi@rak-gateway:/usr/bin $ gateway-version
Raspberry Pi 4 Model B Rev 1.1, OS "10 (buster)", 5.10.17-v7l+.
RAKWireless gateway RAK5146 for USB version 4.2.7R install from source code.
Gateway ID: XXXXXXXXXXXXX.

If you look for the command with “which” you find out… its actually a shell script in /usr/bin/ -and its doing:

GW_ID=`do_get_gw_id_from_json`

from the rak_common “shell script library”

/usr/local/rak/shell_script/rak_common.sh

which means

do_get_gw_id_from_json()
{
    if [ -f /opt/ttn-gateway/packet_forwarder/lora_pkt_fwd/local_conf.json ];then
        GATEWAY_EUI=`do_get_json_value gateway_conf.gateway_ID /opt/ttn-gateway/packet_forwarder/lora_pkt_fwd/local_conf.json`
    else
        GATEWAY_EUI=`do_get_json_value gateway_conf.gateway_ID /opt/ttn-gateway/packet_forwarder/lora_pkt_fwd/global_conf.json`
    fi
    echo $GATEWAY_EUI
}

turns out there is a file

cat /opt/ttn-gateway/packet_forwarder/lora_pkt_fwd/local_conf.json

with just my gateway ID

{
        "gateway_conf": {
                "gateway_ID": "XXXXXXXXXXXXXX"
        }
}

So what did we learn today?
If we do a new installation from the repo, we can just put a file in /opt/ttn-gateway/packet_forwarder/lora_pkt_fwd/local_conf.json with out gateway_ID and keep that - so we don’t lose it on TTN :slight_smile:

Official Firmware
Taylor from the RAK Wireless Repo ( https://github.com/RAKWireless/rak_common_for_gateway/issues/58 ) made an official firmware for the RAK5146-USB available: RAKwireless Downloads
It does not really come with a how to - should be nearly the same as the other official firmwares - but seems to have some issues. E.g. connecting to the RPi AP worked with “rakwireless” as password, but I could not access the http://192.168.230.1/ for the website… Chirpstack seemed also to not work and TTN worked after some… fiddling and replacing the server_address as already told. So its not yet perfect, but its a starting point for those not wanting to “directly” build by their repo.

Closing words
I still got more to come and as you see, it takes quite some time out of my busy weeks, but I really hope to get it working. My current fears are that my concentrator is a DoA and I have to send it back - which would be nearly as expensive as buying a new one. Without another working LoRaWAN concentrator at my hands (which I could also work with…) its really hard to diagnose the problem, but buying an RAK2287 SPI with RPi Hat (which would have been the sensible choice) would set my back additional 175 - 200 USD so… Kind of a rock/hard place situation. Lets hope for the best and maybe RAK support… pretty please? :sweat_smile:

1 Like

Hi there, I promised more updates like 19 days ago, but never came around to writing everything down. So… lets get back into business :3

Official Firmware
I have played around with the firmware and to get Chirp Stack running, I got you this “How to”, as there was none provided for this specific firmware 19 days back :slight_smile:

Steps done:

1.) Downloaded latest firmware from here: RAKwireless Downloads

2.) Flashed with balenaEtcher to 8 GB SanDisk SD Card - booted in RPi 4B+, 4 GB with attached RAK5146-USB / 5146-226

3.) Connect to wifi Rakwireless_EB6B with password rakwireless and get IP ( here with me 192.168.230.59) with DNS/Gateway at 192.168.230.1

4.) Trying to access https://192.168.230.1 or http://192.168.230.1 does not work, so I did an nmap / portscan

Starting Nmap 7.92 ( https://nmap.org )
Scanning 192.168.230.1 [1000 ports]
Discovered open port 8080/tcp on 192.168.230.1
Discovered open port 22/tcp on 192.168.230.1
Discovered open port 53/tcp on 192.168.230.1
Discovered open port 8000/tcp on 192.168.230.1
Discovered open port 8001/tcp on 192.168.230.1
Completed SYN Stealth Scan at 12:54, 0.52s elapsed (1000 total ports)
Initiating Service scan at 12:54

→ finding out ChirpStack runs on http://192.168.230.1:8080/ [ user admin, password admin ]

→ finding out SSH runs [ user pi, password raspberry ]

5.) connect to chirpstack, create networkserver, create serviceprofile, create gateway (with gateway-version EUI), sudo gateway-config and set gw to EU_868 Mhz and localhost as address.

Also, if you reconfigure the firmware to TTN, please bear in mind the “RX2 SF12” option upon creating the gateway in TTNv3 (TTN recommends RX2 SF9, but RAKwireless recommends SF12, so please choose this, as RAKwireless knows probably more about how to use their hardware than TTN :wink: )

Creating your own RFM95 Breadboard-y
The RFM95 or similar boards are awesome for getting into LoRaWAN. Getting these via Aliexpress is cheap and easy - but they got a special pinout which is not breadboard compatible.
But you can easily “adapterize” your boards for usage with your breadboard, using some “silverwire” as seen below:

Overview of silverwire, soldering iron and solder

Bent some wire …

Attach it through the eyes …

and hold it through your solder rolls weight and solder all pins …

until done :slight_smile:

and then you can use it - best for prototyping

(this technique also is usable for some other ZigBee / ZWave Modules or similar which come in same spacing and form factor :slight_smile: )

The “RPi Hat” from Jose
I reached @xoseperez more than a week ago that he got hold of @jmarcelino which was still thinking of me and wanting to send me the RPi Hat for testing soon, but not heard anything since he wrote me the offer about 1 month earlier. Sorry for that, I would have loved to put in anything better, but I am still left dangling. I will post my findings on the RAK5146 USB on my weblog with its initial performance - and do my upcoming talks to the TTN community in this state. I will adjust the reports accordingly if I get the Hat, no worries :slight_smile:

Cheers

Nico

1 Like

@nmaas87 Hey Nico, did you ever get this working with a Fin? My RAK5146 just arrived and I’m eager to get it running w Basicstation on a Fin.

1 Like

@barryjump is your concentrator SPI or USB based? :slight_smile:

USB :muscle:

2 Likes

I struggled for a few days with a 2287 SPI not realizing that it wouldnt work with the fin :cry:

1 Like

Short answer: Yes
Long answer: Only LoRaWAN, you will not be able to use the GPS module (if you got one on your RAK5146).

When I started my work with it, there was no official firmware available, so I just flashed the latest Raspbian Lite onto my Fin (there are especially premade Raspbians from belana somewhere which include also the dtbs for Fin etc) - upgraded them to latest Buster (I think they were still stretch) and then installed from the GitHub - RAKWireless/rak_common_for_gateway repo.

Maybe you could also just flash the official firmware and use that - could work, but I haven’t tested it yet.

Also I am still waiting for word from Jose and Xose who wanted to send over a hat for testing against mine - so that I could make a full tutorial, but no word yet, sorry :frowning: