Arduino Uno + Dragino Shield v1.3 + Code?


(Pete) #1

Greetings -

I am trying to bring up the test system detailed at instrucables at:

http://www.instructables.com/id/Use-Lora-Shield-and-RPi-to-Build-a-LoRaWAN-Gateway/?ALLSTEPS

And have changed my arduino-lmic-master library config.h file to:

//#define CFG_eu868 1
#define CFG_us915 1

But I get an error

Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Arduino\libraries\arduino-lmic-master\src/lmic.h:5:0,

                 from C:\Arduino\lora_shield_ttn\lora_shield_ttn.ino:1:

C:\Arduino\lora_shield_ttn\lora_shield_ttn.ino: In function 'void setup()':

lora_shield_ttn:183: error: 'DR_SF12' was not declared in this scope

<snip>

lora_shield_ttn:191: error: 'BAND_MILLI' was not declared in this scope

     LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK,  DR_FSK),  BAND_MILLI);      // g2-band


exit status 1
'DR_SF12' was not declared in this scope

I am thinking there is more configuration I need to do, maybe in rewriting the LMIC_setupChannel code to appropriate frequencies for USA?

Am I barking up the right tree, here? I'm new, and appreciate any feedback you might have.

Thanks!


(Matthijs Kooijman) #2

My LMIC library was only tested with the EU settings by me. You might want to check out this pullrequest by @frankleonrose, since I think it will fix exactly your problem: https://github.com/matthijskooijman/arduino-lmic/pull/29 (haven't got time to look at the PR more closely, but it seems ok at first glance). Let me know if this fixes your problem.


#3

and performing an LMIC_setupChannel on 868.8 MHz combines with #define CFG_us915 looks like a strange combination to me


(Pete) #4

Thanks for the quick response.

Yes, I see that @frankleonrose suggests that you skip the LMIC_setupChannel commands, as

// NA-US channels 0-71 are configured automatically

So I commented the lines out, but my gateway doesn't receive any packets, as far as I can see.

The Uno reports:

Starting
Packet queued
203523: EV_TXCOMPLETE (includes waiting for RX windows)
Packet queued
4143764: EV_TXCOMPLETE (includes waiting for RX windows)

But my single_chan_pkt_fwd application just shows status updates.

I guess I have a new mystery on my hands....


#5

This other PR you should also include in your library: https://github.com/matthijskooijman/arduino-lmic/pull/26 It fixes a bug in US LMIC_channelDisable().

Do it now, because you need to disable some channels!

You say you have a single channel packet forwarder? You'll want to loop through and disable all the channels you're not using.

Here's some simple code to enable just sub-band 2 (the second group of 8 channels)

for (int channel=0; channel<8; ++channel) {
LMIC_disableChannel(channel);
}
for (int channel=16; channel<72; ++channel) {
LMIC_disableChannel(channel);
}

Cheers,
- Frank


#6

It seems Pete is using a single channel gateway?
So if he likes to receive all packets he should probably disable all channels but the one that the single channel gateway is listening on?


#7

SF12 is not valid for the 915MHz band either


(Pete) #8

Thanks, everyone.

Yes, I am running the Raspberry Pi single_chan_pkt_fwd set for

// Set spreading factor (SF7 - SF12)
sf_t sf = SF7;

// Set center frequency
uint32_t  freq = 915000000; // in Mhz! (868.1)

On the Shield:

I've modified my lmic.c LMIC_disableChannel function as per Frank's recommendation.

I've shut all other channels down on the shield per Frank's suggestion

I will try the code tonight.

So I don't see how the frequencies between raspberry pi and arduino are matching. But it's my ignorance, I think.


(Pete) #9

These changes didn't seem to work for me.

I think my gateway is ok, and it receives some other remote lora node from time to time:

