Friday, January 6, 2012

DIY FrSky GPS Telemetry Sensor with Logging

Following last year's rediscovery of radio controlled flight, I've recently become enamored with the hacking/mod potential of the downright bargain priced 9-channel FlySky FS-TH9X transmitter (also sold as Turnigy/Eurgle etc). The original 2.4GHz RF module and firmware are quite useable, already making this a fairly capable piece of kit considering the price.

However, it becomes a truly remarkable tool when equipped with an open source replacement firmware and the FrSky telemetry capable RF module replacement. For a very moderate investment and with the willingness to do a few intermediate level hardware modifications, you end up with a package providing features that even many top-of-the line, brand name transmitters are lacking.

An RC tinkerer's dream!

While going through the huge thread over at RCGroups and some related content, I stumbled upon a post by (Jo)Hannes a.k.a. der-frickler detailing a custom GPS module he built for the FrSky Telemetry Sensor Hub - in order to receive real-time GPS data in his transmitter display and overcoming a temporary backorder situation with the original/OEM FrSky GPS sensor.

I figured it would be nice to build upon that quite inspired hack and not only to be able to view the corresponding GPS data (such as height and speed) in the transmitter display - averting your eyes from your model while you are flying can be rather tricky if not downright disastrous during high speed low altitude sweeps - but also to have a log of all collected GPS data for later analysis and visualization.

A bit of research led me to the solution of using the same inexpensive Mediatek MT3326 GPS receiver used by Hannes, paired with a SparkFun OpenLog data logger capable of capturing the 9600 baud NMEA output sequence of the GPS chip and writing it onto a micro-SD card. Following the reference sheet for the MediaTek chip resulted in a fairly straight forward circuit design and a corresponding SMD based reference layout:

I apologize for the messiness, PCB layout and hardware design is not one of my fortes. The main components are the already mentioned MediaTek chip and OpenLog breakout board, complemented by an LM3940 3.3V regulator for the GPS chip, a GPS fix LED indicator, and a battery backup for the GPS almanac based on a simple CR2032 Li battery. My initial intention was to use an AMS1117 regulator with it's less stringent capacitor requirements but the 3940 was all I had at hand...

The result can be seen below, the CR2032 battery is hot glued to the bottom of the circuit board (not visible). The OpenLog board does not need any additional configuration. The standard firmware settings of the board match the serial GPS output, and log to a separate TXT file each time the circuit is powered up:

The result is a (relatively) straight forward plug-and-play GPS module for the FrSky telemetry system, with corresponding real-time SD card logging of NMEA data:

Further possibilities include using the OpenLog board to directly log the data stream from the telemetry sensor hub - this could be done within the transmitter at the return channel, removing the necessity for a separate logger in each model and allowing to capture not only the GPS data but also the data from the other sensors. Thanks to the open protocol used by FrSky, this would seem a relatively benign challenge.

P.S. The above logger also works quite well stand-alone - all you need is to provide 5-10V battery power via GND/VCC (approx 40mAh total power consumption)


Stephan said...

your GPS-Logger with FrSky-Hub output is very nice. What is the baud rate which is transmitted to the SensorHub and which NEMA sentences are used (GGA,GNS,GSA,..)?
What update Rate is used? 1Hz, 5 or 10Hz?
Best regards

Zara said...

Hi Stephan,

The standard settings of the GPS chip are 9600 baud and 1Hz update rate. This could be increased to 10Hz with a corresponding increase in baud rate. The OpenLog baud rate can be adopted as well. However, you would lose FrSky compatibility as the sensor hub expects 9600 baud / 1Hz. OpenLog receives and logs all the NMEA sentences generated by the GPS (check the data sheet), so it is a matter of configuring the GPS chip if you want to only receive specific sentences

Andre said...

I'm trying to use one of my many GPS modules with the FrSky sensor hub, but don't seem to get it to work. I've tried 4800, 9600, 19200, 38400, 57600 and 115200bps, 1Hz and 2Hz, I never get anything on the telemetry display.
So I second Stephan's question, what exactly did you set your GPS to (baudrate, update rate, NMEA sentences) to get the FrSky sensor hub to accept it?

Zara said...

Hi Andre,

The GPS chip I am using is running at standard factory settings: 9600 baud 8N1 (8 data bits, no parity bit, 1 stop bit). Update rate is factory default 1Hz. The standard NMEA sentences provided by the chip are GGA, GSA, GSV, RMC, and VTG

I don't expect the sensor hub makes use of all of the NMEA sentences, I figure just RMC sentences would be sufficient but have not tested what the minimum requirements are. Update rates above 1Hz could cause trouble at 9600 baud. Also, if the GPS sensor is coming up from a cold start, it may need a minute or two to download the almanac and start outputting the first position fixes. Are you able to intercept the GPs output to verify it is working as intended? Hope this helps!

Andre said...

Thanks for the answer! I'll insist a little more. Yep the GPS was cold started and didn't have a fix, BUT it had enough signal to send correct time&date info, which usually shows up on the receiver directly. My radio was however still showing 0:00 00/00/0000. Maybe the radio (or the sensor hub) simply ignores anything it receives until the fix is valid. But as it could have been so many other things I just wanted to try and make sure my settings were OK before spending hours trying to find out, so thanks for the confirmation :)

Andre said...

OK it's all good, see here for pics!

greymfm76 said...

Your hardware design is nice - but what type of firmware do you use in your TH9X? Is it a special mod of those gruvin9x/th9x/er9x firmwares? I haven't seen that GPS page in any of those firmwares...
Good work! :-)

Zara said...

Hi greymfm76, thanks for your comment. The photo was made with an unmodified version of the gruvin9x firmware. I don't remember the exact revision number, but it was from January 2012.