Dragino Raspberry Pi Hat - SPI

Hello everybody,

i just bought a Dragino Lora / GPS Hat for the Raspberry Pi to set up a LoRa Node, but i don’t seem to get it to work anymore since last week.
The library i used is: GitHub - dragino/lmic-rpi-lora-gps-hat: Hardware Abstraction Layer (HAL) for IBM's LMIC 1.6 communication stack targeted to RPi and Dragino LoRA/GPS HAT.

Neither the ‘periodic’ Example, nor the ‘hello’ Example is working. The Error Message i get is the following:

000000000 HAL: Initializing …
HAL: There is an issue with the SPI communication to the radio module.
HAL: Make sure that
HAL: * The radio module is attached to your Raspberry Pi
HAL: * The power supply provides enough power
HAL: * SPI is enabled on your Raspberry Pi. Use the tool “raspi-config” to enable it.
000000003 HAL: Failed. Aborting.

SPI is enabled and WiringPi is installed.
I’ve tried to get it working with a Raspberry Pi 4B and a Raspberry Pi 3B+. There is no difference.
Does anybody know where the problem could be?

Besides that, would you recommend to use an Arduino with the LoRa Shield instead of the RPi Hat?

Thank you very much.

You are using a steam-powered version of the software that is so old that it should be in a museum by now.

Very few people have a Pi driving the SX1276 radio chip because of the precise timing requirements of LoRaWAN. But you could take some of the directions from the Dragino archive and use the latest LMIC (which is mostly targeted at Arduino):


hi did you ever get this working, as I have the Dragino hat and struggling to get it operational?

I am trying to test TTN v3 and creating an end device using a Raspberry Pi or Arduino in the 915 MHz spectrum. I tried the adafruit RFM95W (Adafruit LoRa Radio Bonnet with OLED - RFM95W @ 915MHz [RadioFruit] : ID 4074 : $32.50 : Adafruit Industries, Unique & fun DIY electronics and kits) and Circuitpython library, but it looks like the board is unsupported with TTN. Are there other recommendations for the Pi?

What are you trying to build? For a gateway there is plenty of choice, a TTIG probably the cheapest one. For an end device you could just try to wire another controller, for instance an ESP32, to your board.

There are no recommendations for the Pi that controls a radio directly unless you compile a realtime kernel for your distribution so that it can react in a timely fashion. This has always been the case.

There are modules like the Pi Supply RAK811 module that provide an AT interface to an MCU with radio. More up to date modules like the Seeed LoRa-E5 come with a AT out of the box, you could look for an implementation for Pi.

Fundamentally LoRaWAN is tiny tiny tiny packets of data, so typically anything you can do on a Pi isn’t a great fit to get the data home. Apart from ANPR, that works nicely.

I am testing out Lorawan as an option for a farm based tracking application. I am using the RAK 7243 as the gateway and wanted to build a prototype end device to test the wireless range that I can achieve. Can you elaborate more on the ESP32 option?

Thanks! This is getting pretty complicated :slight_smile: It looks like Seeed has a Pi hat - however it is out of stock:

Would you recommend the Lora-E5 with an arduino instead?

That Pi hat is for a gateway module (does not include one). Not an end device.

WRT the ESP32 solution, get an ESP module and wire it to the hat so the RFM module is connected to the ESP, get LMIC-node (for instance), to check what needs to connected to what.

For an E5 module you could use https://www.seeedstudio.com/Grove-LoRa-E5-STM32WLE5JC-p-4867.html and just wire it to GND,3V3,rx and tx. A Python serial library and some Python code should get you sorted to send your first packet.

Awesome! I’ll need to think about which one is a good option. What route would you take?

Another aspect of my project is to reveal Lorawan communication (i.e., channel level detail, packet details etc.). I am assuming you are referring to

for LMIC-node. Would this help me for my objectives?

Both me & Jac can use what ever fits the best use case. More information from you will help us find a good match for your use case.

