Using a GPS mouse to get GPS data onto your TX display

From OpenRC Guides
Jump to: navigation, search


Contents

GPS NMEA data on ER9X

expanding possibilities


To get GPS data onto your TX display, there are several options.


With FrSky telemetry set,
by default, you get some analog values like A1, A2 and RSSI for Rx and Tx. If you need more information, you can use the FrSky HUB to add a GPS module and some other sensors to the air station. At the radio, you use the ER9x-FrSky version to display the different values.
With the DIY solution of NMEA,
you, by default, have a GPS module at the air station .This gives you a handful of data, the GPS can supply (Latitude, longitude, altitude, speed over ground, time and date) and some data that can be calculated from this data (max altitude, altitude relative to home, distance and max distance). At the radio, you use the ER9x-NMEA version to display the different values.

A basic difference for these two versions is the communication protocol between air and ground station and the required hardware.

The NMEA version
transmits pure ASCII coded NMEA records and can be used with any receiver/rf module as the data transmission is independent of the radio.
the FrSky version
embeds single values into its own framing protocol and you are bound to the FrySky rf modules and receivers.

As the development steps on for the FrSky version, there is a chance to also use the ER9x FrSky firmware when you have the NMEA hardware. The point is, read the GPS data, repack and convert them so the datastream that is received at the ground station is FrSky protocol. This can relative simply be done with a little ARDUINO processor, that is inserted into the datapath between the GPS module and the transceiver module. An even easier possibility that shortly will be published is, using the FrySky Sensor Hub as a protocol converter. It is able to read pure NMEA data records from a GPS module and convert it to the native FrySky Hub protocol. The modification to the radios FrySky code to read this native protocol is already working and is waiting for release to the repository.


Using an Arduino MEGA Mini 328 to convert the protocols, it depends on the pogramming of the Arduino, if you:

1. Send NMEA records as before
, but add another record, that contains up to 8 analog inputs (0 to + 5volt), 6 digital inputs and one pulse triggered input for counting e.g. rotations per minute of a motor. To measure different voltages (>5 volt) you will have to use resistors as voltage deviders. The values of the resistors can directly be put into the program and the analog values that will be tranmitted are scaled automatically to the correct values.
2. convert all data to FrSky protocol
and additionally use up to 8 analog inputs (0 t o + 5volt), 6 digital inputs and one pulse triggered input for counting e.g. rotations per minute of a motor. All these data is transmitted but only partially shown on the FrSky version display.
3. use the FrSky Sensor Hub
and adapt it electrically to the APC200 transceiver (add an inverter). You can connect the GPS and various ready to use sensors and flash the radio with the FrSky version of ER9X (see NOTE). You will see all values that are supported from the FrSky fw except voltages A1,A2 and the RSSI levels, as they are normally created within the FrSky receiver.


NOTE: The FrySky Sensor Hub outputs data according to the FrySky Hub protocol. In the moment, this is not supported from the standard Frsky version of ER9X. To activate this support (but deactivate the original FrySky support), you must flash the radio with a Frsky version of ER9X, that has been compiled with option "N2F=YES", that means NMEA to Frysky=Yes.


Thanks to Jean-Pierre Parisy who helped me with the unloved C++


This guide shows, as an example, how to use a GPS mouse GM210 and a pair of transceivers APC200 to send GPS data from an 'air station' (plane) to a 'ground station' (radio) built into the TGY9X radio and display a handful of the GPS data on the display of the TX. It also shows, how to expand the possibilities of the pure GPS by adding a little processor board (Arduino mini Pro 328) or the ready to use FrySky Sensor Hub on the air station side.


GPS Data,
that will be shown on the display of the TX:
  • UTC-Date and Time,
  • actual altitude,
  • speed over ground and course over ground,
  • latitude and longitude,
  • number of satellites in view, shown inverted, when the GPS module has a fix.


additional values,
calculated from the GPS data:
  • actual distance,
  • maximum distance,
  • maximum altitude,
  • Lift [m/sec],
  • a Timer, that, started once, runs as long as the TX is powered on. Can be reset at any time.
Sounds
are available for
  • Lift,
  • Distance and
  • Altitude (NMEA version of ER9X)

For the lift there is a short beep when the lift is positive. Voice messages for altitude and distance are available, if the voice module mod has been applied to the radio. Voice and beeps can be activated/deactivated with UP[short] or DOWN[short] . Altitude voice will be called every 10 m difference relative to the last called altitude. Distance voice will be called every 50 m difference relative to the last called distance.


When communication between air and ground station is lost, a big questionmark is shown on every screen among the last received values.


As to my experience, with my GPS mouse,

  • UTC time and date are available nearly immediately after power on
  • The geoidal separation is available shortly after power on
  • Altitude may need much longer
  • Getting a fix works rather fast when in free space
  • Having a fix, the altitude sometimes is stuck to an old value, especially with only a low number of satellites in view
  • GPS data do vary, even when the GPS receiver does not move.
  • Altitude may vary in a very great range when the GPS mouse is not moved (even up to +- 50 m)

Flying the GPS for 20 to 40 minutes however did show small differences between starting and landing positions of only some meters.


Note:

