Node: Need a sketch that works with Dragino LoRa Shield & Arduino Uno


(Robertthompson) #1

Hello:
Can someone point me to a “node” sketch that absolutely works on a “Dragino LoRa Shield v1.4” attached to a “Arduino Uno R3” using 915mhz?
I have tried numerous of tutorials and their sketches but have not been able to get my node “seen” on TTN - the device status is always “never seen”.

Present sketch being used: https://github.com/dragino/Lora/blob/master/Lora%20Shield/Examples/lora_shield_ttn/lora_shield_ttn.ino

Serial Monitor output:
Starting
Packet queued
142752: EV_TXCOMPLETE (includes waiting for RX windows)

Any suggestions would be appreciated.

Rob.


(Tvloon) #2

Try dragino >>
Lora / Lora Shield / Examples /


(Robertthompson) #3

Thanks for the reply tvloon. :slight_smile:

I have tried many of the examples resulting from such a search also the Dragino examples specifically.

I am looking for a “user” who has the exact same components as I do (“Dragino LoRa Shield v1.4” attached to a “Arduino Uno R3” using 915mhz) and has a working node and who is willing to share the sketch that is being used.

I need to know that the sketch works on my exact components so that, if it does not work for me, I can eliminate the sketch as a cause.

This is all very frustrating given how simple it was to get the Dragino LoRa /GPS Hat for RPI to register on TTN.

Rob.


(LoRaTracker) #4

What do Dragino have to say about the problem, their board, their code ?


#5

I have used the 868 version just fine. There are some changes that you need to do that are specific for 915Mhz
Have a look here for tests and changes if you want 915Mhz to work OK
N.B. Only ABP works with the Dragino single channel gateway
http://wiki.dragino.com/index.php?title=Lora_Shield#Example1_--_Use_with_LMIC_library_for_LoRaWAN_compatible

1.Copy this code to your IDE and upload the sketch to your Arduino board:
There,you can also add below code to your sketch to check the current emission frequency:
Serial.println(LMIC.freq);


2.Edit "config.h"
change
   #define CFG_eu868 1
to
  #define CFG_us915 1

3.Edit "lmic.c",about on the line 760,
change
  void LMIC_disableChannel (u1_t channel) {
     if( channel < 72+MAX_XCHANNELS )
        LMIC.channelMap[channel/4] &= ~(1<<(channel&0xF));
  }

to

  void LMIC_disableChannel (u1_t channel) {
      if( channel < 72+MAX_XCHANNELS )
          LMIC.channelMap[channel/16] &= ~(1<<(channel&0xF));
  } 


4.Edit the "main.cpp" to "Set center frequency" on your Raspberry Pi.
change
   uint32_t freq = 868100000; //in Mhz! (868.1)
to
  uint32_t freq = 915000000; //in Mhz! (915.0)

(Robertthompson) #6

I could kiss you!!! :slight_smile: :slight_smile: (figure of speach)
I don’t believe it but IT IS WORKING!!!

image

That means that it is working, right?

I really, really appreciate the time and effort you put into your reply.

I have been working on this for weeks now - I still can’t believe that it is working…

Thanks,

Rob.


(LoRaTracker) #7

Well if you have a solution,be sure to tell Dragino, it could help so many people solve the same problem …


#8

CurlyWurly explained it clearly … dragino should indeed edit their wiki’s


(Robertthompson) #9

Sorry.
My internet is down since Sunday.
Will properly test and respond.
Rob. (from Internet Cafe)


(Glbaum) #10

Hopefully things are working well Rob when you get your internet back and a chance to test. Things here in Montreal seem to be working well with the above set up at the moment. Still can’t get the slightly more expensive piece of junk LG-01 to work, though that may be from my own issues.


(Redpotatoes) #11

Quick question, I see in frequency in TTN, you have 915. How did you set your freq in the LG01 ?
I am able to make my nodes and gateways working on single 902300000 freq but not sure how you did it on LG01.


(Sam Zand) #12

Hey guys,

I am using the same things for my node Arduino UNO R3, Dragino Shield v1.4), and I have followed your code and instruction (except for 4th), but I still get the same result. my device is still not seen on TTN, but after following the instructions my serial output is this:

Starting
Packet queued
903900000
132885: EV_TXCOMPLETE (includes waiting for RX windows)

I am trying to connect to Meshed Gateways which are installed at Macquarie University(Sydney).
. My device address is
static const u4_t DEVADDR = 0x260024E8 ;
should I use LSB or MSB for APPSKEY and NWKSKEY?
I have tried both, it didnt make a change.

In the instruction of the code, it says * Do not forget to define the radio type correctly in config.h. BUT i dont know how to do it?

photo_2018-05-12_14-17-43
11
could you please help me as well,
no kisses, I promise :smiley: :smiley:
but I will invite you for a beer if you ever come to Sydney.


(Glbaum) #13

The config.h file is from the LMIC library, assuming you are using the Arduino IDE, you should see a LMIC folder in the libraries folder. In my case on a Win10 machine the config.h file is located at this path:
C:\Users<user name>\Documents\Arduino\libraries\IBM_LMIC_framework\src\lmic\config.h

If you open that file in an editor you’ll see this on the 8th and 9th line of code:

#define CFG_eu868 1
//#define CFG_us915 1

You will need to change it to this:

//#define CFG_eu868 1
#define CFG_us915 1

Also as far the Keys go if I remember correctly it’s MSB.


(Sam Zand) #14

Thanks, I have already done the Change, last night I followed this tutorial, and I got result.

The tutorial I followed.
http://thomaslaurenson.com/projects/DraginoLoRaShield.html

After 10 minutes the device was seen on thethingsnetwork. JUST for a MINUTE. and they have been disconnected since that time.

What is the problem ??
Antenna?
Capture


(Glbaum) #15

What gateway are you using?

Also is your node sending out data on one single channel by modifying the limc.c file like is shown previously in this thread or did you not edit it which means it will continue to loop through the available channels looking to connect to a gateway?


(Sam Zand) #16

I’m trying to use the available public gateways provided by Maj. Unfortunately I cannot get connected to them.
I have run many tests, but I get connected to other gateway just for few moments. I still can not figure out what is the problem??
This is the information for the gateway that I am trying to connect.
1

I just got connected again for few minutes to another gateway. the images below are the results shown on my TTN.
444444
2222

please help a brother out.


(Glbaum) #17

Well you can’t force your node to get picked up up by a specific gateway, and the gateway that you did get picked up by at least in the snippet you shared isn’t all that far away from the ones that you want to connect to. Also once again did you modify the code you are using to only use one channel or is your node looping through the all the available channels. It also seems like you are trying to send a lot of packets in a short time but I don’t think that is necessarily the issue.

Perhaps @Maj can help you since he might be able to look at his gateways back end.


(Andrew Maggio) #18

Hi @Sam_zand, for the gateways at Macquarie Uni (and a few others), you need to set the band plan to AS923. We use both AS923 and AU915 in Australia. Unfortunately, since it’s a little unique for a country to use more than one band plan, it’s not obvious from the TTN Map which band plan a gateway is using.

I will explore the possibility of adding this with the TTN guys, but they are likely to be focussed on V3 at the moment.


(Andrew Maggio) #19

(Glbaum) #20

Didn’t even realize you guys had both available to you. Good to know if I ever move to Australia! Also the request for the additional info regarding the plan in that specific area of the world and maybe others would definitely be helpful for anyone trying to set up a node.