LG308 Basic Station wont recieved from Arduino End Nodes

You need to understand the RF component of the machine you are trying to build.

Having the node right next to the gateway causes issues - to high RF levels for the frontend.

To low RF levels you can’t decode the signal.

If you have a 100m and wall between the node and gateway and the RX is -133dBm already, I will look at the RF side of my devices, it seems low, check your antennas, coax cables, connectors (are they matching?).

I already separate the node and the gateway.

The thing is, it can do point to point LoRa with the same device just fine at the same distances, but for some reason my gateway cant.

what do you mean by matching ?

It is not distance, it is RF signal strength determining if it is going to work.

Matching, you get male and female connectors, you need to pay special attention to the center conductors type, here are where a lot of people trip up. They will connect two of the same types to each other, just double check your RF side.

Yes ive already double checked everything, i dont know what to do anymore to be honest, i’ve tried changing antenna, separate the gateway and the node, resetting the gateway to factory default, changing frequency and still the gateway wont receive my packets :sob:

Show us a clear picture of each SMA connector, PCB side and antenna side, as it is not always that easy to see the differences. (trying to help you)

If you had a piece of wire cut to 1/4 wave length (for antenna) it should work easily over that distance.

You are missing something small.


1 Like

What does your serial output from the Arduino show - please ensure you format it with the </> tool - do not post a picture.

19:18:33.088 -> Starting
19:18:33.135 -> 9497: EV_TXSTART
19:18:33.135 -> Packet queued
19:18:35.238 -> 139332: EV_TXCOMPLETE (includes waiting for RX windows)
19:19:05.246 -> 2015121: EV_TXSTART
19:19:05.246 -> Packet queued
19:19:07.299 -> 2144974: EV_TXCOMPLETE (includes waiting for RX windows)
19:19:37.317 -> 4020769: EV_TXSTART
19:19:37.317 -> Packet queued
19:19:39.419 -> 4150625: EV_TXCOMPLETE (includes waiting for RX windows)
19:20:09.443 -> 6026419: EV_TXSTART
19:20:09.443 -> Packet queued
19:20:11.505 -> 6156439: EV_TXCOMPLETE (includes waiting for RX windows)

i’ve tried different payload, different delay up to 30 min - 1 hour delay, still doesnt work. It always loop like this

What is the Arduino board specification you are using?

Already post my Arduino board above. I use custom Arduino Pro Mini with ATmega 328 and RFM95W LoRa chip. Here is the full specification

My apologies, sorry for the inconvenience. I’ll pay more attention going forward.

I think the RFM95W module is only a LoRa radio and not LoRaWAN capable.
You need 2 modules. One acting as sender the other as receiver.

Thank god, I solved it today. The problem is the library
I need to change the lmic_project_config.h file in Arduino\libraries\MCCI_LoRaWAN_LMIC_library\project_config to my region.
The last problem is why the DevAddr change when recieved by my gateway and then changed again when the packets uplinked to TTN

Sort of, it is indeed a LoRa radio but it is the most common LoRa radio used by the LoRaWAN software to do LW!

Not on this forum, we only do LoRaWAN here!

We don’t often refer to configuration as a problem - more a RTFM event!

The DevAddr is dynamically assigned on OTAA join - that’s not just normal, it’s a necessity.

The Learn link at the top of the page will lead you to more material to understand the basics. LW is very dependent on RTFMing on the core details.

1 Like

Then how do i sync the packets to my appllication end node when iam using ABP?

Why would you use ABP? It’s got all sorts of complications.

Are uplinks appearing on the device console?

The example code doesnt work.
It appear in the gateway console yes, but it doesnt appear in the end node console because changing DevAddr
*edit
The example code works but everytime i sent a packet, it always sent a join request even though it was already been accepted

If it is sending Join Requests then I’d expect the DevAddr to change because that’s how it works. But your code above is for ABP.

I’d not expect the DevAddr to change between the gateway and the console.

If it is ABP as in the code somewhere up from here, then it isn’t sending join requests because ABP doesn’t send them - and you’d see that in your serial log.

