My present design for a new flight computer uses an Arduino Pro Mega as a platform to telemeter GPS, power, and temperature data. The integration is successful but I am seeing some odd things.
While I was successful in transmitting GPS, battery, and temperature data using the platform described in my previous post, I noticed odd behaviors in the transmission. Sometimes the transmission would stop for a few seconds, or the GPS data would be incorrect. Recently, when I wanted to evaluate the flight computer, the GPS data simply was not sent. Being of an agile mindset, I took a retrospective look at what I had done, and thought I would start again.
I pared down the existing Arduino code to just that supporting the GPS. Once I had it working again, I instrumented the code to help understand where time was spent, and to verify some of the set up. I also placed some code in the Arduino to write information to an LCD display.
I found that the GPS was sending one extra sentence that is discarded by TinyGPS (a very cool library – check it out at http://arduiniana.org/libraries/tinygps/). I corrected that and believe the GPS delivers the optimum number of sentences at 19200 baud to the Arduino.
The Arduino accepts and parses these sentences, and prepares the data for transmission. While this is running, I am counting the number of times the loop() method executes, and write that number on the LCD display only when the GPS data has decoded (I reset the counter when the GPS data is transmitted). I see a high number and a low number which leads me to believe the same data may be transmitted twice. If that is true, the program may be overrunning the radio’s buffer. This could account for the odd errors.
To test this theory, I change the program to transmit the GPS data only when the current GPS time is different from the GPS time most recently transmitted. This was successful. I related this experience to the TinyGPS developer. He clarified the operation of a method I was using; I was sending the same data twice.
I look forward to moving this improvement into the main program and review the operations again. Stay tuned!