`
root@raspberrypi:/home/pi/lora/single_chan_pkt_fwd# ./single_chan_pkt_fwd
SX1276 detected, starting.
Gateway ID: b8:27:eb:ff:ff:b8:82:39
Listening at SF7 on 915.000000 Mhz.


stat update: {"stat":{"time":"2016-07-01 21:56:48 GMT","lati":42.78450,"long":-86.11170,"alti":626,"rxnb":0,"rxok":0,"rxfw":0,"ackr":0.0,"dwnb":0,"txnb":0,"pfrm":"Single Channel Gateway","mail":"pete@hoffswell.com","desc":"LoRa Test Gateway"}}

Packet RSSI: -107, RSSI: -103, SNR: -12, Length: 62
rxpk update: {"rxpk":[{"tmst":3171716566,"chan":0,"rfch":0,"freq":915.000000,"stat":1,"modu":"LORA","datr":"SF7BW125","codr":"4/5","lsnr":-12,"rssi":-107,"size":62,"data":"iNt8bCXM0t6Rtdg+2F2ShSggYqXS+EFL+bTsjLh2Aopkuz/1vJ3BF823vTmL/f5SdIECmAwdciNGMu2aeiM="}]}
`

  • changed config.h to #define CFG_us915 1
  • Edited in @frankleonrose suggestions to library
  • Edited arduino sketch as per @frankleonrose suggestion

I'm at a loss. I've been emailing @dragino as well, but no luck yet.


(Rob Peters) #10

@kayakpete
I am using the Dragino Shield myself (in Europe).
I am using the above mentioned LMIC library, but be sure to connect the 4 needed wires from SV1 (DIO0,DIO1,DIO2 and Reset)
My connections are
DIO0 -> 2 (digital)
DIO1 -> 6 (digital)
DIO2 -> 7 (digital)
Reset -> 9 (digital)

Then in the arduino sketch use these settings:

// Pin mapping
const lmic_pinmap lmic_pins = {
    .nss = 10,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 9,
    .dio = {2, 6, 7},
};

(Pete) #11

If I'm not mistaken, the Lora Shield connects these pins

https://github.com/dragino/Lora/blob/master/Lora%20Shield/hardware/v1.3/Lora%20Shield%20v1.3.sch.pdf

Except that RST looks to be pin 10 and CS (NSS) is Pin 11

Tried it. didn't work.

The v1.3 board has jumpers SV2 SV3 and SV4, that I have in their default positions, and looks much like the v1.2 board seen here: http://wiki.dragino.com/index.php?title=File:Lora_Shield.png

I am very sorry, I am a novice at reading board specifications and diagrams. I'm learning a lot, but not enough to get this board running for me.


(Rob Peters) #12

DIO0 DIO1 and DIO2 are connected to the SV1 pins, that you need to connect to the arduino
Connected them like i showed above, and also use the pin mapping part in your sketch and you should be able to make it work.
Try the ABP example first (not the OTAA), make sure you registered a ABP device, also make sure that when you edit the ABP device, you reset the frame counter


Single Channel Gateway part 1
#13

@kayakpete Have you make any progress now?


(Pete) #14

I'm working with David and Edwin at Dragino now. They have recreated my issue, and we are thinking it might be a code problem.

The single channel gateway (Raspberry Pi running single_chan_pkt_fwd) settings on the gateway are

// Set spreading factor (SF7 - SF12)
sf_t sf = SF7;

// Set center frequency
uint32_t  freq = 915000000; // in Mhz! (915.0)

My current attempt on the node side (arduino running tnn.ino) is based on Franks suggestion:

 for (int channel=0; channel<8; ++channel) {
      LMIC_disableChannel(channel);
    }
      for (int channel=16; channel<72; ++channel) {
      LMIC_disableChannel(channel);
    }

I've tried variations of this with no success.

What channel should I set the node to to match the gateway? What frequency and spreading factor should I set the gateway to?

Do I need to set the spreading factor on the node?

I feel like I'm getting somewhere, but no signal yet!


#15

Hi, I am using a Dragino Shield v1.3 + Ardulno UNO node.(with no extra wires / jumepers).. I am trying the ABP registration route (as the code for the shield is asking for a network session and app session key). However I am confused by the DEV address I can't seem to create a devaddr address (yellow highlighting) that my code like. These are the screenshots below: Any help would be most appreciated. thanks


#16

Got it working. The devaddr turns out to be 0x concatenated with the DEV address so in my case its 0xD7718C0D.


(Henda) #17

I use module sx1276 on uno and i get failure

Starting
FAILURE
\Arduino\libraries\arduino-lmic-master\src\lmic\radio.c:689
any help please


#18

see issues here


(Ruman) #19

Hi, Is there any way to reset the Dragino HE module? I don’t have any YUN shield but HE module only. Thanks in advance.


(D3im0s) #20

Was there ever a fix for this issue? I am running into the same thing myself! Trying to configure for the 915MHz band.