Perhaps review the Learn section on End Device Activation

Yea i tried ABP and OTAA, ABP packets are recieved by the gateway and show up in the console gateway but it didnt show up in the End devices console. When i tried OTAA it show up in the End devices gateway but it keep receiving and dropping join request. The first time it successfully joined but after that it keep receiving join request. Here’s the code for the OTAA

#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>

//
// For normal use, we require that you edit the sketch to replace FILLMEIN
// with values assigned by the TTN console. However, for regression tests,
// we want to be able to compile these scripts. The regression tests define
// COMPILE_REGRESSION_TEST, and in that case we define FILLMEIN to a non-
// working but innocuous value.
//
#ifdef COMPILE_REGRESSION_TEST
# define FILLMEIN 0
#else
# warning "You must replace the values marked FILLMEIN with real values from the TTN control panel!"
# define FILLMEIN (#dont edit this, edit the lines that use FILLMEIN)
#endif

// This EUI must be in little-endian format, so least-significant-byte
// first. When copying an EUI from ttnctl output, this means to reverse
// the bytes. For TTN issued EUIs the last bytes should be 0xD5, 0xB3,
// 0x70.
static const u1_t PROGMEM APPEUI[8]={ 0x21, 0xDF, 0xCA, 0x34, 0xFF, 0x41, 0x13, 0xDF };
void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}

// This should also be in little endian format, see above.
static const u1_t PROGMEM DEVEUI[8]={ 0x11, 0x2A, 0x00, 0xD8, 0x7E, 0xD5, 0xB3, 0x70 };
void os_getDevEui (u1_t* buf) { memcpy_P(buf, DEVEUI, 8);}

// This key should be in big endian format (or, since it is not really a
// number but a block of memory, endianness does not really apply). In
// practice, a key taken from ttnctl can be copied as-is.
static const u1_t PROGMEM APPKEY[16] = { 0x81, 0x6A, 0x04, 0xB7, 0x21, 0x93, 0x07, 0xA7, 0x93, 0x68, 0x8B, 0xC6, 0xDE, 0x76, 0xF8, 0x22 };
void os_getDevKey (u1_t* buf) {  memcpy_P(buf, APPKEY, 16);}

static uint8_t mydata[] = "Hello, world!";
static osjob_t sendjob;

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

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

void printHex2(unsigned v) {
    v &= 0xff;
    if (v < 16)
        Serial.print('0');
    Serial.print(v, HEX);
}

