From 4c36046c99119336f2f7c2debed2deabec1739ed Mon Sep 17 00:00:00 2001 From: Louis Thiery Date: Thu, 6 Feb 2020 11:34:00 -0800 Subject: [PATCH 1/4] Use Helium asset for library installation image --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 82c6f41..8c6dce1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ From the Arduino IDE, open the Library Manager (Sketch->Include Library->Manage Libraries). In the search box, type MCCI and select the MCCI LoRaWAN LMIC library should be the first result. -![](https://cdn-learn.adafruit.com/assets/assets/000/062/526/medium800/feather_Library_Manager_MCCI.png?1537882799) +![](https://developer.helium.com/static/library_manager-56bed2bb23b6f93e5cc3b25bdfd345a2.png) ## Board Support @@ -60,4 +60,4 @@ To put the board in DFU mode, hold down the boot button while pressing and relea Arduino IDE: Select Tools -> Upload Method -> STLink -Requires an ST-Link debugger connected to SWCLK, SWDIO, Vref, and GND, refer to pin mapping diagram. \ No newline at end of file +Requires an ST-Link debugger connected to SWCLK, SWDIO, Vref, and GND, refer to pin mapping diagram. From 8f35d8740b648e02e143983f05c575a7afe25051 Mon Sep 17 00:00:00 2001 From: lthiery Date: Thu, 6 Feb 2020 13:29:00 -0800 Subject: [PATCH 2/4] ignore installed libraries - allows for usage of this repo as sketchbook location --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c00de04 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +libraries/* From 10ffd551b5f3e0ab39d759aed24bce6adb33c409 Mon Sep 17 00:00:00 2001 From: Addy Gallareta Date: Thu, 6 Feb 2020 10:31:12 -0800 Subject: [PATCH 3/4] gps --- longfi-us915/longfi-us915.ino | 64 ++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/longfi-us915/longfi-us915.ino b/longfi-us915/longfi-us915.ino index e3e4213..4e40b89 100644 --- a/longfi-us915/longfi-us915.ino +++ b/longfi-us915/longfi-us915.ino @@ -35,6 +35,15 @@ #include #include #include +#include + +#define GPSSerial Serial1 + +#define CFG_sx1276_radio 1 + +// Connect to the GPS on the hardware port +Adafruit_GPS GPS(&GPSSerial); + // This is the "App EUI" in Helium. Make sure it is little-endian (lsb). static const u1_t PROGMEM APPEUI[8]= { FILL_ME_IN }; @@ -232,11 +241,46 @@ void do_send(osjob_t* j){ 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); + + // Prepare upstream data transmission at the next possible time. + static uint8_t payload[32]; + uint8_t idx = 0; + uint32_t data; + + if (GPS.newNMEAreceived()) { + GPS.parse(GPS.lastNMEA()); + } + + if (GPS.fix) { + Serial.println(GPS.latitudeDegrees); + Serial.println(GPS.longitudeDegrees); + //data = GPS.latitude_fixed * (GPS.lat == 'N' ? 1 : -1) + 90 * 1E7; + data = (int)(GPS.latitudeDegrees * 1E7); + payload[idx++] = data >> 24; + payload[idx++] = data >> 16; + payload[idx++] = data >> 8; + payload[idx++] = data; + //data = GPS.longitude_fixed * (GPS.lon == 'E' ? 1 : -1) + 180 * 1E7; + data = (int)(GPS.longitudeDegrees * 1E7); + payload[idx++] = data >> 24; + payload[idx++] = data >> 16; + payload[idx++] = data >> 8; + payload[idx++] = data; + data = (int)(GPS.altitude + 0.5); + payload[idx++] = data >> 8; + payload[idx++] = data; + payload[idx++] = 0; + payload[idx++] = 0; + } else { + for (idx=0; idx<12; idx++) { + payload[idx] = 0; + } + } + //LMIC_setTxData2(1, mydata, sizeof(mydata)-1, 0); Serial.println(F("Packet queued")); + LMIC_setTxData2(1, payload, idx, 0); } - // Next TX is scheduled after TX_COMPLETE event. + } void setup() { @@ -272,16 +316,26 @@ void setup() { // the X/1000 means an error rate of 0.1%; the above issue discusses using values up to 10%. // so, values from 10 (10% error, the most lax) to 1000 (0.1% error, the most strict) can be used. LMIC_setClockError(1 * MAX_CLOCK_ERROR / 40); - + + LMIC_setLinkCheckMode(0); LMIC_setDrTxpow(DR_SF8, 20); LMIC_selectSubBand(6); + GPS.begin(9600); + // Only interrested in GGA, no antenna status + GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA); + GPS.sendCommand(PGCMD_NOANTENNA); + + // Update every second + GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); // 1 Hz update rate + // Start job (sending automatically starts OTAA too) do_send(&sendjob); } void loop() { + GPS.read(); os_runloop_once(); } @@ -326,4 +380,4 @@ namespace Arduino_LMIC { return myPinmap; } -}; // end namespace Arduino_LMIC \ No newline at end of file +}; // end namespace Arduino_LMIC From 14c03de19eda45b454220ef0f9a7e627e65743a9 Mon Sep 17 00:00:00 2001 From: Addy Gallareta Date: Thu, 6 Feb 2020 10:50:10 -0800 Subject: [PATCH 4/4] gps-cleanup --- longfi-us915/longfi-us915.ino | 2 -- 1 file changed, 2 deletions(-) diff --git a/longfi-us915/longfi-us915.ino b/longfi-us915/longfi-us915.ino index 4e40b89..ce5663b 100644 --- a/longfi-us915/longfi-us915.ino +++ b/longfi-us915/longfi-us915.ino @@ -317,7 +317,6 @@ void setup() { // so, values from 10 (10% error, the most lax) to 1000 (0.1% error, the most strict) can be used. LMIC_setClockError(1 * MAX_CLOCK_ERROR / 40); - LMIC_setLinkCheckMode(0); LMIC_setDrTxpow(DR_SF8, 20); LMIC_selectSubBand(6); @@ -379,5 +378,4 @@ namespace Arduino_LMIC { { return myPinmap; } - }; // end namespace Arduino_LMIC