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 diff --git a/README.md b/README.md index dc7399c..9d1a70f 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,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: @@ -23,13 +25,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 +52,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) diff --git a/platformio.ini b/platformio.ini index f79b5db..084b73a 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,31 @@ 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 +# issue with platformio +#[env:ttgo-lora32-v2] +#board = ttgo-lora32-v2 + +[env:ttgo-t-beam-v1] +board = ttgo-t-beam +lib_deps = + Adafruit GFX Library + Adafruit SSD1306 + LoRa + APRS-Decoder-Lib + NTPClient + APRS-IS-Lib + 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 +build_flags = -DARDUINO_T_Beam_V0_7 diff --git a/src/LoRa_APRS_iGate.ino b/src/LoRa_APRS_iGate.cpp similarity index 74% rename from src/LoRa_APRS_iGate.ino rename to src/LoRa_APRS_iGate.cpp index cd7e760..ebc632c 100644 --- a/src/LoRa_APRS_iGate.ino +++ b/src/LoRa_APRS_iGate.cpp @@ -7,6 +7,9 @@ #include #include #include +#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) +#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); +#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) +AXP20X_Class axp; +#endif int next_update = -1; @@ -22,6 +28,11 @@ void setup_wifi(); void setup_ota(); void setup_lora(); void setup_ntp(); +#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) +void setup_axp(); +#endif + +String BeaconMsg; void setup() { @@ -36,6 +47,17 @@ void setup() setup_ota(); setup_lora(); setup_ntp(); + #if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) + setup_axp(); + #endif + + 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,27 +93,40 @@ 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(BROADCAST_MESSAGE); - next_update = (timeClient.getMinutes() + BROADCAST_TIMEOUT) % 60; + aprs_is.sendMessage(BeaconMsg); + next_update = (timeClient.getMinutes() + BEACON_TIMEOUT) % 60; } if(aprs_is.available() > 0) { 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()) { + // 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()); @@ -104,7 +139,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); } } @@ -172,8 +207,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; @@ -203,3 +238,20 @@ void setup_ntp() Serial.println("[INFO] NTP Client init done!"); show_display("INFO", "NTP Client init done!", 2000); } + +#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7) +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 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 diff --git a/src/settings.h b/src/settings.h index 0354eb4..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" @@ -15,9 +15,11 @@ //#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_LAT_POS "4819.82N" +#define BEACON_LONG_POS "01418.68E" +#define BEACON_MESSAGE "LoRa IGATE (RX only), Info: github.com/peterus/LoRa_APRS_iGate" -String call = "OE5BPA"; +//#define ARDUINO_T_Beam_V0_7 #endif