void onEvent (ev_t ev) {
    Serial.print(os_getTime());
    Serial.print(": ");
    switch(ev) {
        case EV_SCAN_TIMEOUT:
            Serial.println(F("EV_SCAN_TIMEOUT"));
            break;
        case EV_BEACON_FOUND:
            Serial.println(F("EV_BEACON_FOUND"));
            break;
        case EV_BEACON_MISSED:
            Serial.println(F("EV_BEACON_MISSED"));
            break;
        case EV_BEACON_TRACKED:
            Serial.println(F("EV_BEACON_TRACKED"));
            break;
        case EV_JOINING:
            Serial.println(F("EV_JOINING"));
            break;
        case EV_JOINED:
            Serial.println(F("EV_JOINED"));
            {
              u4_t netid = 0;
              devaddr_t devaddr = 0;
              u1_t nwkKey[16];
              u1_t artKey[16];
              LMIC_getSessionKeys(&netid, &devaddr, nwkKey, artKey);
              Serial.print("netid: ");
              Serial.println(netid, DEC);
              Serial.print("devaddr: ");
              Serial.println(devaddr, HEX);
              Serial.print("AppSKey: ");
              for (size_t i=0; i<sizeof(artKey); ++i) {
                if (i != 0)
                  Serial.print("-");
                printHex2(artKey[i]);
              }
              Serial.println("");
              Serial.print("NwkSKey: ");
              for (size_t i=0; i<sizeof(nwkKey); ++i) {
                      if (i != 0)
                              Serial.print("-");
                      printHex2(nwkKey[i]);
              }
              Serial.println();
            }
            // Disable link check validation (automatically enabled
            // during join, but because slow data rates change max TX
	    // size, we don't use it in this example.
            LMIC_setLinkCheckMode(0);
            break;
        /*
        || This event is defined but not used in the code. No
        || point in wasting codespace on it.
        ||
        || case EV_RFU1:
        ||     Serial.println(F("EV_RFU1"));
        ||     break;
        */
        case EV_JOIN_FAILED:
            Serial.println(F("EV_JOIN_FAILED"));
            break;
        case EV_REJOIN_FAILED:
            Serial.println(F("EV_REJOIN_FAILED"));
            break;
        case EV_TXCOMPLETE:
            Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)"));
            if (LMIC.txrxFlags & TXRX_ACK)
              Serial.println(F("Received ack"));
            if (LMIC.dataLen) {
              Serial.print(F("Received "));
              Serial.print(LMIC.dataLen);
              Serial.println(F(" bytes of payload"));
            }
            // Schedule next transmission
            os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
            break;
        case EV_LOST_TSYNC:
            Serial.println(F("EV_LOST_TSYNC"));
            break;
        case EV_RESET:
            Serial.println(F("EV_RESET"));
            break;
        case EV_RXCOMPLETE:
            // data received in ping slot
            Serial.println(F("EV_RXCOMPLETE"));
            break;
        case EV_LINK_DEAD:
            Serial.println(F("EV_LINK_DEAD"));
            break;
        case EV_LINK_ALIVE:
            Serial.println(F("EV_LINK_ALIVE"));
            break;
        /*
        || This event is defined but not used in the code. No
        || point in wasting codespace on it.
        ||
        || case EV_SCAN_FOUND:
        ||    Serial.println(F("EV_SCAN_FOUND"));
        ||    break;
        */
        case EV_TXSTART:
            Serial.println(F("EV_TXSTART"));
            break;
        case EV_TXCANCELED:
            Serial.println(F("EV_TXCANCELED"));
            break;
        case EV_RXSTART:
            /* do not print anything -- it wrecks timing */
            break;
        case EV_JOIN_TXCOMPLETE:
            Serial.println(F("EV_JOIN_TXCOMPLETE: no JoinAccept"));
            break;

        default:
            Serial.print(F("Unknown event: "));
            Serial.println((unsigned) ev);
            break;
    }
}

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

void setup() {
    Serial.begin(9600);
    Serial.println(F("Starting"));

    #ifdef VCC_ENABLE
    // For Pinoccio Scout boards
    pinMode(VCC_ENABLE, OUTPUT);
    digitalWrite(VCC_ENABLE, HIGH);
    delay(1000);
    #endif

    // LMIC init
    os_init();
    // Reset the MAC state. Session and pending data transfers will be discarded.
    LMIC_reset();

    // Start job (sending automatically starts OTAA too)
    #if defined(CFG_as923)
    // Set up the channels used by the Things Network, which corresponds
    // to the defaults of most gateways. Without this, only three base
    // channels from the LoRaWAN specification are used, which certainly
    // works, so it is good for debugging, but can overload those
    // frequencies, so be sure to configure the full frequency range of
    // your network here (unless your network autoconfigures them).
    // Setting up channels should happen after LMIC_setSession, as that
    // configures the minimal channel set. The LMIC doesn't let you change
    // the three basic settings, but we show them here.
    LMIC_setupChannel(0, 923200000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);
    LMIC_setupChannel(1, 923400000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);
    LMIC_setupChannel(2, 922200000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);
    LMIC_setupChannel(3, 922400000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);
    LMIC_setupChannel(4, 922600000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);
    LMIC_setupChannel(5, 922800000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);
    LMIC_setupChannel(6, 923000000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);
    LMIC_setupChannel(7, 922000000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);
    LMIC_setupChannel(8, 921800000, DR_RANGE_MAP(DR_FSK,  DR_FSK),  BAND_MILLI);
    #endif
    do_send(&sendjob);
}

void loop() {
    os_runloop_once();
}