From 64a672febad000ee1cb5564e43a72ef9431154e7 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Fri, 8 May 2020 22:15:17 +0200 Subject: [PATCH 01/11] rename ino file --- src/{LoRa_APRS_iGate.ino => LoRa_APRS_iGate.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{LoRa_APRS_iGate.ino => LoRa_APRS_iGate.cpp} (100%) diff --git a/src/LoRa_APRS_iGate.ino b/src/LoRa_APRS_iGate.cpp similarity index 100% rename from src/LoRa_APRS_iGate.ino rename to src/LoRa_APRS_iGate.cpp From 001a8f4b42ffa6a54d31768468fafe66b80567f0 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Fri, 8 May 2020 22:21:07 +0200 Subject: [PATCH 02/11] rename broadcast to beacon --- src/LoRa_APRS_iGate.cpp | 4 ++-- src/settings.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index cd7e760..fb6f503 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -73,8 +73,8 @@ void loop() { show_display(call, "Broadcast to Server..."); Serial.print("[" + timeClient.getFormattedTime() + "] "); - aprs_is.sendMessage(BROADCAST_MESSAGE); - next_update = (timeClient.getMinutes() + BROADCAST_TIMEOUT) % 60; + aprs_is.sendMessage(BEACON_MESSAGE); + next_update = (timeClient.getMinutes() + BEACON_TIMEOUT) % 60; } if(aprs_is.available() > 0) { diff --git a/src/settings.h b/src/settings.h index 0354eb4..085fba4 100644 --- a/src/settings.h +++ b/src/settings.h @@ -15,8 +15,8 @@ //#define SERVER "euro.aprs2.net" #define PORT 14580 -#define BROADCAST_TIMEOUT 15 -#define BROADCAST_MESSAGE "OE5BPA-10>APRS:=4819.82NI01418.68E&LoRa IGATE (test RX mode), Info: github.com/peterus/LoRa_APRS_iGate" +#define BEACON_TIMEOUT 15 +#define BEACON_MESSAGE "OE5BPA-10>APRS:=4819.82NI01418.68E&LoRa IGATE (test RX mode), Info: github.com/peterus/LoRa_APRS_iGate" String call = "OE5BPA"; From 2c655eda47722b9bdf8500e4408e8f26ca05cdc0 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Fri, 8 May 2020 23:09:44 +0200 Subject: [PATCH 03/11] beacon msg in multiple defines --- src/LoRa_APRS_iGate.cpp | 18 ++++++++++++++---- src/settings.h | 6 +++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index fb6f503..cdf9284 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -23,6 +23,8 @@ void setup_ota(); void setup_lora(); void setup_ntp(); +String BeaconMsg; + void setup() { Serial.begin(115200); @@ -36,6 +38,14 @@ void setup() setup_ota(); setup_lora(); setup_ntp(); + + APRSMessage msg; + msg.setSource(USER); + msg.setDestination("APRS"); + char body_char[100]; + sprintf(body_char, "=%sI%s&%s", BEACON_LAT_POS, BEACON_LONG_POS, BEACON_MESSAGE); + msg.getAPRSBody()->setData(String(body_char)); + BeaconMsg = msg.encode(); delay(500); } @@ -71,9 +81,9 @@ void loop() } if(next_update == timeClient.getMinutes() || next_update == -1) { - show_display(call, "Broadcast to Server..."); + show_display(USER, "Broadcast to Server..."); Serial.print("[" + timeClient.getFormattedTime() + "] "); - aprs_is.sendMessage(BEACON_MESSAGE); + aprs_is.sendMessage(BeaconMsg); next_update = (timeClient.getMinutes() + BEACON_TIMEOUT) % 60; } if(aprs_is.available() > 0) @@ -81,7 +91,7 @@ void loop() String str = aprs_is.getMessage(); Serial.print("[" + timeClient.getFormattedTime() + "] "); Serial.println(str); - show_display(call, timeClient.getFormattedTime(), str, 0); + show_display(USER, timeClient.getFormattedTime(), str, 0); } if(LoRa.parsePacket()) { @@ -104,7 +114,7 @@ void loop() Serial.println(msg.toString());*/ aprs_is.sendMessage(str); - show_display(call, timeClient.getFormattedTime(), "RSSI: " + String(LoRa.packetRssi()), "SNR: " + String(LoRa.packetSnr()), str, 0); + show_display(USER, timeClient.getFormattedTime(), "RSSI: " + String(LoRa.packetRssi()), "SNR: " + String(LoRa.packetSnr()), str, 0); } } diff --git a/src/settings.h b/src/settings.h index 085fba4..e4c0f9b 100644 --- a/src/settings.h +++ b/src/settings.h @@ -16,8 +16,8 @@ #define PORT 14580 #define BEACON_TIMEOUT 15 -#define BEACON_MESSAGE "OE5BPA-10>APRS:=4819.82NI01418.68E&LoRa IGATE (test RX mode), Info: github.com/peterus/LoRa_APRS_iGate" - -String call = "OE5BPA"; +#define BEACON_LAT_POS "4819.82N" +#define BEACON_LONG_POS "01418.68E" +#define BEACON_MESSAGE "LoRa IGATE (test RX mode), Info: github.com/peterus/LoRa_APRS_iGate" #endif From 9bc20ead1f57a2c37ef3ed7c9b862b236f5f2689 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Fri, 8 May 2020 23:59:19 +0200 Subject: [PATCH 04/11] cleanup pin definitions --- platformio.ini | 26 ++++++++++++++++++-------- src/LoRa_APRS_iGate.cpp | 4 ++-- src/display.cpp | 10 +++++----- src/display.h | 6 ++++++ 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/platformio.ini b/platformio.ini index f79b5db..d7b83f9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,6 +9,8 @@ ; https://docs.platformio.org/page/projectconf.html [env] +platform = espressif32 +framework = arduino lib_ldf_mode = deep+ monitor_speed = 115200 lib_deps = @@ -19,12 +21,20 @@ lib_deps = NTPClient APRS-IS-Lib -[env:heltec_wifi_lora_32] -platform = espressif32 -board = heltec_wifi_lora_32 -framework = arduino +[env:ttgo-lora32-v1] +board = ttgo-lora32-v1 -[env:heltec_wifi_lora_32_V2] -platform = espressif32 -board = heltec_wifi_lora_32_V2 -framework = arduino +[env:ttgo-lora32-v2] +board = ttgo-lora32-v2 + +[env:ttgo-t-beam] +board = ttgo-t-beam +lib_deps = + Adafruit GFX Library + Adafruit SSD1306 + LoRa + APRS-Decoder-Lib + NTPClient + APRS-IS-Lib + TinyGPSPlus + AXP202X_Library diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index cdf9284..daea873 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -182,8 +182,8 @@ void setup_ota() void setup_lora() { Serial.println("[INFO] Set SPI pins!"); - SPI.begin(SCK, MISO, MOSI, SS); - LoRa.setPins(SS, RST_LoRa, DIO0); + SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS); + LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ); Serial.println("[INFO] Set LoRa pins!"); long freq = 433775000; diff --git a/src/display.cpp b/src/display.cpp index 9746945..884c188 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -5,16 +5,16 @@ #include "display.h" -Adafruit_SSD1306 display(DISPLAY_WIDTH, DISPLAY_HEIGHT, &Wire, RST_OLED); +Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST); void setup_display() { - pinMode(RST_OLED, OUTPUT); - digitalWrite(RST_OLED, LOW); + pinMode(OLED_RST, OUTPUT); + digitalWrite(OLED_RST, LOW); delay(20); - digitalWrite(RST_OLED, HIGH); + digitalWrite(OLED_RST, HIGH); - Wire.begin(SDA_OLED, SCL_OLED); + Wire.begin(OLED_SDA, OLED_SCL); if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { Serial.println("SSD1306 allocation failed"); diff --git a/src/display.h b/src/display.h index 2aec8de..889c162 100644 --- a/src/display.h +++ b/src/display.h @@ -11,4 +11,10 @@ void show_display(String header, String line1, String line2, String line3, int w void show_display(String header, String line1, String line2, String line3, String line4, int wait = 0); void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait = 0); +#ifdef ARDUINO_T_Beam +#define OLED_SDA 21 +#define OLED_SCL 22 +#define OLED_RST 4 +#endif + #endif From 7e04dab7d1281122d7baa7d87ec2a32999fe6417 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Sat, 9 May 2020 00:10:34 +0200 Subject: [PATCH 05/11] axp for ttgo t-bone added --- src/LoRa_APRS_iGate.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index daea873..5934aa5 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -7,6 +7,9 @@ #include #include #include +#ifdef ARDUINO_T_Beam +#include +#endif #include "settings.h" #include "display.h" @@ -15,6 +18,9 @@ WiFiMulti WiFiMulti; WiFiUDP ntpUDP; NTPClient timeClient(ntpUDP, 60*60); APRS_IS aprs_is(USER, PASS, TOOL, VERS); +#ifdef ARDUINO_T_Beam +AXP20X_Class axp; +#endif int next_update = -1; @@ -22,6 +28,9 @@ void setup_wifi(); void setup_ota(); void setup_lora(); void setup_ntp(); +#ifdef ARDUINO_T_Beam +void setup_axp(); +#endif String BeaconMsg; @@ -38,6 +47,9 @@ void setup() setup_ota(); setup_lora(); setup_ntp(); + #ifdef ARDUINO_T_Beam + setup_axp(); + #endif APRSMessage msg; msg.setSource(USER); @@ -213,3 +225,20 @@ void setup_ntp() Serial.println("[INFO] NTP Client init done!"); show_display("INFO", "NTP Client init done!", 2000); } + +#ifdef ARDUINO_T_Beam +void setup_axp() +{ + Wire.begin(SDA, SCL); + if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) + { + Serial.println("LoRa-APRS / Init / AXP192 Begin PASS"); + } else { + Serial.println("LoRa-APRS / Init / AXP192 Begin FAIL"); + } + axp.setPowerOutPut(AXP192_LDO2, AXP202_ON); // LORA + axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // GPS + axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // OLED + axp.setDCDC1Voltage(3300); +} +#endif From 1d31adb142a3a0759ab58e88cb62fa6ae842ae4f Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 11 May 2020 11:55:13 +0200 Subject: [PATCH 06/11] add travis --- .travis.yml | 78 +++++++++-------------------------------------------- 1 file changed, 12 insertions(+), 66 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c486f1..d6f4a52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,67 +1,13 @@ -# Continuous Integration (CI) is the practice, in software -# engineering, of merging all developer working copies with a shared mainline -# several times a day < https://docs.platformio.org/page/ci/index.html > -# -# Documentation: -# -# * Travis CI Embedded Builds with PlatformIO -# < https://docs.travis-ci.com/user/integration/platformio/ > -# -# * PlatformIO integration with Travis CI -# < https://docs.platformio.org/page/ci/travis.html > -# -# * User Guide for `platformio ci` command -# < https://docs.platformio.org/page/userguide/cmd_ci.html > -# -# -# Please choose one of the following templates (proposed below) and uncomment -# it (remove "# " before each line) or use own configuration according to the -# Travis CI documentation (see above). -# +language: python +python: + - "2.7" - -# -# Template #1: General project. Test it using existing `platformio.ini`. -# - -# language: python -# python: -# - "2.7" -# -# sudo: false -# cache: -# directories: -# - "~/.platformio" -# -# install: -# - pip install -U platformio -# - platformio update -# -# script: -# - platformio run - - -# -# Template #2: The project is intended to be used as a library with examples. -# - -# language: python -# python: -# - "2.7" -# -# sudo: false -# cache: -# directories: -# - "~/.platformio" -# -# env: -# - PLATFORMIO_CI_SRC=path/to/test/file.c -# - PLATFORMIO_CI_SRC=examples/file.ino -# - PLATFORMIO_CI_SRC=path/to/test/directory -# -# install: -# - pip install -U platformio -# - platformio update -# -# script: -# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N +sudo: false +cache: + directories: + - "~/.platformio" +install: + - pip install -U platformio + - platformio update +script: + - platformio run \ No newline at end of file From 9f0594b8f05d5a7050c93c383464753f6f14b937 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 11 May 2020 11:57:42 +0200 Subject: [PATCH 07/11] add support for T-Beam v0.7 --- platformio.ini | 19 ++++++++++++++++--- src/LoRa_APRS_iGate.cpp | 10 +++++----- src/settings.h | 6 ++++-- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/platformio.ini b/platformio.ini index d7b83f9..f0a6fc3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -24,10 +24,11 @@ lib_deps = [env:ttgo-lora32-v1] board = ttgo-lora32-v1 -[env:ttgo-lora32-v2] -board = ttgo-lora32-v2 +# issue with platformio +#[env:ttgo-lora32-v2] +#board = ttgo-lora32-v2 -[env:ttgo-t-beam] +[env:ttgo-t-beam-v1] board = ttgo-t-beam lib_deps = Adafruit GFX Library @@ -38,3 +39,15 @@ lib_deps = APRS-IS-Lib TinyGPSPlus AXP202X_Library + +[env:ttgo-t-beam-v0_7] +board = ttgo-t-beam +lib_deps = + Adafruit GFX Library + Adafruit SSD1306 + LoRa + APRS-Decoder-Lib + NTPClient + APRS-IS-Lib + TinyGPSPlus +build_flags = -DARDUINO_T_Beam_V0_7 diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 5934aa5..86fe462 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -7,7 +7,7 @@ #include #include #include -#ifdef ARDUINO_T_Beam +#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) #include #endif @@ -18,7 +18,7 @@ WiFiMulti WiFiMulti; WiFiUDP ntpUDP; NTPClient timeClient(ntpUDP, 60*60); APRS_IS aprs_is(USER, PASS, TOOL, VERS); -#ifdef ARDUINO_T_Beam +#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) AXP20X_Class axp; #endif @@ -28,7 +28,7 @@ void setup_wifi(); void setup_ota(); void setup_lora(); void setup_ntp(); -#ifdef ARDUINO_T_Beam +#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) void setup_axp(); #endif @@ -47,7 +47,7 @@ void setup() setup_ota(); setup_lora(); setup_ntp(); - #ifdef ARDUINO_T_Beam + #if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) setup_axp(); #endif @@ -226,7 +226,7 @@ void setup_ntp() show_display("INFO", "NTP Client init done!", 2000); } -#ifdef ARDUINO_T_Beam +#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) void setup_axp() { Wire.begin(SDA, SCL); diff --git a/src/settings.h b/src/settings.h index e4c0f9b..12be4d3 100644 --- a/src/settings.h +++ b/src/settings.h @@ -5,7 +5,7 @@ #define WIFI_NAME "" #define WIFI_KEY "" -#define USER "OE5BPA-10" +#define USER "NOCALL-10" #define PASS "" #define TOOL "ESP32-APRS-IS" #define VERS "0.1" @@ -18,6 +18,8 @@ #define BEACON_TIMEOUT 15 #define BEACON_LAT_POS "4819.82N" #define BEACON_LONG_POS "01418.68E" -#define BEACON_MESSAGE "LoRa IGATE (test RX mode), Info: github.com/peterus/LoRa_APRS_iGate" +#define BEACON_MESSAGE "LoRa IGATE (RX only), Info: github.com/peterus/LoRa_APRS_iGate" + +//#define ARDUINO_T_Beam_V0_7 #endif From bbfd090ab89dbd27f0197b51b0869a4134a54e11 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 11 May 2020 12:00:07 +0200 Subject: [PATCH 08/11] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 295e179..0c94531 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ You can use one of the Lora32 boards: * Heltec WiFi LoRa 32 V2 (433MHz SX1278) https://heltec.org/project/wifi-lora-32/ * TTGO LoRa32 V1 (433MHz SX1278) * TTGO LoRa32 V2 (433MHz SX1278) +* TTGO T-Beam V0.7 (433MHz SX1278) +* TTGO T-Beam V1 (433MHz SX1278) * many more... Here are some amazon-de links for some example boards: From 8f1b0d3fb3eb940f7d88ee472cd60c1ac9cb1f9a Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 11 May 2020 12:05:32 +0200 Subject: [PATCH 09/11] remove tiny gps lib --- platformio.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index f0a6fc3..084b73a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -37,7 +37,6 @@ lib_deps = APRS-Decoder-Lib NTPClient APRS-IS-Lib - TinyGPSPlus AXP202X_Library [env:ttgo-t-beam-v0_7] @@ -49,5 +48,4 @@ lib_deps = APRS-Decoder-Lib NTPClient APRS-IS-Lib - TinyGPSPlus build_flags = -DARDUINO_T_Beam_V0_7 From 0e3e86de79327103ab765a343a264e56d537ef62 Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 11 May 2020 13:41:33 +0200 Subject: [PATCH 10/11] add LoRa Header (3bytes) --- src/LoRa_APRS_iGate.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 86fe462..ebc632c 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -107,13 +107,26 @@ void loop() } if(LoRa.parsePacket()) { + // read header: + char dummy[4]; + LoRa.readBytes(dummy, 3); + if(dummy[0] != '<') + { + // is no APRS message, ignore message + while(LoRa.available()) + { + LoRa.read(); + } + return; + } + // read APRS data: String str; - Serial.print("[" + timeClient.getFormattedTime() + "] "); - Serial.print(" Received packet '"); while(LoRa.available()) { str += (char)LoRa.read(); } + Serial.print("[" + timeClient.getFormattedTime() + "] "); + Serial.print(" Received packet '"); Serial.print(str); Serial.print("' with RSSI "); Serial.print(LoRa.packetRssi()); From d0e7e2f9185e84b336c50271e12a9ac23c42ab5f Mon Sep 17 00:00:00 2001 From: Peter Buchegger Date: Mon, 11 May 2020 16:00:04 +0200 Subject: [PATCH 11/11] Update README.md --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0c94531..0e86c36 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,11 @@ Here are some amazon-de links for some example boards: This boards cost around 20 Euros, they are very cheap but perfect for an LoRa iGate. Keep in minde: you need a 433MHz version! -## what you need to compile +## Compiling -### Additional boards manager URL (Arduino IDE only) +### How to compile -``` -https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json -``` +The best success is to use PlatformIO. Go to https://platformio.org/ and download the IDE. Just open the folder and you can compile the Firmware. ### Dependencies @@ -52,3 +50,7 @@ Feel free to add a link to your iGate here: ## Future plans The complete configuration should move to [IotWebConf](https://github.com/prampec/IotWebConf). + +## LoRa Tracker + +Look at my other project: a [LoRa Tracker](https://github.com/peterus/LoRa_APRS_Tracker)