Starting after version 772 there is the option to extend the air station with a small Mini Arduino Pro 328 board (Arduino HUB) or the FrSky Sensor Hub that

  1. ) allows to add additional data to the data stream and
  2. ) is able to convert the GPS NMEA data to the FrSky protocol. That allows to use the normal ER9X FrSky version on the radio.

To take advantage from expanded possibilities the serial port speed of GPS and both APC200 modules have been changed. GPS output from 4800 to 9600 Bd Over air speed from 2400 to 4800 Bd Ground station output speed from 4800 to 9600 Bd

The higher ground station speed makes speed compatible with the FrSky version. (The higher air speed is required to support the higher ground station speed. Transmission range will be less, but probably still long enough.) The higher GPS speed will give the Arduino Hub (if present) more time, as data will arrive faster.


Different setup options

  1. In the basic configuration (without an Arduino or FrySky Hub) you will have to flash the radio with the NMEA version of the ER9X
  2. With an Arduino Hub, you have two options:
    1. Flash the Arduino with the NMEA_RSSI version and the radio with ER9X NMEA version, compiled with the options "NMEA=YES HUB=YES"
    2. Flash the Arduino with the FrSky_RSSI version and the radio with ER9X FrSky version
  3. With a FrSky Sensor Hub flash the radio with the FrSky version of ER9X that has been compiled with option N2F=YES and attach GPS and / or ready to use sensors to the hub.

Expanding possibilities

1. The Arduino (Hub) 2. The FrSky Sensor Hub

With a Hub it is possible to add additional data and / or convert the data protocol.


Arduino.jpg


With a Mini Arduino Pro 328 you can build an extension (Hub), that can read up to eight analog input values, has six digital inputs and and one input to measure pulses for rotations per minute. As there is enough memory available on the Arduino, this program can easily be expanded.


Test setup of GPS module with APC200 and Mini Arduino Pro 328

ArduGps.jpg



RSSI signal

The Receivers have an RSSI (receive signal strength indicator) signal on Pin1 of the transceiver chip. For the three channel receiver, solder a wire from the cap at pin 1 to the unused signal pin of the battery connector. From there, connect it to analog channel input AD0 of the Arduino. RSSI strength will be shown on screen2/5 as e.g.99% in the sample below.


 Solder the wire to the small cap at pin1

Transcv.jpg


 drill a hole through the board and route the wire to the unused battery connector pin.

Wire.jpg HPIM1783.jpg



RSSI.jpg

RSSI signal shown as 99%

Using the Arduino Hub

To get the additional hub data onto the radio display, there are two options that simply depend on the programming of the Arduino:


  1. ) Use the NMEA_RSSI version of the Arduino and flash the radio with the NMEA version of ER9X

You need the NMEA version of ER9X that has been compiled with compile options NMEA=YES HUB=YES

  1. ) Use the FrSky_RSSI version of the Arduino and flash the radio with the FrSky version of ER9X


The NMEA_RSSI version
of the Arduino transfers the NMEA GPS data, collects the additional data and builds an NMEA like record. This is sent to the ground station in addition to the other NMEA records. Decoding of this record and display has been implemented into the NMEA version of ER9X

Hubdata.jpg


The FrSky_RSSI version
of the Arduino collects GPS (more latency) and additional data and converts them to a datastream with FrSky protocol.

As the radio will be flashed with the FrSky version of ER9X there will be some fields displayed, that are not filled with data and some data we provide, are not yet used. The FrSky protocol uses a lot of protocol data around the user data and the amount of data to be transmitted is much higher. This may lead to some lost data due to overrun on the serial interface.

But the advantage is, the people behind the programming of the radio are much more able to implement enhancements for this type of protocol.

Frskhub1.jpgFrskhub2.jpg

Using the FrSky HUB

The Hub allows to add various ready built sensors like Fuel gauge, GPS, Vario, Voltage sensor, Temp sensor, Acceleration sensor and RPM sensor and is normally plugged into the FrSky receiver. Data is output according to the Frame Protocol of FrSky Telemetry HUB System (V2.0) and contains the full frames 1 to 3.

In our application, the Hub will work as protocol converter and feed the APC200. To successfully feed the UART input of the APC200, the output signal of the Hub must be inverted.This can be done with one transistor and two resistors.


The GPS input expects data at 9600 Bd with NMEA protocol. The 'Data' port of the hub sends data with 9600 Bd, 5 times per second plus one data package once every second to the receiver.

Flash the radio with a Frsky version of ER9X that has been compiled with compile option "N2F=YES" (N2F = NEMEA to FrySky).This adds the required support for the native FrSky Sensor Hub protocol.

FRSkyhub.jpg

Invert2.jpg Inverter with transistor and two SMD resistors


3. Using one more transceiver and a PDA

( e.g. PalmM500 or compatible running Palm OS 3.3 or higher) that has an SD card slot, I have built an independant Logger, that can log the full GPS data records onto the SD card, watch alarm limits and show much more calculated Data on its display than the radio. This logger can independantly run in parallel to the radio.


Display.jpg Altcurve.jpg

Setups

Basic Setup

In my implementation, the basic 'air station' consists of a GPS mouse GM-210 and a transceiver module APC200. The 'ground station' is another APC200 transceiver module and the transmitter TGY9X.

