Peter Buchegger 2020-05-11 17:50:25 +02:00
commit 00f9d4432a
7 zmienionych plików z 128 dodań i 97 usunięć

Wyświetl plik

@ -1,67 +1,13 @@
# Continuous Integration (CI) is the practice, in software language: python
# engineering, of merging all developer working copies with a shared mainline python:
# several times a day < https://docs.platformio.org/page/ci/index.html > - "2.7"
#
# 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).
#
sudo: false
# cache:
# Template #1: General project. Test it using existing `platformio.ini`. directories:
# - "~/.platformio"
install:
# language: python - pip install -U platformio
# python: - platformio update
# - "2.7" script:
# - platformio run
# 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

Wyświetl plik

@ -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/ * Heltec WiFi LoRa 32 V2 (433MHz SX1278) https://heltec.org/project/wifi-lora-32/
* TTGO LoRa32 V1 (433MHz SX1278) * TTGO LoRa32 V1 (433MHz SX1278)
* TTGO LoRa32 V2 (433MHz SX1278) * TTGO LoRa32 V2 (433MHz SX1278)
* TTGO T-Beam V0.7 (433MHz SX1278)
* TTGO T-Beam V1 (433MHz SX1278)
* many more... * many more...
Here are some amazon-de links for some example boards: 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. This boards cost around 20 Euros, they are very cheap but perfect for an LoRa iGate.
Keep in minde: you need a 433MHz version! Keep in minde: you need a 433MHz version!
## what you need to compile ## Compiling
### Additional boards manager URL (Arduino IDE only) ### How to compile
``` 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.
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
```
### Dependencies ### Dependencies
@ -52,3 +52,7 @@ Feel free to add a link to your iGate here:
## Future plans ## Future plans
The complete configuration should move to [IotWebConf](https://github.com/prampec/IotWebConf). 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)

Wyświetl plik

@ -9,6 +9,8 @@
; https://docs.platformio.org/page/projectconf.html ; https://docs.platformio.org/page/projectconf.html
[env] [env]
platform = espressif32
framework = arduino
lib_ldf_mode = deep+ lib_ldf_mode = deep+
monitor_speed = 115200 monitor_speed = 115200
lib_deps = lib_deps =
@ -19,12 +21,31 @@ lib_deps =
NTPClient NTPClient
APRS-IS-Lib APRS-IS-Lib
[env:heltec_wifi_lora_32] [env:ttgo-lora32-v1]
platform = espressif32 board = ttgo-lora32-v1
board = heltec_wifi_lora_32
framework = arduino
[env:heltec_wifi_lora_32_V2] # issue with platformio
platform = espressif32 #[env:ttgo-lora32-v2]
board = heltec_wifi_lora_32_V2 #board = ttgo-lora32-v2
framework = arduino
[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

Wyświetl plik

@ -7,6 +7,9 @@
#include <LoRa.h> #include <LoRa.h>
#include <APRS-IS.h> #include <APRS-IS.h>
#include <APRS-Decoder.h> #include <APRS-Decoder.h>
#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7)
#include <axp20x.h>
#endif
#include "settings.h" #include "settings.h"
#include "display.h" #include "display.h"
@ -15,6 +18,9 @@ WiFiMulti WiFiMulti;
WiFiUDP ntpUDP; WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, 60*60); NTPClient timeClient(ntpUDP, 60*60);
APRS_IS aprs_is(USER, PASS, TOOL, VERS); 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; int next_update = -1;
@ -22,6 +28,11 @@ void setup_wifi();
void setup_ota(); void setup_ota();
void setup_lora(); void setup_lora();
void setup_ntp(); void setup_ntp();
#if defined(ARDUINO_T_Beam) && !defined(ARDUINO_T_Beam_V0_7)
void setup_axp();
#endif
String BeaconMsg;
void setup() void setup()
{ {
@ -36,6 +47,17 @@ void setup()
setup_ota(); setup_ota();
setup_lora(); setup_lora();
setup_ntp(); 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); delay(500);
} }
@ -71,27 +93,40 @@ void loop()
} }
if(next_update == timeClient.getMinutes() || next_update == -1) if(next_update == timeClient.getMinutes() || next_update == -1)
{ {
show_display(call, "Broadcast to Server..."); show_display(USER, "Broadcast to Server...");
Serial.print("[" + timeClient.getFormattedTime() + "] "); Serial.print("[" + timeClient.getFormattedTime() + "] ");
aprs_is.sendMessage(BROADCAST_MESSAGE); aprs_is.sendMessage(BeaconMsg);
next_update = (timeClient.getMinutes() + BROADCAST_TIMEOUT) % 60; next_update = (timeClient.getMinutes() + BEACON_TIMEOUT) % 60;
} }
if(aprs_is.available() > 0) if(aprs_is.available() > 0)
{ {
String str = aprs_is.getMessage(); String str = aprs_is.getMessage();
Serial.print("[" + timeClient.getFormattedTime() + "] "); Serial.print("[" + timeClient.getFormattedTime() + "] ");
Serial.println(str); Serial.println(str);
show_display(call, timeClient.getFormattedTime(), str, 0); show_display(USER, timeClient.getFormattedTime(), str, 0);
} }
if(LoRa.parsePacket()) 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; String str;
Serial.print("[" + timeClient.getFormattedTime() + "] ");
Serial.print(" Received packet '");
while(LoRa.available()) while(LoRa.available())
{ {
str += (char)LoRa.read(); str += (char)LoRa.read();
} }
Serial.print("[" + timeClient.getFormattedTime() + "] ");
Serial.print(" Received packet '");
Serial.print(str); Serial.print(str);
Serial.print("' with RSSI "); Serial.print("' with RSSI ");
Serial.print(LoRa.packetRssi()); Serial.print(LoRa.packetRssi());
@ -104,7 +139,7 @@ void loop()
Serial.println(msg.toString());*/ Serial.println(msg.toString());*/
aprs_is.sendMessage(str); 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() void setup_lora()
{ {
Serial.println("[INFO] Set SPI pins!"); Serial.println("[INFO] Set SPI pins!");
SPI.begin(SCK, MISO, MOSI, SS); SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_CS);
LoRa.setPins(SS, RST_LoRa, DIO0); LoRa.setPins(LORA_CS, LORA_RST, LORA_IRQ);
Serial.println("[INFO] Set LoRa pins!"); Serial.println("[INFO] Set LoRa pins!");
long freq = 433775000; long freq = 433775000;
@ -203,3 +238,20 @@ void setup_ntp()
Serial.println("[INFO] NTP Client init done!"); Serial.println("[INFO] NTP Client init done!");
show_display("INFO", "NTP Client init done!", 2000); 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

Wyświetl plik

@ -5,16 +5,16 @@
#include "display.h" #include "display.h"
Adafruit_SSD1306 display(DISPLAY_WIDTH, DISPLAY_HEIGHT, &Wire, RST_OLED); Adafruit_SSD1306 display(128, 64, &Wire, OLED_RST);
void setup_display() void setup_display()
{ {
pinMode(RST_OLED, OUTPUT); pinMode(OLED_RST, OUTPUT);
digitalWrite(RST_OLED, LOW); digitalWrite(OLED_RST, LOW);
delay(20); 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)) if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false))
{ {
Serial.println("SSD1306 allocation failed"); Serial.println("SSD1306 allocation failed");

Wyświetl plik

@ -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, int wait = 0);
void show_display(String header, String line1, String line2, String line3, String line4, String line5, 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 #endif

Wyświetl plik

@ -5,7 +5,7 @@
#define WIFI_NAME "" #define WIFI_NAME ""
#define WIFI_KEY "" #define WIFI_KEY ""
#define USER "OE5BPA-10" #define USER "NOCALL-10"
#define PASS "" #define PASS ""
#define TOOL "ESP32-APRS-IS" #define TOOL "ESP32-APRS-IS"
#define VERS "0.1" #define VERS "0.1"
@ -15,9 +15,11 @@
//#define SERVER "euro.aprs2.net" //#define SERVER "euro.aprs2.net"
#define PORT 14580 #define PORT 14580
#define BROADCAST_TIMEOUT 15 #define BEACON_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_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 #endif