Skip to content

Commit

Permalink
Merge pull request #6 from Slayingripper/master
Browse files Browse the repository at this point in the history
Easier Callsign Input
  • Loading branch information
dj1an authored Aug 1, 2024
2 parents 3363b4e + 17b877d commit 5aff3aa
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 136 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
.vscode/extensions.json
17 changes: 10 additions & 7 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Please feel free to open an issue if you found Bugs.
The best success is to use PlatformIO (and it is the only platform where I can support you).

* Go to [PlatformIO](https://platformio.org/) download and install the IDE.
* If installed open the IDE, go to the left side and klick on 'extensions' then search for 'PatformIO' and install.
* If installed open the IDE, go to the left side and click on 'extensions' then search for 'PatformIO' and install.
* Windows users may have to install [GIT](https://git-scm.com/download/win)
* When installed click 'the ant head' on the left and choose import the project on the right.
* Just open the folder and you can compile and upload the Firmware.
Expand All @@ -48,4 +48,9 @@ Top Button can be used, the lower Button is hardwired to Device Reset.

* Button > 1s: Send Position Beacon
* Button < 1s: Open Menu / Next Menu Item
* Button > 1s in Menu: Change Setting
* Button > 1s in Menu: Change Setting

## Usage with BMP180
The HTCC-AB02S can also be used with the BMP180 sensor for Altitude , Humidity and Temperature. Switch to Profile #3 to send data to APRS as a weather station. The sensor can be used with either 5V or 3.3V but since the BMP180 is a 3.3V device with a voltage regulator just use the 3.3v line to conserve power on the board.

![BMP180](pics/HTCC-AB02S.jpg)
Binary file added pics/HTCC-AB02S.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 54 additions & 51 deletions src/LoRa_APRS_Tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
#include <APRS-Decoder.h>
#include <Arduino.h>
#include <BMP180.h>
#include <MPU6050.h>
//#include <BMP280.h>
#include <TimeLib.h>
#include <Wire.h>
//#include <Wire.h>

// initialize the library with the numbers of the interface pins
char PRESSURESHOW[4]; // initializing a character of size 4 for showing the result
char TEMPARATURESHOW[4]; // initializing a character of size 4 for showing the temparature result
BMP085 bmp;
char PRESSURESHOW[4]; // initializing a character of size 4 for showing the result
char TEMPARATURESHOW[4]; // initializing a character of size 4 for showing the temparature result
BMP085 bmp;
MPU6050 mpu;
// BMP280 bmp;
//#include <EEPROM.h>
Air530ZClass gps;
extern uint8_t isDispayOn; // Defined in LoRaWan_APP.cpp
Expand All @@ -23,31 +27,31 @@ void sleep_gps();
void userKey();
void telemetry();

String create_lat_aprs(RawDegrees lat);
String create_long_aprs(RawDegrees lng);
String create_lat_aprs_dao(RawDegrees lat);
String create_long_aprs_dao(RawDegrees lng);
String create_dao_aprs(RawDegrees lat, RawDegrees lng);
String createDateString(time_t t);
String createTimeString(time_t t);
String getSmartBeaconState();
String padding(unsigned int number, unsigned int width);
int TEMP, PRESS, HUMID, WIND_S, WIND_DIR, RAIN;
static bool STATIC_BEACON, WEATHER_DATA;
static bool BMPFOUND = false;
static bool BatteryIsConnected = false;
static String batteryVoltage = "";
static bool DSB_ACTIVE = SB_ACTIVE; // initial Smartbeacon State can be changed via menu
static int DBEACON_TIMEOUT = BEACON_TIMEOUT; // initial Beacon Rate
static bool DSCREEN_OFF = false; // initial Screen timeout deactivated
static int DPROFILE_NR = DEFAULT_PROFILE;
static String DBEACON_SYMBOL = BEACON_SYMBOL;
static String DBEACON_OVERLAY = BEACON_OVERLAY;
static String DBEACON_MESSAGE = BEACON_MESSAGE;
static String DCALLSIGN = CALLSIGN;
static String DBEACON_LATITUDE = BEACON_LATITUDE;
static String DBEACON_LONGITUDE = BEACON_LONGITUDE;

String create_lat_aprs(RawDegrees lat);
String create_long_aprs(RawDegrees lng);
String create_lat_aprs_dao(RawDegrees lat);
String create_long_aprs_dao(RawDegrees lng);
String create_dao_aprs(RawDegrees lat, RawDegrees lng);
String createDateString(time_t t);
String createTimeString(time_t t);
String getSmartBeaconState();
String padding(unsigned int number, unsigned int width);
int TEMP, PRESS, HUMID, WIND_S, WIND_DIR, RAIN;
static bool STATIC_BEACON, WEATHER_DATA;
static bool BMPFOUND = false;
static bool BatteryIsConnected = false;
static String batteryVoltage = "";
static bool DSB_ACTIVE = SB_ACTIVE; // initial Smartbeacon State can be changed via menu
static int DBEACON_TIMEOUT = BEACON_TIMEOUT; // initial Beacon Rate
static bool DSCREEN_OFF = false; // initial Screen timeout deactivated
static int DPROFILE_NR = DEFAULT_PROFILE;
static String DBEACON_SYMBOL = BEACON_SYMBOL;
static String DBEACON_OVERLAY = BEACON_OVERLAY;
static String DBEACON_MESSAGE = BEACON_MESSAGE;
static String DCALLSIGN = CALLSIGN;
static String DBEACON_LATITUDE = BEACON_LATITUDE;
static String DBEACON_LONGITUDE = BEACON_LONGITUDE;
String accelerometerx, accelerometery, accelerometerz;
static bool send_update = true;
static bool is_txing = false;
static RadioEvents_t RadioEvents;
Expand Down Expand Up @@ -111,7 +115,7 @@ void setup() {
show_display("DJ1AN", "CubeCell", "LoRa APRS Tracker", 500);

if (!bmp.begin()) {
Serial.println("Could not find a valid BMP085 sensor, check wiring!");
Serial.println(F("Could not find a valid BMP085 sensor, check wiring!"));
} else {
BMPFOUND = true;
}
Expand Down Expand Up @@ -241,15 +245,15 @@ void loop() {
}

if (send_update && gps_loc_update && gps_loc_valid) {
send_update = false;
send_update = true;
nextBeaconTimeStamp = now() + (DSB_ACTIVE ? SB_SLOW_RATE : DBEACON_TIMEOUT);

APRSMessage msg;
String lat;
String lng;
String dao;
String aprsmsg;

msg.setSource(DCALLSIGN);
msg.setDestination("APZASR-1");

Expand Down Expand Up @@ -295,53 +299,51 @@ void loop() {
} else {
speed_zero_sent = 0;
}

if (BMPFOUND && WEATHER_DATA) {
telemetry();
String TEMPERATURE = String(TEMP);
String PRESSURE = String(PRESS);
// REMOVE LAST CHARACTER FROM PRESSURE
PRESSURE.remove(PRESSURE.length() - 1); // PRESSURE ON APRS IS ONLY 5 DIGITS

// Uncomment to enable APRS telemetry for sensors with more data.

/// String HUMIDITY = String(HUMID);
// String HUMIDITY = String(HUMID);
/// String WIND_SPEED = String(WIND_S);
/// String WIND_DIRECTION = String(WIND_DIR);
/// String RAINX = String(RAIN);

// Using ... notifies APRS that the fields are NULL thus not showing up
// in the telemetry.
String HUMIDITY = "...";
String WIND_SPEED = "...";
String WIND_DIRECTION = "...";
String RAINX = "...";



Serial.print("Weather data enabled");
aprsmsg = "!" + lat + DBEACON_OVERLAY + lng + DBEACON_SYMBOL + WIND_DIRECTION + "/" + WIND_SPEED + "g" + RAINX + "t" + TEMPERATURE + "h" + HUMIDITY + "b" + PRESSURE;

aprsmsg += DBEACON_MESSAGE;
aprsmsg += "ACCX " + accelerometerx;
aprsmsg += "ACCY " + accelerometery;
aprsmsg += "ACCZ " + accelerometerz;

// t = temprature
// h = humidity
// b = pressure
}

// alt = gps.altitude.meters();
}

if (STATIC_BEACON && !WEATHER_DATA) {
aprsmsg = "!" + DBEACON_LATITUDE + DBEACON_OVERLAY + DBEACON_LONGITUDE + DBEACON_SYMBOL + DBEACON_MESSAGE;
}
if (!STATIC_BEACON && !WEATHER_DATA){

if (!STATIC_BEACON && !WEATHER_DATA) {
aprsmsg = "!" + lat + DBEACON_OVERLAY + lng + DBEACON_SYMBOL + course_and_speed + alt;
// message_text every 10's packet (i.e. if we have beacon rate 1min at high
// speed -> every 10min). May be enforced above (at expirey of smart beacon
// rate (i.e. every 30min), or every third packet on static rate (i.e.
// static rate 10 -> every third packet)
if (!(rate_limit_message_text++ % 10)) {
aprsmsg += DBEACON_MESSAGE;
// convert char to string

if (BatteryIsConnected) {
aprsmsg += " - U: " + batteryVoltage + "V";
}
Expand Down Expand Up @@ -981,8 +983,6 @@ void activateProfile(int profileNr) {
}

void telemetry() {


Serial.print("Temperature = ");
Serial.print(bmp.readTemperature());
Serial.println(" *C");
Expand All @@ -993,7 +993,10 @@ void telemetry() {
Serial.print("Pressure = ");
Serial.print(bmp.readPressure());
Serial.println(" Pa");
PRESS = bmp.readPressure();
// HUMID = bmp.readHumidity();
delay(500);
}
PRESS = bmp.readPressure();
accelerometerx = mpu.getAccelerationX();
accelerometery = mpu.getAccelerationY();
accelerometerz = mpu.getAccelerationZ();

// delay(500);
}
Loading

0 comments on commit 5aff3aa

Please sign in to comment.