Yes, no, but not until you cover the Learn section linked at the top of the page - you are currently fishing and ending up with all sorts on your hook. You’ve found a gateway hat when you needed a RAK811, The LoRa-E5 has its own MCU on it so it depends on which model of LoRa-E5 you pick, you could just use the Grove version with an Arduino over a serial line or you could link it to the Pi & use Python. If you go with an ESP32 and LMIC-node you will be coding the LoRaWAN stack directly.

Your objectives are going to be spelled out in considerable detail as it’s not clear what you hope for by “channel level detail, packet details” - we don’t tend to get too wound up with which channel a device uses for an uplink and packet details are available in various forms. So this sounds like a research project, it would be appropriate to say so if that is the case.

It would also be useful if you can tell us what you normally code with - Python, C, C++, Haskell, Go etc etc so the hardware can match up with skill set.

Yes, it is a research project in analyzing the practical use case for Lorawan. You are right that at this moment, I am fishing for the right hardware/software to work with. I had a tough time with the adafruit board that I referred to earlier in getting a packet to the gateway (gateway did not detect any packets send by the Python code running on the Pi), so it would be nice to know what channel the node is transmitting at for debugging purposes - same with packet level details.

I am comfortable with Python and C. I appreciate your input to finding the right match. Thank you!

I’m 100% sure there is a practical use case for LoRaWAN, so again, your objectives are still unclear.

As the issue with an out-of-the-box linux kernel is timing - that is the kernel or a process may cause other software, like the LoRaWAN stack, to miss the moment it needs to tell the radio to start listening - there is nothing stopping your Pi from sending ABP uplinks or Join-Requests - which should then be seen on the gateway. So something is wrong with the setup you have. But we don’t know what library you are using or instructions you have followed so it’s very hard to comment and that makes my crystal ball cry because it only works when it has some hints.

LMIC-node lists all the boards that it supports and is the closest thing to no-brainer that has been produced and is likely to be produced for a DIY device. Due to the complexities of all the different MCUs that are available, it doesn’t do sleep / low-power mode but on the forum & GitHub you will find people that have done adaptions for various boards to support sleep. Once you have LMIC-node working you can progress to using LMIC in the raw, having found an MCU that does what you need and has easy access to sleep, assuming that’s a requirement.

For starting out I’d recommend the Adafruit Feather M0 with RFM95. It requires a link to be soldered for it to work with LoRaWAN (full instructions on the Adafruit Learn site) and is supported by LMIC-node and LMIC. It costs more than some of the potential combos that may catch your eye, if it has less than 48K Flash & less than 3K of RAM you will have a fight on your hands squeezing it on to the MCU, so just don’t try. The ESP32 boards do not do sleep without some experienced configuration.

You need to read the Learn section linked at the top of the page.

1 Like

Great! Thank you so much - this is really helping.

As for my current setup, I am using a similar board (Adafruit LoRa Radio Bonnet with OLED - RFM95W @ 915MHz [RadioFruit] : ID 4074 : $32.50 : Adafruit Industries, Unique & fun DIY electronics and kits) and the CircuitPython library. Instructions are LoRa Raspberry Pi Setup | LoRa and LoRaWAN Radio for Raspberry Pi | Adafruit Learning System. I did see the warning about the library not supporting single channel forwarders, so figured that must be for the gateway, and not an end device.

Just to be sure I understand what you are saying - the feather M0 has the same radio as the one that I have, but it is physically suited for a MCU as opposed to a Pi like mine, correct? I looked at the feather setup guide, and that too may be deprecated according to the website (Arduino Wiring | Using LoraWAN and The Things Network with Feather | Adafruit Learning System).

I will look into the Learn section. I am not new to Lorawan but not too familiar with the hardware side of things. A quick look at the section shows me topics on Lorawan but not on articles on hardware selection or guides to setting things up. I remember TTN used to have how-to guides but I can’t seem to find them anymore.

You said you know LoRaWAN, what is the difference between a device and a SCPF (gateway)?

Is this a quiz? :slight_smile:


A typical gateway is 8-channel is what my understanding is as opposed to a single channel. End devices are half duplex data devices that typically only transmit.

If the message relating to gateways is of concern, perhaps this corporate device offering would be more reassuring: