commit
c8cff5787b
|
@ -0,0 +1,35 @@
|
|||
<h2>Installation Guide using PlatformIO</h2>
|
||||
<br>
|
||||
1. Clone all files of the respository to your local working directory<br>
|
||||
2. Install the missing libraries<br>
|
||||
There are two possibilities - either using the Library Manager of PlatformIO or the command line tool:<br>
|
||||
<h3>1. Built-In Liabrary Manager</h3>
|
||||
Press the PlatformIO HOME Button to enter the Home Screen and there the Libraries Button to add missing libraries:<br>
|
||||
<img src="img/img1.jpg" width="480"><br>
|
||||
Search and install the following libaries:<br>
|
||||
<ul>
|
||||
<li>RadioHead</li>
|
||||
<li>TinyGPSPlus</li>
|
||||
<li>DHT sensor library for ESPx</li>
|
||||
<li>Adafruit SSD1306</li>
|
||||
<li>Adafruit GFX Library</li>
|
||||
<li>Adafruit Unified Sensor</li>
|
||||
<li>AXP202X_Library</li>
|
||||
<li>OneWire</li>
|
||||
<li>DallasTemperature</li>
|
||||
</ul>
|
||||
<br>
|
||||
<h3>2. Command Line Tool</h3>
|
||||
use the following commands<br>
|
||||
platformio lib install "RadioHead"<br>
|
||||
platformio lib install "TinyGPSPlus"<br>
|
||||
platformio lib install "DHT sensor library for ESPx"<br>
|
||||
platformio lib install "Adafruit SSD1306"<br>
|
||||
platformio lib install "Adafruit GFX Library"<br>
|
||||
platformio lib install "AXP202X_Library"<br>
|
||||
platformio lib install "Adafruit Unified Sensor"<br>
|
||||
platformio lib install "OneWire"<br>
|
||||
platformio lib install "DallasTemperature"<br>
|
||||
<br>
|
||||
Check that the platformio.ini is available as it holds the board type for PlatformIO.<br>
|
||||
After pressing the check mark the code will be compiled, after pressing the arrow it will be compiled and uploaded to a connected TTGO.<br>
|
|
@ -32,9 +32,13 @@ The symbol can now be changed without attached display - during normal operation
|
|||
<b>2x TX LED blinks represent "yes" to leave the setup</b> - press here the key to leave the setup - please do so if you don't have a display attached.<br>
|
||||
1x TX LED blinks represent "no" to continue with the setup - press here the key to continue the setup - please do so if you have a display attached.<br>
|
||||
<br>
|
||||
<b>Temperature Sensor:</b><br>
|
||||
for DHT22 I used the library from https://github.com/beegee-tokyo/DHTesp, as the standard library gives to many wrong readings<br>
|
||||
Now the DS18B20 is supported as well - uncomment line 31: // #define DS18B20 // use this if you use DS18B20, default ist DHT22<br>
|
||||
<br>
|
||||
new features:<br>
|
||||
- DS18B20 support (setable in config.h)
|
||||
- GPS switched off in WX_FIXED mode (only available with boards with HW-Version >=V1.0)
|
||||
- immediate TX with short key press
|
||||
- course changes of >30° will cause a TX beacon
|
||||
- code optimized and cleaned
|
||||
|
|
Plik binarny nie jest wyświetlany.
Po Szerokość: | Wysokość: | Rozmiar: 114 KiB |
|
@ -41,7 +41,12 @@
|
|||
|
||||
#include <TinyGPS++.h>
|
||||
#include <math.h>
|
||||
#include <DHTesp.h> // library from https://github.com/beegee-tokyo/DHTesp
|
||||
#ifdef DS18B20
|
||||
#include <OneWire.h> // libraries for DS18B20
|
||||
#include <DallasTemperature.h>
|
||||
#else
|
||||
#include <DHTesp.h> // library from https://github.com/beegee-tokyo/DHTesp for DHT22
|
||||
#endif
|
||||
#include <driver/adc.h>
|
||||
#include <Wire.h>
|
||||
|
||||
|
@ -67,7 +72,7 @@
|
|||
#define SSD1306_ADDRESS 0x3C
|
||||
|
||||
// AXP192 address
|
||||
#define AXP192_SLAVE_ADDRESS 0x34
|
||||
// #define AXP192_SLAVE_ADDRESS 0x34 // already defined in axp20x.h
|
||||
|
||||
/* for feather32u4
|
||||
#define RFM95_CS 8
|
||||
|
@ -142,7 +147,8 @@ const byte RX_en = 0; //TX/RX enable 1W modul
|
|||
|
||||
// #define ModemConfig BG_RF95::Bw125Cr45Sf4096
|
||||
|
||||
#define DHTPIN 25 // pin the DHT22 is connected to Pin25
|
||||
#define DHTPIN 25 // the DHT22 is connected to PIN25
|
||||
#define ONE_WIRE_BUS 25 // the DS18B20 is connected to PIN25
|
||||
|
||||
// Variables for APRS packaging
|
||||
String Tcall; //your Call Sign for normal position reports
|
||||
|
@ -210,7 +216,13 @@ void writedisplaytext(String, String, String, String, String, String, int);
|
|||
void setup_data(void);
|
||||
|
||||
|
||||
DHTesp dht;
|
||||
#ifdef DS18B20
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
DallasTemperature sensors(&oneWire);
|
||||
#else
|
||||
DHTesp dht; // Initialize DHT sensor for normal 16mhz Arduino
|
||||
#endif
|
||||
|
||||
|
||||
// SoftwareSerial ss(RXPin, TXPin); // The serial connection to the GPS device
|
||||
HardwareSerial ss(1); // TTGO has HW serial
|
||||
|
@ -265,7 +277,11 @@ void setup()
|
|||
Serial.println("LoRa-APRS / Init / AXP192 Begin FAIL");
|
||||
}
|
||||
axp.setPowerOutPut(AXP192_LDO2, AXP202_ON);
|
||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON);
|
||||
if (tracker_mode != WX_FIXED) {
|
||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // switch on GPS in all modes except WX_FIXED
|
||||
} else {
|
||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF); // switch off GPS in WX_FIXED mode
|
||||
}
|
||||
axp.setPowerOutPut(AXP192_DCDC2, AXP202_ON);
|
||||
axp.setPowerOutPut(AXP192_EXTEN, AXP202_ON);
|
||||
axp.setPowerOutPut(AXP192_DCDC1, AXP202_ON);
|
||||
|
@ -369,6 +385,9 @@ void setup()
|
|||
}
|
||||
writedisplaytext(" "+Tcall,"","Init:","Data from GPS OK!","","",250);
|
||||
Serial.println("LoRa-APRS / Init / Data from GPS OK!");
|
||||
} else {
|
||||
writedisplaytext(" "+Tcall,"","Init:","GPS switched OFF!","","",250);
|
||||
Serial.println("LoRa-APRS / Init / GPS switched OFF!");
|
||||
}
|
||||
|
||||
#ifdef T_BEAM_V1_0
|
||||
|
@ -387,10 +406,19 @@ void setup()
|
|||
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096); // hard coded because of double definition
|
||||
rf95.setTxPower(5);
|
||||
|
||||
dht.setup(DHTPIN,dht.AUTO_DETECT); // initialize DHT22
|
||||
#ifdef DS18B20
|
||||
sensors.begin();
|
||||
#else
|
||||
dht.setup(DHTPIN,dht.AUTO_DETECT); // initialize DHT22
|
||||
#endif
|
||||
delay(250);
|
||||
temp = dht.getTemperature();
|
||||
hum = dht.getHumidity();
|
||||
#ifdef DS18B20
|
||||
sensors.requestTemperatures(); // Send the command to get temperature readings
|
||||
temp = sensors.getTempCByIndex(0); // get temp from 1st (!) sensor only
|
||||
#else
|
||||
temp = dht.getTemperature();
|
||||
hum = dht.getHumidity();
|
||||
#endif
|
||||
writedisplaytext("LoRa-APRS","","Init:","DHT OK!","TEMP: "+String(temp,1),"HUM: "+String(hum,1),250);
|
||||
Serial.print("LoRa-APRS / Init / DHT OK! Temp=");
|
||||
Serial.print(String(temp));
|
||||
|
@ -426,6 +454,9 @@ void loop() {
|
|||
tracker_mode = WX_FIXED;
|
||||
writedisplaytext("LoRa-APRS","","New Mode","WX-FIXED","","",500);
|
||||
Serial.println("LoRa-APRS / New Mode / WX-FIXED");
|
||||
#ifdef T_BEAM_V1_0
|
||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_OFF); // switch OFF GPS at mode WX_FIXED
|
||||
#endif
|
||||
blinker(4);
|
||||
break;
|
||||
case WX_FIXED:
|
||||
|
@ -433,6 +464,9 @@ void loop() {
|
|||
tracker_mode = TRACKER;
|
||||
writedisplaytext("LoRa-APRS","","New Mode","TRACKER","","",500);
|
||||
Serial.println("LoRa-APRS / New Mode / TRACKER");
|
||||
#ifdef T_BEAM_V1_0
|
||||
axp.setPowerOutPut(AXP192_LDO3, AXP202_ON); // switch on GPS in all modes except WX_FIXED
|
||||
#endif
|
||||
blinker(1);
|
||||
break;
|
||||
}
|
||||
|
@ -440,6 +474,7 @@ void loop() {
|
|||
prefs.putChar("tracker_mode", (char)tracker_mode);
|
||||
prefs.end();
|
||||
button_ctr=0;
|
||||
// ESP.restart();
|
||||
}
|
||||
} else {
|
||||
button_ctr = 0;
|
||||
|
@ -447,14 +482,25 @@ void loop() {
|
|||
|
||||
if (hum_temp) {
|
||||
hum_temp=false;
|
||||
temp = dht.getTemperature();
|
||||
#ifdef DS18B20
|
||||
sensors.requestTemperatures(); // Send the command to get temperature readings
|
||||
temp = sensors.getTempCByIndex(0); // get temp from 1st (!) sensor only
|
||||
#else
|
||||
temp = dht.getTemperature();
|
||||
#endif
|
||||
} else {
|
||||
hum_temp=true;
|
||||
hum = dht.getHumidity();
|
||||
#ifdef DS18B20
|
||||
hum = 0;
|
||||
#else
|
||||
hum = dht.getHumidity();
|
||||
#endif
|
||||
}
|
||||
|
||||
while (ss.available() > 0) {
|
||||
gps.encode(ss.read());
|
||||
if (tracker_mode != WX_FIXED) {
|
||||
while (ss.available() > 0) {
|
||||
gps.encode(ss.read());
|
||||
}
|
||||
}
|
||||
|
||||
if (rf95.waitAvailableTimeout(100)) {
|
||||
|
@ -475,6 +521,30 @@ void loop() {
|
|||
if (nextTX < min_time_to_nextTX) {nextTX=min_time_to_nextTX;}
|
||||
if (nextTX > max_time_to_nextTX) {nextTX=max_time_to_nextTX;}
|
||||
|
||||
average_course[point_avg_course] = gps.course.deg(); // calculate smart beaconing course
|
||||
++point_avg_course;
|
||||
if (point_avg_course>2) {
|
||||
point_avg_course=0;
|
||||
// new_course = (average_course[0]+average_course[1]+average_course[2])/3;
|
||||
new_course = atan ((sin(average_course[0])+sin(average_course[1])+sin(average_course[2]))/(cos(average_course[0])+cos(average_course[1])+cos(average_course[2])));
|
||||
if ((old_course < 30) && (new_course > 330)) {
|
||||
if (abs(new_course-old_course-360)>=30) {
|
||||
nextTX = 0;
|
||||
}
|
||||
} else {
|
||||
if ((old_course > 330) && (new_course < 30)) {
|
||||
if (abs(new_course-old_course+360)>=30) {
|
||||
nextTX = 0;
|
||||
}
|
||||
} else {
|
||||
if (abs(new_course-old_course)>=30) {
|
||||
nextTX = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
old_course = new_course;
|
||||
}
|
||||
|
||||
} else {
|
||||
LatShown = LatFixed;
|
||||
LongShown = LongFixed;
|
||||
|
@ -487,18 +557,6 @@ void loop() {
|
|||
nextTX = 0;
|
||||
}
|
||||
|
||||
average_course[point_avg_course] = gps.course.deg(); // calculate smart beaconing course
|
||||
++point_avg_course;
|
||||
if (point_avg_course>2) {
|
||||
point_avg_course=0;
|
||||
new_course = (average_course[0]+average_course[1]+average_course[2])/3;
|
||||
if (abs(new_course-old_course)>=30) {
|
||||
nextTX = 0;
|
||||
}
|
||||
old_course = new_course;
|
||||
}
|
||||
|
||||
|
||||
if ((millis()<max_time_to_nextTX)&&(lastTX == 0)) {
|
||||
nextTX = 0;
|
||||
}
|
||||
|
@ -615,11 +673,11 @@ static void smartDelay(unsigned long ms)
|
|||
void recalcGPS(){
|
||||
|
||||
String Ns, Ew, helper;
|
||||
float Tlat, Tlon;
|
||||
float Tlat=48.2012, Tlon=15.6361;
|
||||
int i, Talt, lenalt;
|
||||
float Lat;
|
||||
float Lon;
|
||||
float Tspeed, Tcourse;
|
||||
float Lat=0.0;
|
||||
float Lon=0.0;
|
||||
float Tspeed=0, Tcourse=0;
|
||||
String Speedx, Coursex, Altx;
|
||||
|
||||
if (tracker_mode != WX_FIXED) {
|
||||
|
@ -650,8 +708,14 @@ outString = "";
|
|||
|
||||
switch(tracker_mode) {
|
||||
case WX_FIXED:
|
||||
hum = dht.getHumidity();
|
||||
tempf = dht.getTemperature()*9/5+32;
|
||||
#ifdef DS18B20
|
||||
sensors.requestTemperatures(); // Send the command to get temperature readings
|
||||
tempf = sensors.getTempFByIndex(0); // get temp from 1st (!) sensor only
|
||||
hum = 0;
|
||||
#else
|
||||
hum = dht.getHumidity();
|
||||
tempf = dht.getTemperature()*9/5+32;
|
||||
#endif
|
||||
for (i=0; i<wxTcall.length();++i){ // remove unneeded "spaces" from callsign field
|
||||
if (wxTcall.charAt(i) != ' ') {
|
||||
outString += wxTcall.charAt(i);
|
||||
|
@ -684,8 +748,14 @@ switch(tracker_mode) {
|
|||
break;
|
||||
case WX_TRACKER:
|
||||
if (wx) {
|
||||
hum = dht.getHumidity();
|
||||
tempf = dht.getTemperature()*9/5+32;
|
||||
#ifdef DS18B20
|
||||
sensors.requestTemperatures(); // Send the command to get temperature readings
|
||||
tempf = sensors.getTempFByIndex(0); // get temp from 1st (!) sensor only
|
||||
hum = 0;
|
||||
#else
|
||||
hum = dht.getHumidity();
|
||||
tempf = dht.getTemperature()*9/5+32;
|
||||
#endif
|
||||
for (i=0; i<wxTcall.length();++i){ // remove unneeded "spaces" from callsign field
|
||||
if (wxTcall.charAt(i) != ' ') {
|
||||
outString += wxTcall.charAt(i);
|
||||
|
@ -747,8 +817,14 @@ switch(tracker_mode) {
|
|||
}
|
||||
break;
|
||||
case WX_MOVE:
|
||||
hum = dht.getHumidity();
|
||||
tempf = dht.getTemperature()*9/5+32;
|
||||
#ifdef DS18B20
|
||||
sensors.requestTemperatures(); // Send the command to get temperature readings
|
||||
tempf = sensors.getTempFByIndex(0); // get temp from 1st (!) sensor only
|
||||
hum = 0;
|
||||
#else
|
||||
hum = dht.getHumidity();
|
||||
tempf = dht.getTemperature()*9/5+32;
|
||||
#endif
|
||||
for (i=0; i<wxTcall.length();++i){ // remove unneeded "spaces" from callsign field
|
||||
if (wxTcall.charAt(i) != ' ') {
|
||||
outString += wxTcall.charAt(i);
|
||||
|
@ -936,7 +1012,7 @@ void setup_data(void) {
|
|||
int8_t pos_in_string;
|
||||
int8_t pos_ssid;
|
||||
bool key_pressed = false;
|
||||
int waiter, symbol_only;
|
||||
int waiter;
|
||||
int initial_waiter = 2000;
|
||||
char aktueller_letter;
|
||||
int8_t pos_letter;
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
// #define T_BEAM_V1_0 // use this for newer Boards AKA Rev1 (second board release)
|
||||
#define T_BEAM_V0_7 // use this for older Boards AKA Rev0.x (first board release)
|
||||
|
||||
// SET temperature sensor type
|
||||
// #define DS18B20 // use this if you use DS18B20, default ist DHT22
|
||||
|
||||
// USER DATA - USE THESE LINES TO MODIFY YOUR PREFERENCES
|
||||
// IF NOT CHANGED you have to go through the configuration routine at first boot up of the TTGO T-Beam
|
||||
|
||||
// #define DONT_USE_FLASH_MEMORY // uncomment if you don't want to use Flashmemory - instead data below must be corrected
|
||||
|
||||
#define CALLSIGN "OE1XYZ-0" // enter your callsign here - less then 6 letter callsigns please add "spaces" so total length is 6 (without SSID)
|
||||
#define WX_CALLSIGN "OE1XYZ-0" // use same callsign but you can use different SSID
|
||||
#define LONGITUDE_PRESET "01539.85E" // please in APRS notation DDDMM.mmE or DDDMM.mmW
|
||||
|
|
Ładowanie…
Reference in New Issue