AIR STATION GROUND STATION

    GM-210 + (Arduino Mini Pro +) APC200		     APC200 + TGY9X

---> 9600Bd --> --> 9600Bd --> --> 4800Bd --> --> 9600Bd -->

ARDUHUB.jpg

Replacing the Arduino with the FrSky Sensor Hub and an attached signal inverter allows to use the Frsky version of ER9X that has been compiled with the option "N2F=YES" .

Frsenshb.jpg

Use a NPN transistor like BC547A or similar.



The Arduino used as a Hub

Ardun.jpg

No Hub at all

If you do not use a Hub, simply ignore the blue circled Mini Arduino Pro and connect the wires straight through.

The Arduino HUB

In addition to the GPS data, (and protocol conversion) the Arduino supports:

6 analog channels A0 - A5 available on solder pads and 2 more analog Channels A6, A7 that are accessible only via direct soldering to the processor pins 19 and 22.

6 Digital inputs (pins 8 - 13) that are transferred to the TX as one byte. Pay attention to the fact, that input 13 is already used as output for the LED that is presoldered on the board..

Digital input D2 (pin 2) that is realized as counter (RPM). It is counting with the negative slope of the input signal.

A0 and A1 get scaled by the program for a maximum voltage of 5.00 volt A2 and A3 get scaled by the program for a maximum voltage of 6.0 volt A4 and A5 get scaled by the program for a maximum voltage of 12.0 volt. A6 and A7 get scaled by the program for a maximum voltage of 24.0 volt. The voltage dividers (shown in the source code) must be wired into the inputs to fulfill this conditions. Define the resistor values of the voltage dividers in the Arduino source code so they do correspond with the values used.

The FrSky Sensor Hub

Replace the blue circled Arduino with the FrSky Sensor Hub. Input from the GPS to the sensor hub is to Pin 2 of the 'GPS' port (see picture above). Output to the APC200 is from Pin 3 of the 'Data' port via the signal converter.

Navigaton within the screens

  • You enter the NMEA screen (1/4) with DOWN[long] from the normal system screens.
  • You step through the screens with LEFT[short] or RIGHT[short].
  • You leave any NMEA screen with UP[long] to statistics screen or with DOWN[long] to previous system screen.
  • Every screen shows the number of satellites, that are currently “in view” by the GPS.

As the first valid information that the GPS module receives is time and date, this screen (1/4) is entered first. All other screens data are displayed only, if the GPS mouse marks the corresponding NMEA records as 'valid' (Valid records may have empty or zero fields when not 'fixed').

Stepping right (screen 2/4), my most important information is displayed. Screen 2/4 shows

  • actual Altitude
  • home Altitude
  • maximum Altitude (positive)
  • Lift
  • status of the lift beep and voice (active/inactive)
  • actual Distance
  • maximum Distance

Beep and voice are activated by default. Lift is calculated as the difference of the altitude between two consecutive data records. Whenever lift is positiv, that is, greater or equal zero, you can hear a short beep, once a second, to inform you that the model is not sinking.

You can deactivate or activate the beep (the upper of the two selections) with UP[short] .

Distance and relative altitude are calculated relative to your home position. At startup, home altitude is zero. Whenever home altitude equals Zero', all altitudes are altitude above sea level.

Distance is calculated as distance of line of sight, that is, altitude over home position is taken into account.

If the voice module is attached to the TX, altitude and distance values can automatically be announced in clear speech. The actual values are output whenever the altitude changes by 10m or the distance changes by 50m relative to the last announced value. To avoid an overloaded message queue, there is a built in delay, so that the queued messages can be output before the next check is done.

You can deactivate or activate the voice (the lower of the two selections) with DOWN[short] .

MENU[long] sets Home Position. Actual altitude, longitude and latitude are saved and used for relative altitude and the distance calculations.

Distance and Max-Distance are shown only, when a home position has been set.

You can, at any time, set home altitude and position from the current altitude and position.

MENU[short] toggles the altitudes between absolute and relative to home altitude.

EXIT[short] resets Max-Distance and Max-Altitude to zero.

EXIT [long] clears the saved home position values and hides the distance display; altitudes are relative to sea level.

Next screen (3/4) shows speed and course over ground, maybe useful for some gliders .

Last screen (4/4) is latitude and longitude, not really needed during flight,but supplied from GPS.

The screens are shown in detail on the following pages.

UTC-Time and Date

  • RIGHT[short]--> NMEA 2/4
  • LEFT[short] --> NMEA 4/4
  • MENU[short] --> switch from UTC-Date to Timer and vice versa
  • UP[long] --> return to statistics screen
  • DOWN[long] --> return to previous system screen


Date & time.jpg


MENU[short] will switch to

UTC-Time and Timer

  • RIGHT[short] --> NMEA 2/4
  • LEFT[short] --> NMEA 4/4
  • UP[long] --> return to statistics screen
  • DOWN[long] --> return to previous system screen
  • MENU[short] --> switch from Timer to UTC-Date
  • EXIT[short] --> reset timer to 00:00


Date & timer.jpg



Absolute / relative altitude above sea level, distance and up / down lift

