Node based on Raspberry?


(sam bruurs) #1

Does anyone know if there is sourcecode available to connect a RFM95W (SX1276) on raspberry and use it as a node ?


Lora sensors from raspberry RFM9x
#2

I made a port of the IBM LMIC code to Raspberry. It's not fully finished, but seems to work.

It's on https://github.com/ernstdevreede/lmic_pi.

Let me know if you run into problems.


(sam bruurs) #3

Thanks Ernesto! Just tested and it works like a charm!

What are you planning to add ? (because you said it is not fully finished)


#4

There is an issue I have to fix with the internal clock (hal_ticks() in hal.c) (it wraps after some hours, long-pausing or hanging the program).
I also want to add a more realistic code example .
I will soon add the fixes to the repo.


(Gary Mortimer) #5

Could I twist your arm to add GPS.... My single channel gateway running on a Pi also keeps hanging I have a sense its power glitches.


(sam bruurs) #6

I also have a single channel gateway running on PI for several days now. How much time before it crashes ?

Also a 2Amp power supply is best to run a PI on.


(Gary Mortimer) #7

Less than 24 hours, yesterday I swapped the SD card out as well just in case it was that


(sam bruurs) #8

Ok, A good way to determine you have power glitches is to verify that you can use any USB devices. If not, you had a glitch. (Also the LAN network is working through the USB controller on the Raspberry)

I doubt if the SD card is using up much power.


(Gary Mortimer) #9

Ah USB does hang so that's interesting. I thought the card might be a bit dodgy rather than it was using power.


(sam bruurs) #10

Just power your PI with a 2 Amp adapter and you'll be fine.


#11

We have a Raspberry Pi board for the Pi-Zero based on the RN2483 LoRaWAN module. One of our community members is making good progress with it.

Pi-Zero LoRaWAN

Thanks

Andrew


#12

Awesome Andrew, I think that's a fine combination for a node, hope to see more soon!


(Gary Mortimer) #13

@ ernestopace a noob question, how would I change the frequency to 433.175 using an RFM 98(1278)

I assume its here somewhere

define CFG_sx1276_radio 1

define CFG_eu868 1

Many thanks for your time


#14

The LMIC code only supports 868.1 and 915 MHz.
The chip might be compatible with the SX1276, but I can't help you with all the register values for specifying frequencies etc.

Good luck.


(Gary Mortimer) #15

Blast, seems like its difficult to be legal elsewhere! I guess the majority of devices as they roll out will be in the 868 or 915 range which will cause issues as those frequencies are used for other things here. Thanks for your time answering though.


(Gary Mortimer) #16

Actually looking at the ISM band plan more of the world uses 433 than 868/915 so maybe I'm wrong!


#17

I`m trying to build a RaspberryPi node to test a gateway using a hello packet. But i cannot get it to work (yet)

I have an RFM95 with the following pin-out

3v3 = VCC
GND = GND


GPIO10 = SPI_MOSI = MOSI
GPIO9 = SPI_MISO = MISO
GPIO11 = SPI_CLK = SCK

GPIO8 = SPI_SEL  = nCS

To play with https://github.com/CongducPham/LowCostLoRaGw. So if it is possible to use this pin out it would be nice

I`m facing some dependency issues

root@raspberrypi:/home/beheer/lmic_pi-master/lmic# make all
g++ -c -o aes.o aes.c
g++ -c -o hal.o hal.c
g++ -c -o lmic.o lmic.c
g++ -c -o oslmic.o oslmic.c
g++ -c -o radio.o radio.c
radio.c:526:19: error: type ‘<lambda>’ with no linkage used to declare function ‘void<lambda>::operator()() const’ with linkage [-fpermissive]
radio.c: In lambda function:
radio.c:526:21: error: expected ‘{’ before ‘=’ token
radio.c: At global scope:
radio.c:526:21: warning: lambda expressions only available with -std=c++0x or -std=gnu++0x [enabled by default]
radio.c:526:44: error: no match for ‘operator=’ in ‘{(._88)0u} = 192’
radio.c:526:44: note: candidate is:
radio.c:526:19: note: <lambda()>&<lambda()>::operator=(const<lambda()>&)
radio.c:526:19: note: no known conversion for argument 1 from ‘int’ to ‘const<lambda()>&’
radio.c:527:17: error: type ‘<lambda>’ with no linkage used to declare function ‘void<lambda>::operator()() const’ with linkage [-fpermissive]
radio.c: In lambda function:
radio.c:527:21: error: expected ‘{’ before ‘=’ token
radio.c: At global scope:
radio.c:527:21: warning: lambda expressions only available with -std=c++0x or -std=gnu++0x [enabled by default]


#18

The used pins can be configured in the lmic_pinmap struct; see for example examples/thethingsnetwork-send-v1/thethingsnetwork-send-v1.cpp.
I used GPIO6 for CS, because GPIO8 did not work immediately. You could try to put 8 in pins.nss.
You also need to connect the RFM95's DIO0/1/2 pins; they are used.

But first you'll need to get the code to compile.
The code compiles on my Raspberry. (with g++ version 4.9/4.9.2).
The problem could lie in the trailing comma at the end of line 528, after 0x00. That comma can safely be removed.

Did you install the wiringPi package?

Good luck.


#19

I did install the wiringPi package but there seem to be something missing on the Raspian image i tested. Also tested on another Pi without success. But today i tested on another pi and it was working instantly. After reinstalling the first pi with 2016-02-26-raspbian-jessie-lite the make was fine.

apt-get install wiringpi

And build the example

https://github.com/ernstdevreede/lmic_pi/archive/master.zip
unzip master.zip
cd lmic_pi-master/lmic
make

cd /home/user/lmic_pi-master/examples/thethingsnetwork-send-v1
make

#20

I'm getting spurious interrupts...

OhOh. Unknown interrupt flags for FSK

(which I ignore) multiple times. flags1 and flags2 are both 0. Is my Pi or RFM95 borked? Does the wiring need special attention?

Otherwise it works great, thanks for the port!