Hello,
I'm hoping you smart people can help me out here =]
A Little Bit of Background Information & What I'm Trying to Do
I am working on a project in which I would like to include the ability to send periodic system health / status updates back to base over RF.
My project already has radio transmit capability and audio output so ideally I'd like to make use of the existing hardware setup.
The transmission and audio set up I am using at the minute is very simple.
An arduino nano trips a relay which powers up the radio. Then the nano trips an Opto Isolator to put the radio into PTT and the audio is generated from pin 9 on the Nano.
Very Simple Requirements (From My Point of View at Least)
In my project I am hoping to include some self-monitoring (batt voltage, temp etc) and would like to have it take periodic readings throughout the day, store them and then transmit all the daily data back at a set time at the end of the day.
What I've Tried, What I've Done, What Happened etc...
I have gotten everything else I require for my project working. I use a real time clock to keep track of the real time and date. I have an SD card reader for reading from and writing to and I have all my TX hardware and code sorted. Everything from that point of view is working - and has had months of testing.
Where I am now struggling is finding the easiest and lightest way to transmit bursts or packets of data collected during the day.
I've been trying to adapt / modify / incorporate "out of the box" solutions such as MicroModem / Micro ARPS and many more of the popular TNC modem type software without much luck. Many of these programs were designed to run "stand alone" and are far too heavy and complicated for my needs so I've had no luck in separating out just the TX side.
The closest I've gotten to date has been using this very simple and lightweight library I found on GitHub called Arduino RTTY Transmitter. GitHub - farroid/arduino-rtty-transmitter: Simple RTTY transmitter for HAB and other applications
It does exactly what it says on the tin but not exactly what I want and I'm not quite sure how to modify it to do what I need....
The Arduino RTTY Transmitter Library will allow me to pass text (string?) messages to the TX function for it to "encode" into RTTY tones but it will not accept variable data directly e.g.
RTTY.tx("Hello, this is a test message"); Will Work
RTTY.tx(variableValue); Will Not Work.
Obviously the TX function wasn't designed to receive and handle data in this way and I'm not entirely sure what to do to alter it.
In Closing
My programming knowledge is very very rusty these days - I'm practically back at noob level.
I've not done any real in depth programming for a good 5 years or more besides tinkering with simple things in the Arduino IDE here and there. To look at my work now, you wouldn't believe I went to college and passed C and C++ programming with flying colours.
For my final project I wrote a stock trading game in C which earned me a distinction. Amazing how the knowledge slips away when not used frequently.
Anyway....
As far as my latest project goes, I'm now stuck trying to alter that RTTY Tx function or possibly write a second function for transmitting variable data.
To be honest, I'd rather use a more up to date and faster data TX mode - something that only takes around 10 - 15 seconds or less to transmit the data but this RTTY library was all I could get to work.
I'm certainly not back at the skill level necessary to write my own code from scratch in any reasonable length of time. These days progress is slow and I struggle to get my programs to work without constantly going back to the reference books.
So this is the function I need to modify so I can pass the data stored in several variables to it and encode them into RTTY.. e.g battery voltage, battery current, temperature etc.
void RTTY5::tx(char* string)
{
char c = *string++;
byte index = 0, pos = 0;
byte shift = 0;
while (c != '\0')
{
char* index = strchr(BAUDOT_FIGS, c);
if(index != NULL) {
pos = index - BAUDOT_FIGS;
if(pos > 2 && shift != 1) {
shift = 1;
rtty_txbyte(BAUDOT_SHIFT_FIGS);
}
rtty_txbyte (baudot[pos]);
} else {
c = toupper(c);
index = strchr(BAUDOT_LTRS, c);
pos = index - BAUDOT_LTRS;
if(pos > 2 && shift != 2) {
shift = 2;
rtty_txbyte(31);
}
rtty_txbyte (baudot[pos]);
}
c = *string++;
}
}
I've spent a fair few hours starring at that function running through it over and over like a loop in my head, breaking it down, following it through step by step.
It looks to me like it gets passed my message text from my main program loop RTTY.tx("message") and then char c = *string++; I think is basically incrementally (++) scrolling through that string, char by char and assigns each char in the string to the variable C while keeping an index position?
Then the program goes into a while loop while (c != '\0') which it will continue to loop through until it comes to \0 in the string which signals end of the string \ new line \ empty character?
So I can pretty much read it and follow it logically (with a few parts I don't fully understand in there) but I just can't get my head around how to adapt it.
I know anything I try at this point won't be nearly as simple and elegant so I'm reaching out at this point for some assistance.
In the meantime, I'm going to continue to work the problem or try my best to find and adapt something better - preferably more up to date and faster.
Thanks in advance and sorry for the lengthy post. I was just trying to put down as much relevant information as I could.