All altitudes are always displayed relative to Home altitude. Whenever Home equals zero, all altitudes are relative to height above sea level. Lift has a beeper for positive lift, that can be enabled / disabled When a Home position has been set, actual and max distance will be displayed

  • RIGHT[short] --> NMEA 3/4
  • LEFT[short] --> NMEA 1/4
  • UP[long] --> return to statistics screen
  • DOWN[long] --> return to previous system screen
  • UP[short] --> Toggle Up-Lift beeper on/off
  • DOWN[short] --> Toggle Voice on/off
  • MENU[long] --> Set home position (Lat, Lon) for distance and actual altitude as home altitude
  • MENU[short] --> alternate between absolute (sea level) and relative to home altitude
  • EXIT[short] --> reset maximum altitude and maximum distance
  • EXIT[long] --> reset home position to zero, hiding distance display

Alt no home.jpg



Altitude relative to home altitude (Home<>0.0)

Beep off.JPG



Speed over Ground and Course over Ground

  • RIGHT[short] --> NMEA 4/4
  • LEFT[short] --> NMEA 2/4
  • UP[long] --> return to statistics screen
  • DOWN[long] --> return to previous system screen


Speed & course.jpg



Latitude and Longitude

  • RIGHT[short] --> NMEA 1/4
  • LEFT[short] --> NMEA 3/4
  • UP[long] --> return to statistics screen
  • DOWN[long] --> return to previous system screen


Lat & lon.jpg



Additional data with Arduino Hub

Shows the data that come from the Arduino: six analog voltages, six digital inputs one digital input with rotations per minute.

  • RIGHT[short] --> NMEA 1/4
  • LEFT[short] --> NMEA 4/4
  • UP[long] --> return to statistics screen
  • DOWN[long] --> return to previous system screen

Hubdata.jpg

Modifications of the TX

