Giter Club home page Giter Club logo

lora-ttnmapper-t-beam's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lora-ttnmapper-t-beam's Issues

Compatible with board 1.1 ??

Hi

I have the 1.1 version of that board and I'd like to use your sketch on it. Is it compatible ? or need some tweaks to get it working properly ?

Thanks

Vincèn

AS923 frequency

Hye, I'm new to this t-beam and LoraWan..

I have some problem regarding the frequency plan that can be used, currently I'm in Malaysia which require to use 923mhz to function and while compiling your code as an example, I got an issue which is:

C:\Users\u\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\hal\getpinmap_thisboard.cpp: In function 'const Arduino_LMIC::HalPinmap_t* Arduino_LMIC::GetPinmap_ThisBoard()':
C:\Users\u\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\hal\getpinmap_thisboard.cpp:71:72: note: #pragma message: Board not supported -- use an explicit pinmap
#pragma message("Board not supported -- use an explicit pinmap")
^

Also, after compiling, i receive "no gps fix" as the result, i have try to change some of the code according to others problem, but it still dosnt fix my problem

i also try to change the frequency from eu868 to as 923 according to my country but still not working. and if i change to other option which have "LMIC_selectSubBand(1);" below, i will get an error where its dosnt detect the selectSubBand option.

#ifdef CFG_as923
LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(1, 868300000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI); // g-band
LMIC_setupChannel(2, 868500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(3, 867100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(4, 867300000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(5, 867500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(6, 867700000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(7, 867900000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI); // g-band
LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI); // g2-band
#endif

#ifdef CFG_eu868
LMIC_selectSubBand(1);

sorry if its quite long, but i really need help regarding my problem, especially because im using as923
please help me..thanks!

Not compiling

While compiling I get errors.

Firstly, it does not find #include "gps.h"

and it stops there :

"Multiple libraries were found for "TinyGPS++.h"
Lora-TTNMapper-T-Beam:12:17: error: gps.h: No such file or directory
Used: /Users/geertvansintjan/Documents/Arduino/libraries/TinyGPSPlus-1.0.2b
compilation terminated.
Multiple libraries were found for "lmic.h"
Used: /Users/geertvansintjan/Documents/Arduino/libraries/IBM_LMIC_framework
Not used: /Users/geertvansintjan/Documents/Arduino/libraries/MCCI_LoRaWAN_LMIC_library
exit status 1
gps.h: No such file or directory

When doing a file search however, I find a gps.h in the LoRa_Node library, somewhere...

PS. a few lines further the line gps gps; seems strange too?

platformio?

i'm aware that this isn't really an issue of your code, but maybe you could help - having more experience with this board..

i'm trying to get this built with platformio and actually seem to be getting quite close it, with the following ini:

[env:ttgo-t-beam]
platform = espressif32
board = ttgo-t-beam
framework = arduino
lib_deps = 852, 870, 1655

but on compiling i get:
error: 'class WiFiClass' has no member named 'mode'

unless commenting out:
WiFi.mode(WIFI_OFF);

researching a little it seems the WIFI_OFF mode seems to be special to the ESP version of the wifi library http://esp8266.github.io/Arduino/versions/2.1.0-rc1/doc/libraries.html#wifi-esp8266wifi-library so it seems the wrong one is picked. any idea why and how to correct this? or maybe it's something more basic anyways?

tia,markus.

OTAA and US915 support

Current code does not allow to use OTAA.

If the LMIC is modified to use US915, while compiling one gets a bunch of errors like:
error: 'DR_SF12' was not declared in this scope

I'll do a pull request with patches for both of this issues.

How to retrieve NwksKey

I'm rather new to ttn, but i don't know how to retrieve the nwks for the config.h

I know its derived from some other unique id's, so do i need to fill it as i understood its a session based key, which i don't know and only the device and the network server will know it.

Is the deviceAddress custom generated or is it the Device EUI?

Thanks a lot :-).

No ABP joining

I have been testing this soft on a TTGO T-Beam T22_V05 (ESP32+NEO-M8N+LORA32_SX127x?) and I have not achive the ABP join...

  • in config.h I write NewSkey, AppSkey and DevAddr as TTN show them: first shown byte, first written byte (NWKSKEY[16] = { 0xD8,.....) .... I dont have to fill any more data?

  • In the TTGO T-Beam T22_V05, pin mapping is diferent . I read : // Pin mapping const lmic_pinmap lmic_pins = { .nss = 18, .rxtx = LMIC_UNUSED_PIN, .rst = LMIC_UNUSED_PIN, // was "14," .dio = {26, 33, 32}, };

  • At the serial monitor I can read: Valid gps Fix. Lat: 39.564690 Lng: -0.330945 Packet queued EV_TXCOMPLETE (includes waiting for RX windows) but nothing arrive to TTN.... How can I to be sure the T-Beam has joined the net??, the gateway doesnt register any activity...

:(

Any idea? thanks in advance-...

No GPS fix

Thank you for this sketch!

I'm in the U.S. and trying your sketch with a TTGO T-BEAM module marked as follows:

T22_v1.0
20190612
GPS ESP32
TX IO34
RX IO12

With the default firmware (SoftRF), the module was able to get a GPS fix in short order. With this sketch, I'm unable to get a GPS fix at all. "No gps Fix." (man, that capitalization...) is written to the serial console at regular intervals.

I set up the dependencies as according to the README.md, using the versions listed. I'm on Linux and modified ~/Arduino/libraries/IBM_LMIC_framework/src/lmic/config.h by changing CFG_eu868 to CFG_eu915.

Questions:

Have you tested the sketch with a v1.0 module?

Should I expect the red LED to start flashing when/if a GPS fix is obtained?

Should I be able to turn the module off without removing the battery?

Will any LoRa packets be transmitted before there is a GPS fix?

Decoder produces strange GPS values

In the serial monitor I see the correct GPS values, but on LoRaServer.io with the Decode functions I am seeing very funny values like these:

altitude:8311
hdop:11.1
latitude:-39.09643346646032
longitude:-27.51430556263361

Any idea?

Runtime error "FAILURE"

Hi.
I appreciate any help with this. I am running on V1.1 with OTTA, 915 Mhz.

15:51:19.007 -> TTN Mapper
15:51:19.007 -> FAILURE
15:51:19.007 -> C:\Users\jbejarano\Documents\Arduino\libraries\IBM_LMIC_framework\src\lmic\radio.c:689

I wonder if it is caused by a hw incompatibility.

Thanks!

Payload error "json: unsupported value: NaN"

Hi,

Not very experienced with LoRa/TTN I'm installing the TTN-Mapper on my TTGO-T-Beam V2. An issue is shown when I enter your payload code 1:1 to the TTN-Console, it reports an error after testing as shown in the attachment. Can you tell me what I'm doing wrong?

Regards, Hans.

payload

Confusing definition of GPS_RX and GPS_TX

I'm trying to adapt this sketch for a custom ESP32 based board with an external GPS and a different pinmap. After a while I realized that GPS_RX and GPS_TX (gps.h) are defined in a pretty unusual way here.

The pin GPS_RX means the TX pin of the ESP here (wired to RX of the GPS). GPS_TX is the RX pin of the ESP (wired to TX of the GPS).

I understand that this won't really matter if you just use the T-Beam, but for others who are planning to reuse the code for other boards, this notice might be helpful since it is not the "normal" way most people would handle the terms RX and TX.

OTAA activation not working on TTN

Hi,

when i am activating over OTAA the Activation frame gets recognized, but the payload frames are not transmitted because it's not connected on the TTN network. APB activation does work without any problems.

Theory, does the low RSSI of -119 mean something?

image

Here you can find my code.

`

#include <HardwareSerial.h>
#include <TinyGPS++.h>
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
#include "WiFi.h"
#include <CayenneLPP.h>

#define BUILTIN_LED 25

char s[32]; // used to sprintf for Serial output

TinyGPSPlus gps;
static u1_t DEVEUI[8] = {0xF3, 0x4B, 0x37, 0x43, 0x98, 0x3B, 0xAC, 0x00};
static u1_t APPEUI[8] = {0x9C, 0x03, 0x03, 0xD0, 0x7E, 0xD5, 0xB3, 0x70};
static u1_t APPKEY[16] = {0x71, 0x3B, 0x80, 0x81, 0xB0, 0xA1, 0x7A, 0xEA, 0x5D, 0xD8, 0xBA, 0xCC, 0xCF, 0x13, 0xE6, 0x10};

RTC_NOINIT_ATTR int RTCseqnoUp, RTCseqnoDn;
RTC_NOINIT_ATTR u4_t otaaDevAddr;
RTC_NOINIT_ATTR u1_t otaaNetwKey[16];
RTC_NOINIT_ATTR u1_t otaaApRtKey[16];

void os_getDevEui(u1_t *buf)
{
memcpy_P(buf, DEVEUI, 8);
}
void os_getArtEui(u1_t *buf) { memcpy_P(buf, APPEUI, 8); }
void os_getDevKey(u1_t *buf) { memcpy_P(buf, APPKEY, 16); }

static osjob_t sendjob;
const unsigned TX_INTERVAL = 30;

const lmic_pinmap lmic_pins = {
.nss = 18,
.rxtx = LMIC_UNUSED_PIN,
.rst = 14,
.dio = {26, 33, 32},
};

unsigned long last_update = 0;
String toLog;
uint8_t txBuffer[] = "Hey mo alles goed.";

void storeFrameCounters()
{
RTCseqnoUp = LMIC.seqnoUp;
RTCseqnoDn = LMIC.seqnoDn;
sprintf(s, "Counters stored as %d/%d", LMIC.seqnoUp, LMIC.seqnoDn);
Serial.println(s);
}

void restoreFrameCounters()
{
LMIC.seqnoUp = RTCseqnoUp;
LMIC.seqnoDn = RTCseqnoDn;
sprintf(s, "Restored counters as %d/%d", LMIC.seqnoUp, LMIC.seqnoDn);
Serial.println(s);
}

void setOrRestorePersistentCounters()
{
esp_reset_reason_t reason = esp_reset_reason();
if ((reason != ESP_RST_DEEPSLEEP) && (reason != ESP_RST_SW))
{
Serial.println(F("Counters both set to 0"));
LMIC.seqnoUp = 0;
LMIC.seqnoDn = 0;
}
else
{
restoreFrameCounters();
}
}
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
{

    CayenneLPP lpp(160);

    lpp.reset();
    lpp.addDigitalInput(1, random(2));
    lpp.addDigitalOutput(2, 1);
    lpp.addAnalogInput(3, 1.23f);
    lpp.addAnalogOutput(4, 3.45f);
    lpp.addLuminosity(5, 20304);

    LMIC_setTxData2(1, txBuffer, sizeof(txBuffer), 1);
    // LMIC_setTxData2(1, lpp.getBuffer(), lpp.getSize(), 0);
    Serial.println(F("Packet queued"));
    digitalWrite(BUILTIN_LED, HIGH);
}
// Next TX is scheduled after TX_COMPLETE event.

}

void onEvent(ev_t ev)
{
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"));
// Disable link check validation (automatically enabled
// during join, but not supported by TTN at this time).
LMIC_setLinkCheckMode(0);
break;
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;
break;
case EV_TXCOMPLETE:
Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)"));
digitalWrite(BUILTIN_LED, LOW);
if (LMIC.txrxFlags & TXRX_ACK)
{
Serial.println(F("Received ack"));
}
if (LMIC.dataLen)
{
Serial.println(F("Received "));
Serial.println(LMIC.dataLen);
Serial.println(F(" bytes of payload"));
}
storeFrameCounters();

    // 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;
default:
    Serial.println(F("Unknown event"));
    break;
}

}

void setup()
{
Serial.begin(115200);
//Turn off WiFi and Bluetooth
WiFi.mode(WIFI_OFF);
btStop();

SPI.begin(5, 19, 27);
// LMIC init
os_init();
// Reset the MAC state. Session and pending data transfers will be discarded.
LMIC_reset();

esp_reset_reason_t reason = esp_reset_reason();
if ((reason == ESP_RST_DEEPSLEEP) || (reason == ESP_RST_SW))
{
    LMIC_setSession(0x1, otaaDevAddr, otaaNetwKey, otaaApRtKey);
}

LMIC_setupChannel(0, 868100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);  // g-band
LMIC_setupChannel(1, 868300000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI); // g-band
LMIC_setupChannel(2, 868500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);  // g-band
LMIC_setupChannel(3, 867100000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);  // g-band
LMIC_setupChannel(4, 867300000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);  // g-band
LMIC_setupChannel(5, 867500000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);  // g-band
LMIC_setupChannel(6, 867700000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);  // g-band
LMIC_setupChannel(7, 867900000, DR_RANGE_MAP(DR_SF12, DR_SF7), BAND_CENTI);  // g-band
LMIC_setupChannel(8, 868800000, DR_RANGE_MAP(DR_FSK, DR_FSK), BAND_MILLI);   // g2-band

// TTN uses SF9 for its RX2 window.
LMIC.dn2Dr = DR_SF9;
LMIC_setClockError(MAX_CLOCK_ERROR * 1 / 100);

// Disable link check validation
LMIC_setLinkCheckMode(0);

// Set data rate and transmit power for uplink (note: txpow seems to be ignored by the library)
LMIC_setDrTxpow(DR_SF7, 14);
setOrRestorePersistentCounters();

// Start job
do_send(&sendjob);
pinMode(BUILTIN_LED, OUTPUT);
digitalWrite(BUILTIN_LED, LOW);

}

void loop()
{
os_runloop_once();
}`

TX only above certain speed

Hi,

Working with your software I intend to send the data with an interval of 60 seconds but only if the speed is above a certain value like >=5 kmh. I've tried so many options like:

if (actualSpeed >= 5 {
do_send(&sendjob);
}

but without success so far. Above code even results in not sending at all. I realize deepsleep can't be used because the speed needs to be monitored constantly but powering is not an issue in my case.

Can you help me to realize this?

Best regards, Hans.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.