DRAGINO problems and solutions topic part 1

(Andhika994) #70

hallo, plz help me, i use lora mini dev + Lora GPS/Hat at same freq (868mhz), and i use sensor node dht 11 humidity, i just can recieve data from lora mini with serial to my laptop, i don’t know how to connect lora mini to lora hat, lora hat is actived and connected to TTN, i use single channel pkt fwd, please help me give me a sketch or anything how to connect lora mini + lora hat and get the sensor data…

(Darko Djukic) #71

Hey, I managed to solve this issue by resetting the frame counters on the device settings in the TTN console (Overview tab). After the counter reset, the node status changes and the TTN begins logging the payload data once again.

(Mk4y) #73

Hi Everyone, i have build a Single Chan Gateway with the Dragino Lora GPS Hat and the Packet Forwarder by Telkamp (https://github.com/tftelkamp/single_chan_pkt_fwd) and connected it to TTN. (I know this forwarder is deprecated) Im receiving packets from some Node, but on the TTN Console it doesnt show any transfered Data in the “Traffic” Section, it is empty.
I already checked the UDP connection, which seems to be fine. TTN is definetly getting the status msgs with the gps data. (Shows the location of the Gateway on the map, at least on the TTN mainpage https://www.thethingsnetwork.org)
The “Received Messages” counter on the console only shows 2, even though I received much more packets with the gateway.

Does anyone know why there is nothing listed on the “Traffic” section on the TTN console?
And does anybody know how to fix it?

Thank you guys very much.

(Glbaum) #74

How are you sure you are actually receiving more packets with the gateway than the 2 Received Messages that your counter shows? If you are referring to the output that you see in the terminal after starting the Single_Chan_Pkt_Fwd routine on your RaspberryPi that isn’t always packets being received. I don’t have access to my Pi at the moment but you will see periodic updates in terminal that are just the Packet Forwarder routine running through it’s loop but unless you’ve actually received something it won’t show up as traffic on the Console.

(Mk4y) #75

Yes, I’m pretty shure about that. Unbenannt

(Glbaum) #76

Ok, so you’re using the dual_chan_pkt_fwd now and not using the single channel packet forwarder you alluded to in your other post. It could be the problem here if things weren’t set up right but you are still right that you have apparently received packets. Are you using the Dual Channel setup that Batigolle has used?

The next assumption is that the reason you’re not seeing it in TTN is that the packet is not meant for TTN. I pick up random packets here in Montreal that I know do not show up in my Gateways count, as I can pretty much guarantee that that count number I see are all messages from my sensors. At least on my test gateway as it’s not that high of a number.

(Mk4y) #77

Thanks a lot for your concerns. Right now Im using the Dual Channel Packet Forwarder that Batigolle introduced in the forum, but its based on the Single Channel Packet Forwarder by Telkamp.
I thought that unknown Packets from different Networks than TTN are also received and processed by the servers and then dumped.
I’m wondering why the TTN Console shows 2 received msgs but doesn’t show any information in the Traffic section.
Next week the hardware for my node and a real LoRaWAN Gateway Module should arrive, then I can continue testing the TTN.

(Glbaum) #78

Ok good luck, I had the same issues at first with my LG-01 that I had bought initially but was able to make it work well enough. Haven’t had this issue with the LoRa Hat that I had tested though. Hopefully with your node and real Gateway you’ll have an easier time.

(Airichi) #79

Hello, I’ve created a loRaWAN Gateway using a Raspberry Pi 3 and a LoRa Sheild, it works fine. Then I tried to send data to this gateway using a node made of: Arduino, Lora Shield and sensors (DHT22 and tsl2561). First, I send a basic “Hello World” message using this code (https://github.com/matthijskooijman/arduino-lmic/blob/master/examples/ttn-abp/ttn-abp.ino). It worked fine. But, When I tried to send DHT22 data (temperature and humidity) I couldn’t. The last thing I tried is to use this code (https://github.com/goodcheney/TTN_Mydevice/blob/master/DHT11_Mydevice), I’ve made some changes (the DHT22 declaration and the reading). But I’ve always that payload: 01670000026800 which is not the data I’ve wanted. What is wrong with my code? Is there any other way to send data properly to the gateway? Please, I need your help. Thanks.

(Batigolle) #80

Hi @airichi
did you change the decode code, to read the hexadecimal string and convert it back to numbers, on the application where the node is registered?

defauly the decode code in payload formats, reads a hexadecimal string and converts it to text

(Glbaum) #81

That hex value is in your code you linked to on line 18, if you remove or comment out that line what do you see from your node? Remember to make sure that the rest of your mydata lines are appropriately setup properly if you do that.

I’d also suggest maybe looking at this code, to see how he uses a DHT sensor with the LMIC library. Even though it’s not the same device the code might be helpful to you.

(Airichi) #82

Hello @Batigolle thank you for your reply!
I know that the default code is in Hexadecimal,initlora I convert it manually to ascii to check if the correct message has been send.

Thank you @glbaum, this is my code:

#define DHTPIN A0
#define DHTTYPE DHT22

float temperature,humidity;      
float tem,hum;

unsigned int count = 1;        //For times count

String datastring1="";        
String datastring2="";        
String datastring3="";

static uint8_t mydata[7] = {0x01,0x67,0x00,0x00,0x02,0x68,0x00};  
/* LoRaWAN NwkSKey, network session key
   This is the default Semtech key, which is used by the prototype TTN
   network initially.
static const PROGMEM u1_t NWKSKEY[16] = { 0xDA, 0x8E, 0x60, 0xD4, 0x9A, 0x40, 0x7C, 0x68, 0x46, 0x57, 0x0D, 0xFD, 0x63, 0xE2, 0x8E, 0x48 };

/* LoRaWAN AppSKey, application session key
   This is the default Semtech key, which is used by the prototype TTN
   network initially.
static const u1_t PROGMEM APPSKEY[16] = { 0x31, 0x24, 0x5B, 0xD6, 0x28, 0xAE, 0xF9, 0x9F, 0x90, 0x54, 0x53, 0xF5, 0x8A, 0xD2, 0xBD, 0xA9 };

 LoRaWAN end-device address (DevAddr)
 See http://thethingsnetwork.org/wiki/AddressSpace
static const u4_t DEVADDR = 0x26011300 ;

/* These callbacks are only used in over-the-air activation, so they are
  left empty here (we cannot leave them out completely unless
   DISABLE_JOIN is set in config.h, otherwise the linker will complain).*/
void os_getArtEui (u1_t* buf) { }
void os_getDevEui (u1_t* buf) { }
void os_getDevKey (u1_t* buf) { }

static osjob_t initjob,sendjob,blinkjob;

/* Schedule TX every this many seconds (might become longer due to duty
 cycle limitations).*/
const unsigned TX_INTERVAL = 10;

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

void do_send(osjob_t* j){
    // Check if there is not a current TX/RX job running
    if (LMIC.opmode & OP_TXRXPEND) {
        Serial.println("OP_TXRXPEND, not sending");
    } else {
        // Prepare upstream data transmission at the next possible time.
        //  LMIC_setTxData2(1,datasend,sizeof(datasend)-1,0);
        LMIC_setTxData2(1, (byte *)mydata, sizeof(mydata), 0);
        Serial.println("Packet queued");
        Serial.println("Receive data:");
    // Next TX is scheduled after TX_COMPLETE event.

void onEvent (ev_t ev) {
    Serial.print(": ");
    switch(ev) {
        case EV_SCAN_TIMEOUT:
        case EV_BEACON_FOUND:
        case EV_BEACON_MISSED:
        case EV_BEACON_TRACKED:
        case EV_JOINING:
        case EV_JOINED:
        case EV_RFU1:
        case EV_JOIN_FAILED:
        case EV_REJOIN_FAILED:
        case EV_TXCOMPLETE:
            Serial.println("EV_TXCOMPLETE (includes waiting for RX windows)");
            if(LMIC.dataLen) {
                // data received in rx slot after tx
                Serial.print("Data Received: ");
                Serial.write(LMIC.frame+LMIC.dataBeg, LMIC.dataLen);
            // Schedule next transmission
            os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
        case EV_LOST_TSYNC:
        case EV_RESET:
        case EV_RXCOMPLETE:
            // data received in ping slot
        case EV_LINK_DEAD:
        case EV_LINK_ALIVE:
            Serial.println("Unknown event");

void setup() {
     // initialize digital pin  as an output.
    Serial.println("Connect to TTN and Send data to mydevice(Use DHT11 Sensor):");
    #ifdef VCC_ENABLE
    // For Pinoccio Scout boards
    pinMode(VCC_ENABLE, OUTPUT);
    digitalWrite(VCC_ENABLE, HIGH);

    // LMIC init
    // Reset the MAC state. Session and pending data transfers will be discarded.
    /*LMIC_setClockError(MAX_CLOCK_ERROR * 1/100);
     Set static session parameters. Instead of dynamically establishing a session
     by joining the network, precomputed session parameters are be provided.*/
    #ifdef PROGMEM
    /* On AVR, these values are stored in flash and only copied to RAM
       once. Copy them to a temporary buffer here, LMIC_setSession will
       copy them into a buffer of its own again.*/
    uint8_t appskey[sizeof(APPSKEY)];
    uint8_t nwkskey[sizeof(NWKSKEY)];
    memcpy_P(appskey, APPSKEY, sizeof(APPSKEY));
    memcpy_P(nwkskey, NWKSKEY, sizeof(NWKSKEY));
    LMIC_setSession (0x1, DEVADDR, nwkskey, appskey);
    // If not running an AVR with PROGMEM, just use the arrays directly 
    LMIC_setSession (0x1, DEVADDR, NWKSKEY, APPSKEY);
    // Disable link check validation

    // TTN uses SF9 for its RX2 window.
    LMIC.dn2Dr = DR_SF9;

    // Set data rate and transmit power (note: txpow seems to be ignored by the library)

    // Start job
void dhtTem()
        // Lecture du taux d'humidité
        float h = dht.readHumidity();
        // Lecture de la température en Celcius
        float t = dht.readTemperature();

       Serial.print("###########    ");
       Serial.println("    ###########");
       Serial.println("The temperautre and humidity :");

  ////memcpy (mydata,&t,4);
      int16_t t1=(t*10);
       mydata[2] = t1>>8;

       mydata[6] = h * 2;

void loop() {

Do I have to initialize mydata at the same time I read data from my sensor?
Thank you for the code, I’ll try to use the same methods.

(Glbaum) #83

This is the payload in that packet that you are seeing and what I was referring to in my earlier post. So from the looks of it you are not replacing that value with the appropriately acquired values from the DHT sensors farther down in your code. It was also why my suggestion to you was to omit or comment out that line of your code to see if you see a different payload being sent. Assuming the rest of your code is correct and I apologize, I haven’t looked over it all very carefully, you should see a different payload being sent.

One last thing, from the code I shared this is something that I think you should look at:

  char packet[30] = "";

  // Get temperature event and print its value.
  sensors_event_t event;
  if (!isnan(event.temperature)) {
      char floatStr[10];
      dtostrf(event.temperature, 3, 2, floatStr);
      strcat(packet, "Temp: ");
      strcat(packet, floatStr);
      strcat(packet, "*C\n");
  } else {
      Serial.println("Error reading temperature!");

  // Get humidity event and print its value.
  if (!isnan(event.relative_humidity)) {
      char floatStr[10];
      dtostrf(event.relative_humidity, 3, 2, floatStr);
      strcat(packet, "Humidity: ");
      strcat(packet, floatStr);
      strcat(packet, "%");
  } else {
      Serial.println("Error reading humidity!");

  if (!strlen(packet)) {
      // Don't send empty packet

In your code besides that default value on line 18, you are then using mydata three separate times with varying lengths mydata[2], mydata[3], and mydata[6] unless I missed it somewhere else, if you do see a different payload by removing line 18, it will most likely be the value stored in mydata[6] and not all of the data that you want.

(Ericsurya) #84


I’m using a Dragino LSN50 (firmware 1.1) that is sending data to my LG01 which is connected to ttn. The lsn50 is using ABP mode. As lsn50 modify its TX frequency all the time, many messages dont reach the LG01. Could you tell me please how to make lsn50 use a unique TX frequency ? It means using only one channel .

Here is the node code : https://github.com/dragino/LoRa_STM32

Thank you


probably instruct the node with AT commands

(Ericsurya) #86


Thank you for your help.
AT commands supported are here : http://www.dragino.com/downloads/.

I didnt find how to enable a single channel using these AT commands. Imo, the firmware has to be modified but I dont know how …



is it open source then ? what did you find…

(Nitecsoftware) #88


I am trying to setup my dragino LQ01-S as a gateway to TTN. I have followed the instructions in the user manuals supplied by Dragino, but nothing shows up and looks registered on the TTN console.

I am located in Canada and I have loaded the single-pkt-fwd-v002 and I have changed the frequency to 915MHz.

I am at a loss as to what I am missing or what I have not setup completely. Can someone direct me to perhaps more detailed setup instructions. Some of the areas that I am not sure about are the ports uses; do the keys need to be installed etc.

Any help is very much appreciated.

(Bauvill) #89

Hi Guys,
firstly, I will like to appreciate the support you are offering mostly to us computer science student and to those who want to try new IoT related technical stuff.
I have a question or rather a groups of subjects. Before going into my questions, let me give you guys the background of my issues.

I was required, in the context of my thesis, to create a bi-directional communication over the LoRa modulation. The interface is between two “smart devices” consisting of a Raspberry Pi 3 and a LoRa /GPS HAT based on the SX1276 LoRa Transceiver. Both devices will act as Server and Client interchangeably. On both devices will run a packet forwarder the enables them forward data to a local TCP server for further processing.
Presently, both devices can send and receive data from/to each other using the RPI-transceiver software as described in (https://github.com/dragino/rpi-lora-tranceiver). I found a packet forwarder software at (https://github.com/kersing/packet_forwarder), this, however, is not designed for the Lora Transceiver x1276/SX1272 but for the concentrator based on SX1301, which is a multi-channel full gateway devices. It is evident that the software does suit my use case ( in my opinion). I will like someone to either point me to a source of software that could help me achieve the goals described earlier or give me some tips in modifying ( adapting) the existing software to my need. Thank in advance.


I suggest you do a search for single channel gateway … here on the forum or google.
A single channel gateway can connect to The Things Network and can work with a piece off code named LMIC