To use the NMEA build of ER9x to display GPS data, you will have to connect the GPS Mouse with the transmitter module, attach the receiver module to the radio, configure GPS Mouse and transceiver modules and flash the radio with the NMEA version of ER9X. (It's supposed that you know how to flash your TX)

The modifications in the radio require soldering of small tracks on the main circuit board. Be warned that it is possible to damage the board permanently if care is not taken.


What to do

If you use no Hub,
you have to :
  • build your 'air station'
  • build the 'ground station'
  • modify the TX hardware (rewiring)
  • connect the 'ground station' to the TX
  • flash the TX with the NMEA version of ER9X
If you use the Mini Arduino Pro
as a Hub, you additionally have to:
  • download and install the Arduino IDE (www.arduino.cc)
  • add the Arduino into the 'air station'
  • flash the Arduino with the FrSky_RSSI.ino and the radio with the Frsky version of ER9X

or

  • flash the Arduino with the NMEA_RSSI.ino and the radio with the NMEA version of ER9X
If you use the FrSkySensor
Hub you have to:
  • build the signal inverter
  • add the sensor hub and the inverter into the 'air station'
  • flash the radio with the FrSky version of ER9X, compiled with option "N2F=YES"

As the modifications of the TX reroute the wiring of two switches (Throttle-Cut and Aileron-D/R), you can no longer use the basic versions of ER9X. You always have to use one of the telemetry versions ARDU, JETI , FRSKY or NMEA.

Hardware and software requirements

You will need a GPS module and two transceiver modules (or one transmitter and one receiver module). You will need a RS232 to TTL converter

You must have the programm to configure your GPS mouse (e.g. SIRFDemo336XP.exe, depends on your GPS mouse) and you must have the program to configure the APC modules (RF-Magic-42.exe from sureelectronics.net).

To program GPS mouse and APC200 modules, they must be attached to a real COM port of a PC. You probably have to solder some temporary cables, that allow you to connect them to the COM port of your computer

If you build the Arduino Hub, in addition You will need an Mini Arduino Pro 328 You will need an USB to Serial TTL converter and you will need to download and install the free Arduino IDE (www.arduino.cc)

If you use the FrSky Sensor Hub, in addition You will need the HUB You will need an NPN Tansistor (BC328 or similar), two resistors (4.7k and 1k) and a little bread board You can use various sensors.



For the basic version, I have used the following devices:

Apc200.jpg

APC200


Gm-210.jpg

Holux GM-210


A GPS mouse Holux GM210 (http://www.ebay.de/itm/180653870348) combined with an APC200 (http://www.sureelectronics.net/goods.php?id=1053) transceiver module (431MHz - 478 MHz) as transmitter (to be attached to the plane) and another APC200 transceiver as ground receiver that feeds the GPS data signal into the ATMega64 of the TX. GM210 as well as APC200 work with 5 volt supply voltage and have UART input and output with TTL and RS232 level. This way, they can be connected easily with each other and/or to any COM port. But despite of this, to configure the APC200 module, you need a RS232-to-TTL level converter, as this module must be configured via its TTL interface. GPS receivers normally (or can be set up to) output their data as records in NMEA format. This is pure ASCII data and is commonly used.


There are many different NMEA record types available that contain different data. But not all record types are supported by every module.

Normally you can configure the module, which record types and at what repetition rate these records are to be output from the GPS receiver.


I have configured the GM210 to output $GPGGA and $GPRMC records once a second at 9600 Bd.


The APC200 modules that transmit at a selectable RF of 431 - 478 MHz and a maximum output of 10dbm are mid range modules (to my opinion). With an RF rate of 2400 Baud I verified a ground range of over 800 m with nearly (but not really) free line of sight (RF rate has been increased to 4800 Baud that probably will reduce the range but probably still long enough).

The maximum range of the APC200 modules increases with lower over the air transmission speed. Therefore in the beginning, I configured them for the lowest acceptable speed.

Over the air transmission speed and UART serial input / output speed can be configured independently.


I have set up the RF transmission speed to 4800 Bd, the serial UART speed at the GPS mouse to 9600 and at the radio to 9600 Bd. That means, that the GPS mouse has to send with 9600 Bd to the APC200 (or the Arduino Hub) that has to read with serial speed of 9600 Bd. The APC200 transmitter sends with rf speed of 4800 Bd over the air. The APC200 receiver in the radio receives at 4800 Bd, outputs with UART speed of 9600 Bd to the radio and the radio reads the data with 9600 Bd.

This is possible without data loss, because the APC200 has a buffer of 512 bytes and the selected NMEA records have a total of about 150 Bytes only, once per second.

The ER9x NMEA modification reads the data via UART, extracts the required fields and displays them on four (five) different screens as shown above. For performance reason, the GPS data is not checksum checked but used as received.

Steps to do:

  • Verify, that you have everything available
  • Configure the GPS mouse.
  • Configure the APC200
  • (Flash the Arduino)
  • Remove the housing of the GPS Mouse
  • Connect the GPS mouse (the Arduino) and the APC200 transceiver
  • Verify, that all the switches do work.
  • Modify the transmitter hardware (rewire switches)
  • Flash the TX
  • Verify, that all the switches do work again.
  • Connect the APC200 module with the ER9X TX
  • Final Check


Starting the modifications

Step 1:

Verify, that you have everything available

  • A PC that has a real COM port
  • the program to configure the GPS mouse (e.g. Sirfdemo336xp.exe)
  • the program to configure the APC200 transceivers (e.g. Rf-Magic42.exe)
  • (the Arduino IDE)
  • the GPS mouse (e.g. GM210)
  • (the Mini Arduino Pro 328)
  • two transceivers (e.g. APC200)
  • an RS232-to-TTL converter
  • (an USB to TTL converter)
  • The resistors for the telemetry mod (2 x 220 Ohm)
  • one or two SUBD female plugs
  • one or two servo cables


Step 2:

Configuring the GPS mouse.

You need a program like SirfDemo336XP.exe (depends on your GPS mouse) and a cable, that connects the RS232 signals from the mouse to the COM port of your computer.


Holux GM210
--------------------+
	       1    |-------------	red	+5 Volt
	            |
	       2    |------->-----	green	RS232 TX
	            |
	       3    |-------<-----	yellow	RS232 RX
	            |
	       4    |-------<-----	blue	TTL RX
                    |
	       5    |--------------	white	Ground
                    |
	       6    |------->------	black	TTL TX
--------------------+

Connecting the GPS mouse with the computer

   GM210		 		     9-pin SUBD female to COM port
------------------------------------------------------------------------------------------------
pin 2 RS232 TX  green  ---------------------   pin 2
pin 3 RS232 RX yellow  ---------------------   pin 3
pin 5 Ground    white  ------------+--------   pin 5
                                   |
                                   +-------    ground (servo cable, black)
pin 1 red +5V          ---------------------   +5volt (servo cable, red)

Setting up the GPS mouse

to output $GPGGA and $GPRMC records once a second at 9600 Bd.



Connect
your GPS Mouse to the COM Port e.g. COM1: and power it on.
Start
the program sirfdemo336xp.exe
Select
Setup - Datasource
Set
parameters as shown below (baud rate to 9600)
Click
OK

Setup1.jpg


In the menu, click on 'View' - 'Messages' - 'Development' to open the 'Development Data View' window In the menu, click on 'Action' - 'Open datasource'

Setup2.jpg


If your GPS Mouse is sending data (a GPS mouse is permanently sending data by default), they will be displayed in this window. If data is readable and looks similar to the screen below, your mouse is already sending with NMEA data protocol.

Setup3.jpg

You probably will see more and different record types displayed from your GPS Mouse. If data is unreadable/makes no sense, that will be corrected with the next step. The selection, which recordsets and at which repetition rates they are sent, can only be modified when you switch from SiRF mode to NMEA mode. Therefore we at first have to switch to SiRF mode and then back to NMEA mode

To get this, do the following steps: In the menu, click on 'Action' - 'Switch to SiRF Protocol' Data displayed now is different, as in picture below.

Setup4.jpg

Click on 'Action' - 'Switch to NMEA Protocol' The fields will be set as below

Setup5.jpg

Now set the fields according to the picture below This will select GGA and RMC records at a repetition rate of one record for each recordtype per second Click 'Send' (verify, that the baudrate is set to 9600)

Setup6.jpg

You now should see nothing else but records that start with $GPGGA or $GPRMC. And they should appear once per second.

You can verify this from the first field following the record id, that is the UTC time (hhmmss with 3 digits following the decimal point e.g. 0016226.939 = 00:16:26.939 )

Setup7.jpg

The GPS Mouse now is successfully set up to work with ER9X-NMEA. Terminate the program and power off and disconnect your GPS Mouse

Step 3:

Configuring the APC200

Programming of the APC200 module can be done only via the serial TTL interface. To program it, the module has to be switched into configuration mode. This happens, when the module receives special data while it is powering on.

When the configuration program RF-Magic is started, it permanently sends certain data over the serial port to the attached APC200 module. When the module is powered on while this data is supplied to its serial TTL input line, it switches into configuration mode and stays there, as long as there is configuration data traffic. It switches back to normal mode within parts of a second, when this data traffic is stopped.

To set the APC200 module into configuration mode, you have to start the configuration program RF-Magic.exe and while the program is running, power on the connected APC200 module. If RF-Magic does not immediately recognize the module, retry several times (power off / power on the module), until the status line shows successful connection.


Preparing the connection cable

Layout of the connector:


Apc module.jpg


APC200
-----------------+
              1  |--------------  ground
                 |
              2  |--------------  +5 Volt
                 |
              3  |--------------  don't connect
                 |
              4  |-------<------  TTL RX
                 |
              5  |------->------  TTL TX
                 |
              6  |-------<------  RS232 / RS485 RX
                 |
              7  |------->------  RS232 / RS485 TX
-----------------+




APC200                              Level converter			      9-pin SUBD female to COM port
                                 TTL  /  RS232 (SUBD)
----------------------------------------------------------------------------------------------------------
pin 4  Rcv -------------------  TX    /   pin 2  Rcv -----------------------  pin 2  TX
pin 5  Tx  -------------------  Rcv   /   pin 3  Tx  -----------------------  pin 3  Rcv
pin 1  Gnd ---------------+---  Gnd   /   pin 5  Gnd ------------------------ pin 5  Ground
pin 2  +5V ------------+--|---  +5V   /      
                       |  |	          
                       |  |
+5V Servo Conn --------|  |
Gnd Servo Conn.-----------+		



APC200 and the level converter are supplied with 5 volt via a servo connector, attached between APC200 and converter.


The connectors for the level converter and the APC module in detail.


Level converter, plugs for level converter and APC200 module and servo connector for powering both modules

1673.jpg


Pins on converter are top, front to rear to bottom, front to rear: +5 volt, ground, RxD (TTL), TxD (TTL)

1675.jpg


APC connector marked with 'TTL' has ground on outer pin marked with the red dot.

The signals of the 4 wire cable for the APC200 from top to bottom are: Tx (TTL), Rx (TTL), +5volt, ground (0volt)

1674.jpg

Used pins on APC200 module are left to right: Ground, +5 volt, RxD (TTL), TxD (TTL)

File:1676.jpg


Connect the APC200 module via the level converter to a real COM port of your PC Don't power up the module now Start the configuration program RF-Magic Power on the APC200 module The program should immediately detect the module and confirm it with a status message. If not, repeat to power off/on the connected module.

Apc1.jpg


Click on the 'Read R' button This displays the current setting of the module

Read succeed.jpg

Set the parameters as shown below, but set 'RF frequency' and 'RFID Index' to your requirements and

'Series Rate' to 9600 bps and 'RF TRx rate' to 4800

Click on the 'Write W' button.

Write succeed.jpg

This writes the configuration data permanently to the APC200 module (You can modify the data at any time later) Take a note of your settings, as you have to configure the second APC200 identically. Power off and remove the module

Connect the second APC200 module and configure it the same.

When powered on, both APC200 modules will link together and work like a wireless RS232 cable. Data put in on one end will drop out at the other end.


Step 4:

Programming the Arduino Hub

To program the Arduino, you need to install the Arduino IDE (download it from www.arduino.cc) and you need an USB to Serial TTL converter.

Start the Arduino IDE and load the FrSky_RSSI.ino or the NMEA_RSSI.ino Plug USB converter int USB port of the PC, connect it with attached Mini Arduino Pro and run "upload". The source code will be compiled and uploaded to the Mini Arduino Pro.

Attention !!! The used signal names are as used on my modules. Rxd from USB/TTL is really connected to Rxi from Arduino The same is true for Txd.

The Arduino Reset must be connected to RTS or DTR (to create the reset for the boot loader - the blue wire), to be able to automatically upload the Arduino fw from the Arduino IDE

USB-RS232 TTL	             Mini Arduino Pro		      
+---------------+          +--------------------+		
|violet  +5Volt |----------|+5Volt	        |		
|grey	  TXD ! |<---------|TXO ! 		|
|white	  RXD ! |--------->|RXI ! 		|
|black	  Gnd	|----------|Gnd 		|
|blue	  RTS	|---\	   |			|
|		|    >-----|Reset 		|
|	  DTR	|---/	   |		        |
+---------------+	   +--------------------+	

100-1603.jpg

USB to Serial TTL converter connected with Mini Arduino Pro 328, ready for flashing.(Blue wire at USB converter connected on 'RTS' pin.)

Combinations of Arduino and radio firmware

Original NMEA hardware, only GPS + APC200:

radio flashed with compile parameter
NMEA.hex NMEA=YES

Using an Arduino + GPS + APC200:

Arduino flashed with radio flashed with compile parameter
NMEA_RSSI NMEA_HUB.hex NMEA=YES HUB=YES extended NMEA protocol
FrSky_RSSY frsky.hex --- emulation of original FrySky protocol
Native_FrSky_RSSI frsky_N2F.hex FRSKY=YES N2F=YES emulation of FrySky sensor hub protocol


This is a link to the Arduino source files:

http://9xforums.com/forum/viewtopic.php?f=5&t=1528&p=21783#p21783

Using GPS + FrySky Sensor Hub + APC200:

radio flashed with compile parameter
frsyk_N2F.hex FRSKY=YES N2F=YES data is transmitted with the original Hub protocol, radio uses modified FrSky version.


To program the Arduino, you need to install the Arduino IDE (download it from www.arduino.cc) and you need an USB to Serial TTL converter. Start the Arduino IDE and load the FrSky_RSSI.ino or the NMEA_RSSI.ino Connect the USB Serial converter with the attached Mini Arduino Pro and run "upload" (second icon '-->' in the menu line) The source code will be compiled and uploaded to the Mini Arduino Pro.

Ardu up.jpg



Step 5:

Removing the housing of the GPS Mouse

To save some weight on the GPS mouse, remove the housing. You have to, more or less, destroy the housing as upper and lower half are glued together and must be pried open with some force.

Housing.jpg


Step 6:

Connecting the GPS mouse and the APC200 transceiver

Cut the original mouse cable to still have enough length to connect the mouse with the APC200 As power supply, use a servo cable and solder it to pins 1 and 2 of the APC200 (watch polarity)

100-1264.jpg100-1266.jpg


GM210                                      APC200
---------------------------------------------------------
pin 1 red  +5Volt   ---------------------  pin 2  + 5Volt
pin 4 blue TTL RX   ---------------------  pin 5  TTL Tx
pin 5 white ground  ---------------------  pin 1  ground
pin 6 black TTL TX  ---------------------  pin 4  TTL Rx

To power your GPS with transmitter, plug the servo cable into an unused servo position of the receiver or use a Y-cable splitter.

Check, that the LED of the GPS mouse lights up.

Step 7:

Verify, that all the switches do work.

Throttle cut and Aileron-D/R switch will be rerouted in the next step. Go to the system screen that displays the switches or to the diagnostic screen 4/6 and verify, that all switches are working.


Step 8:

Modify the transmitter according to the following description (rewire switches)

This modification is based on the very good instructions by Gruvin9x. http://code.google.com/p/gruvin9x/wiki/FrskyInterfacing


Accessing TXD and RXD on the ATmega

The ATmega RXD and TXD special-purpose pins are used for simple switch inputs in the factory '9X -- namely, Throttle-Cut and Aileron-D/R, respectively. To free these pins up for use with serial data, we need to move those two switches elsewhere. The two pins chosen for their new home were pins 41 and 42, or PC6 and PC7 respectively. The modification requires the use of really fine wire. I used 0.2mm, enamelled copper wire. You can also use fine, insulated wire, salvaged from the newer (yet now old) high-density computer IDE cables. Each of these wires is a single-core, PVC insulated wire. You most definitely do not want to try and use any kind of multi-strand wire -- no matter how fine it it is.

IMPORTANT
The main reason to use really fine wire may not be what you think. It is certainly possible (though more difficult) to use heavier, stronger wire. But doing so will increase the risk of accidentally damaging the delicate ATmega chip's pins. (Think of it as using a wrecking bar to pick your teeth -- or something like that! :P) In practice, the slightest accidental tug by 'big fat, shaky, human hands on a big fat wire', can quite literally rip an ATmega pin right of the chip. Trust me -- use really fine wire!

Re-wiring Procedure

Referring to the image below ...

  • Remove the two left-hand-most resistors as indicated in yellow
  • Hot glue a couple of 220ohm resistors (1/8th or 1/4watt are OK) to a nearby, clearish area of the PCB
  • Solder your 'super fine' wires to pins 41 and 42 of the ATmega and connect to the top end of the resistors as shown. Use alcohol if required -- to steady your hands! (Just joking -- but if it works for you -- go right ahead. :p)


HINT: Pre-solder the wire end and the ATmega pins. Use a solder sucker or de-soldering wick to clear away excess solder from the two pins and to remove any solder bridge. Then lay the first wire end over the pin and apply the soldering iron directly down on top of it for half a second, then directly straight up -- then let go the wire. Give the wire a gentle tug in the direction directly away from the chip (in line with the pin).If it holds -- you're done. Don't futz with it. If you're right handed, solder the left hand wire first, so the the soldering iron does not lay over the first wire when trying to solder the second.

Solder wires from the bottom ends of the hot-glued resistors to the little vias (holes) near where the two removed resistors were, as shown in the image.

Reroute.jpg

 The color coding of the 220 Ohm resistors is red, red, brown.

NOTE It pays to use small dabs of hot-glue near the ATmega pins and in a couple of places along the wires to hold them in place. The last thing you want is for something to get hooked under them and rip them off, possibly damaging the ATmega pins in the process!


Step 9:

Flash the TX

Go to the system screen that displays the switches or to the diagnostic screen 4/6 and verify, that Throttle cut and Aileron-D/R switch do no longer work.

'Flash the TX with the appropriate version of ER9x

Verify, that all switches work correctly again.

That verifies, that the telemetry mod has been done correctly

If you flashed the NMEA verion,

  • Press DOWN[long] to enter the telemetry display
  • Press LEFT[short] or RIGHT[short] to step through the screens. Most of the values should show a big questionmark
  • Press UP[long] or DOWN[long] to leave the telemetry screens



Step 10:

Connect the APC200 module with the TGY9X TX

APC200                      TGY9X
---------------------------------------------------------------------------------------------
TTL Tx  Pin 5 ------------  via resistor of 1K to Pin 2 of ATMega (named 'Fr-Sky RX' on the picture above)
+5Volt  Pin 2 ------------  +5 Volt
Ground Pin 1  ------------  Ground


Step 11:

Final Check

  • Power on the GPS-transmitter and the TX
  • Enter the NMEA screens
  • UTC-Time and Date will be the first fields to display real values.
  • Most of the other fields will be similar to 0000.000
  • When the GPS mouse gets a fix (Sat >=3), most of the fields will show the received values.
  • Altitude may need a little bit longer.
  • 'GroundCourse' and 'Speed over Ground' require, that the GPS Mouse is being moved.


Some Pictures:

NMEA transmitter

GPS module from backside with the RF module and an externally connected backup battery. Modules not yet wired.

Place.jpg



NMEA receiver

APC200 Module with pins unsoldered and	     	Hole for the antenna connector
cable directly attached 

Transceiver.jpg Ant-hole.jpg



Antenna connector on the backside of Tx case

Ant-conn.jpg



Module, switch and servocable, secured with hot glue

Mod-intx.jpg



Mounted antenna, module and power switch

Mounted.jpg


...

...

Some technical background

NMEA Records:

The length of the individal fields may vary (even be empty), but all Fields are always there and are separated by colon. $GPGGA data is valid when field 6 <> "0" (Null) $GPRMC data is valid when field 2 <> "V" UTC-Date and UTC-Time are available some time before the GPS gets a fix


Sample with position not fixed:


$GPGGA,130607.704,5014.8588,N,01123.8331,E,0,01,0.0,0.0,M,47.7,M,0.0,0000*73 $GPRMC,130607.704,V,5014.8588,N,01123.8331,E,0.00,,110211,,*0D


Sample with position fixed:


$GPGGA,130415.711,5014.8480,N,01123.9166,E,1,08,1.0,387.2,M,47.7,M,0.0,0000*79 $GPRMC,130415.711,A,5014.8480,N,01123.9166,E,2.59,312.81,110211,,*0E

Samlple for LCL record

$GPLCL,3FF,200,0,08C,2AB,111,100,2CA,3A,2EE0*hhCrLf



Layout of the $GPGGA record

$GPGGA - Global Positioning System Fix Data, Time, Position and fix related data for a GPS receiver.


          1        2     3   4      5 6  7  8   9 10 11 12  13  14  15
| | | | | | | | | | | | | | |
$GPGGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh<CR><LF>

Field Number:

  1. Universal Time Coordinated (UTC)
  2. Latitude
  3. N or S (North or South)
  4. Longitude
  5. E or W (East or West)
  6. GPS Quality Indicator
    1. - fix not available
    2. - GPS fix
    3. - Differential GPS fix
  7. Number of satellites in view, 00 - 12
  8. Horizontal Dilution of precision
  9. Antenna Altitude above/below mean-sea-level (geoid)
  10. Units of antenna altitude, meters
  11. Geoidal separation, the difference between the WGS-84 earth ellipsoid and mean-sea-level (geoid), "-" means mean-sea-level below ellipsoid
  12. Units of geoidal separation, meters
  13. Age of differential GPS data, time in seconds since last SC104 (type 1 or 9 update, null field when DGPS is not used)
  14. Differential reference station ID, 0000-1023
  15. Checksum


Layout of the $GPRMC record

$GPRMC - Recommended Minimum Navigation Information


          1      2  3      4   5      6  7   8   9   10 11 12
| | | | | | | | | | | |
$GPRMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a*hh<CR><LF>

Field Number:

  1. UTC Time
  2. Status, V = Navigation receiver warning
  3. Latitude
  4. N or S
  5. Longitude
  6. E or W
  7. Speed over ground, knots
  8. Track made good, degrees true.(COG)
  9. Date, ddmmyy
  10. Magnetic Variation, degrees
  11. E or W
  12. Checksum


Layout of the $GPLCL record

This is not an official record format but is used for private extended data

        1   2   3   4   5   6   7   8    9         10 11
| | | | | | | | | | |
$GPLCL,AN0,AN1,AN2,AN3,AN4,AN5,AN6,AN7,Digital In,RPM*hh<CR><LF>

Field Number:

  1. Analog Input 0
  2. Analog Input 1
  3. Analog Input 2
  4. Analog Input 3
  5. Analog Input 4
  6. Analog Input 5
  7. Analog Input 6
  8. Analog Input 7
  9. Digital inputs
  10. Rotations per minute
  11. Checksum


Checksum calculation

my_d is that part of the NMEA record that is between "$" and "*"


'All the bytes are XORed

(This is how I calculate the checksum in HB++)

for n=1 to len(my_d) myhi=mid(my_d,n,1) cs=cs xor asc(myhi) next

CheckSum= right("0" & hex(cs),2) 'to get a 2 character string