standing update1

This commit is contained in:
richonguzman 2023-02-12 12:01:53 -03:00
parent 51dadb64e3
commit dfd6e638d3
3 changed files with 47 additions and 23 deletions

View File

@ -1,9 +1,9 @@
# LORA (1 Watt Module) APRS Tracker
This LORA APRS Tracker will work with very cheep hardware (amazon, ebay or aliexpress):
- ESP32 ( ESP32 Dev Module)
- Ebyte E22 400M30S (1 Watt (30dB) Lora SPI Module)
- GY-GPSNEO6MV2 (NEO6M GPS Module)
- ESP32 -->( ESP32 Dev Module)
- Ebyte E22 400M30S --> (1 Watt (30dB) Lora SPI Module)
- GY-GPSNEO6MV2 --> (NEO6M GPS Module)
This project uses Enconded APRS GPS packet to extends range by saving bytes (increased battery life, higher chances of good packet reception (increased range), lower probability of packet collisions (more channel capacity) and 1 Watt LoRa Module (over the usual 0.1 Watt in commercial boards like the LILYGO T-Beam V.1).
@ -11,12 +11,13 @@ ______________________________________________________________________
Achievements:
- force Tx with the "short" push of a button.
- changing CALLSINGs with the "long" push of a button.
- custom smartbeacon values for each CALLSIGN
- force Tx with the "short" push of a button.
- send enconded GPS data packet for shorter and realiable comunication.
- Select to send "Course + Speed" or "Altitude + Speed" in encoded APRS data packet.
- Use SmartBeacon with "Turn_Min + Turn_Slope" formula.
- Zero Message when standing still for a while (not sending beacons and saving battery)
To add (shortly) working on it

View File

@ -11,7 +11,7 @@ https://github.com/richonguzman/LoRa_1W_APRS_Tracker
#include "lora_config.h"
#include "beacon_config.h"
#define VERSION "V0.1.1" //2023.02.02 - BETA!!!
#define VERSION "V0.1.2" //2023.02.12 - BETA!!!
SX1268 radio = new Module(NSS, DIO1, NRST, BUSY);
HardwareSerial neo6m_gps(1);
@ -141,16 +141,20 @@ void loop() {
static double previousHeading = 0;
//static unsigned int rate_limit_message_text = 0;
static double lastTxLatitude = 0.0;
static double lastTxLongitude = 0.0;
static double lastTxDistance = 0.0;
static uint32_t txInterval = 60000L;
uint32_t txCommentInterval = 15*60*1000;
int CurrentSpeed = (int)gps.speed.kmph();
//static int speed_zero_sent = 0;
static double lastTxLatitude = 0.0;
static double lastTxLongitude = 0.0;
static double lastTxDistance = 0.0;
static uint32_t txInterval = 60000L;
static int zeroSpeedCounter = 0;
uint32_t txCommentInterval = 60*60*1000; // 60 min!!!
uint32_t txMaxInterval = 15*60*1000; // 15 min!
static bool send_standing_update = false;
int CurrentSpeed = (int)gps.speed.kmph();
//
String mensaje_test = "0"; // testing Serial.Monitor log
//
String mensaje_test = "0";
if (!send_update && gps_loc_update) {
uint32_t lastTx = millis() - lastTxTime;
int MinimumDistanceTx = CurrentUser[6].toInt();
@ -164,7 +168,9 @@ void loop() {
if (lastTx >= txInterval) {
if (lastTxDistance > MinimumDistanceTx) {
send_update = true;
mensaje_test = "D:" + String(lastTxDistance) + " I:" + String(txInterval);
//
mensaje_test = "D:" + String(lastTxDistance) + " S:" + String(CurrentSpeed) + " I:" + String(txInterval);
//
}
}
if (!send_update) {
@ -177,10 +183,19 @@ void loop() {
}
if (headingDelta > TurnMinAngle && lastTxDistance > MinimumDistanceTx) {
send_update = true;
mensaje_test = "C:" + String(headingDelta) + " D:" + String(lastTxDistance) + " I:" + String(txInterval);
//
mensaje_test = "C:" + String(headingDelta) + " D:" + String(lastTxDistance) + " S:" + String(CurrentSpeed) + " I:" + String(txInterval);
//
}
}
}
if (!send_update && lastTx >= txMaxInterval) {
send_update = true;
send_standing_update = true;
//
mensaje_test = "Standing Still";
//
}
}
if (send_update && gps_loc_update) {
@ -218,7 +233,7 @@ void loop() {
}
AprsPacketMsg += CurrentUser[1]; // Symbol
if (SendAltitude) { // Send Altitude or... (APRS calculates Speed also)
int Alt1, Alt2;
int Talt;
@ -231,26 +246,34 @@ void loop() {
Alt1=0;
Alt2=0;
}
AprsPacketMsg +=char(Alt1+33);
if (send_standing_update) {
AprsPacketMsg += " ";
} else {
AprsPacketMsg +=char(Alt1+33);
}
AprsPacketMsg +=char(Alt2+33);
AprsPacketMsg +=char(0x30+33);
} else { // ... just send Course and Speed
ax25_base91enc(helper_base91, 1, (uint32_t) Tcourse/4 );
AprsPacketMsg += helper_base91[0];
if (send_standing_update) {
AprsPacketMsg += " ";
} else {
AprsPacketMsg += helper_base91[0];
}
ax25_base91enc(helper_base91, 1, (uint32_t) (log1p(Tspeed)/0.07696));
AprsPacketMsg += helper_base91[0];
AprsPacketMsg += "\x47";
}
if (SendComment) {
uint32_t lastCommentTx = millis() - lastCommentTxTime;
if (lastCommentTx >= txCommentInterval) {
AprsPacketMsg += AprsComment;
lastCommentTxTime = millis();
} else {
}/* else {
AprsPacketMsg += mensaje_test; //esto es solo para validar giro distancia y otras cosas
}
}*/
}
Serial.print(F("GPS coordinates: ")); // Only for Serial Monitor

View File

@ -4,7 +4,7 @@
#define FirstUser 1 // Select the First User at Tracker Start Up (Example: 1 means User1)
#define AprsPath "APLT00" // APRS Destination (could be also "WIDE1-1" or even just "AP")
#define AprsOverlay "/"
#define SendAltitude true // "true" adds Altitude to the APRS packet/message, "false" add Course+Speed
#define SendAltitude true // "true" adds Altitude to the APRS packet/message, "false" add Course+Speed
#define SendComment true // "true" adds comment to the APRS packet/message
#define AprsComment "https://github.com/richonguzman/LoRa_1W_APRS_Tracker" // To send this comment --> SendComment = true (edit the comment as you like)
@ -14,7 +14,7 @@
#define User1_SlowSpeed 3 // km/h
#define User1_FastRate 60 // seg
#define User1_FastSpeed 15 // km/h
#define User1_MinDistTx 5 // debe ser 100 pero esta 5 por pruebas
#define User1_MinDistTx 100 // debe ser 100 pero esta 5 por pruebas
#define User1_MinDeltaBcn 20 // seg between beacon update
#define User1_TurnMinDeg 3 // degrees
#define User1_TurnSlope 40 // constant