Thread Tools
This thread is privately moderated by Hobby4Life, who may elect to delete unwanted replies.
Feb 16, 2020, 06:53 AM
Registered User
Hobby4Life's Avatar
Thread OP
Build Log

GPS Simulator for OpenTX


The weather is not always good for testing things outside.
To be able to continue testing with the GPS widget, I made a GPS simulator / sensor based on a previous project.
I once developed a GPS Simulator app for android, this app can generate GPS NMEA senteces like a real GPS does.
It is possible to connect to the app via an HC-06 Bluetooth module.
The Bluetooth module then sends the same NMEA messages via the UART.
Such as position, speed, height, bearing and satellite fix.

What do you need:

 Arduino Nano or any AtMega328 based arduino will do
Name: Arduino-Nano-R3.jpg
Views: 28
Size: 42.9 KB
Description:
Arduino Nano




HC-06 Bluetooth module.
Name: HC-06.png
Views: 29
Size: 324.9 KB
Description:
HC-06 Bluetooth Module




 USB-TTL converter PCB

This is needed to program the bluetooth module and / or the Arduino Pro Mini, this can be any kind of USB to TTL adapter.
Name: USBTTL.jpg
Views: 32
Size: 41.9 KB
Description:
Example of USB - TTL Converter




Servo cable for Smartport connection to the receiver.
Name: servocable.jpg
Views: 6
Size: 15.0 KB
Description:
Servo Cable


Programming the Bluetooth module:

It is important to program the bluetooth module so that it works at 9600bd.

This is possible via a terminal program.
Fortunately, the HC-06 modules are already set to 9600bd by default, so you don't have to do much here.
If you still want to change the name of the module, you will still have to program it via the USB-TTL PCB.

A good terminal program for programming is:

Terminal of [email protected]https://sites.google.com[/email]/site/terminalbpp/
Downloadhttps://sites.google.com/site/termin...edirects=0&d=1

Name: HC-06-USB-TTL-300x225.jpg
Views: 8
Size: 17.3 KB
Description:
Connect the HC-06 module to the USB-TTL adapter as above in the picture.

Code:
HC-06	USB TTL
VCC	VCC
GND	GND
RX	TX
TX	RX
Now start the Terminal program on the PC.

Select the correct assigned serial port (COM PORT) of the USB-TTL adapter (in this case COM6 ).
Set the baud rate to 9600bd.
Then click on “Connect / (Disconnect)
Then enter the command “ AT ” to be sent in the white field at the bottom of the screen.
Then click on the " Send " button.
If the baud rate is set correctly, the answer " OK " should appear in the " Receive " window.

Name: Terminal1.png
Views: 5
Size: 32.0 KB
Description:

If the above does not work immediately, the HC-06 module will be in a different baud rate.
To sort this out, you will have to select a different baud rate step by step, and execute the above “ AT ” command.
Continue until the answer " OK " appears.

Once the answer has been received, it is now possible to set the required baud rate.
Enter the command " AT+BAUD4 " in the lower white field, and then press " Send ".

The answer to this is " OK9600 " in the " Receive " window.
This means that the module is now active at 9600 baud.

Name: Terminal2.png
Views: 8
Size: 31.1 KB
Description:

There is also a possibility to change the name of the HC-06 module.
This is the name that is displayed on a client device when searching for Bluetooth devices.

This can be done by entering the command " AT+NAME ", immediately followed by a new name.
In this case we use the name " GPSEMU ".

Enter the command " AT+NAMEGPSEMU " in the bottom white field and then click on " Send "
The following must be returned as an answer in the " Receive " window: " OKsetname "

Name: Terminal3.png
Views: 6
Size: 33.7 KB
Description:

Programming the Arduino.

In this example I will use an Arduino Nano.
Download Arduino: Arduino IDE

Use the following Sketch file: FrskyGps.zip

Install Arduino, and then unpack FrskyGps.zip.
Start Arduino and open the project called: FrskyGps.ino
The first thing to do now is to install a library for the project.
At the top of the menu, click on " Sketch -> Include Library -> Add .ZIP Library ... "

Name: Arduinolibinstall.png
Views: 6
Size: 18.5 KB
Description:

Then find the project folder, and open the “ libs ” folder.
Select the following zip file: " FrSkySportTelemetry_20190824.zip " and click on " Open "
Arduino will now install the library.

Name: ArduinoAddLib.png
Views: 6
Size: 20.6 KB
Description:

Then connect the Arduino to the PC via USB.
In this case an Arduino Nano.

Now click in the top of the menu on: “ Tools 

Name: Arduinoboardtype.png
Views: 7
Size: 23.4 KB
Description:

Set the following correctly

Board : "Arduino Nano"
Processor : "ATmega328P"
Here you may have to choose between "ATmega328P" and "ATmega328P (Old Bootloader)".
You will just have to try which of the 2 you need.
In my case I have to use " ATmega328P (Old Bootloader) ".
Port : "COM14" (in my case)

If everything is set up correctly we can flash the sketch in the arduino:

Click on the " Upload " icon to flash the sketch.
When the flashing is done, it says " Done uploading " at the bottom

Name: ArduinoUpload.png
Views: 4
Size: 22.2 KB
Description:

Assemble hardware:

When the Arduino and the HC-06 module are programmed, it is time to assemble all the hardware.

First prepare the arduino by connecting the servo cable.

1. The red wire from the servo cable goes to VCC on the Arduino.
2. Black wire from the servo cable goes to 1 of the GND points on the Arduino.
3. Orange / white wire from the servo cable goes to Pin D3 on the Arduino.

Connecting the HC-06 module.

1. Solder a wire between the VCC of the HC-06 module to the VCC of the Arduino.
2. Solder a wire between the GND of the HC-06 module to the 1 of the GND points on the Arduino.
3. Solder a wire between RX of the HC-06 module to the TX1 pin of the Arduino.

Code:
Arduino	HC-06
VCC	VCC
GND	GND
TX1	RX
The soldering work is now done.

Now connect the Arduino via the servo cable to a receiver that is suitable for SmartPort.

To use the simulator we need an app for android.

Download : GPS NMEA Simulator

Then install the app on your android device.

The first thing to do now is to pair the HC-06 module on the android device.

Go in your device to the settings for bluetooth and scan for bluetooth devices.
Then find the device with " GPSEMU " and connect.
The default password of the HC-06 module is " 1234 "

Name: Bluetoothpair.jpg
Views: 5
Size: 274.7 KB
Description:

Then launch the " GPS Nmea Simulator " app

Click on the connect button and select Bluetooth device “ GPSEMU 
Once connected, the bottom of the window will show “ Connected succesfully! "

Name: GPSSimConnect_292x600.jpg
Views: 7
Size: 75.2 KB
Description:
Name: GPSSimSelectDevice_292x600.jpg
Views: 7
Size: 34.1 KB
Description:

Now set some parameters to get you started.

Name: GPSSimPresettings_292x600.jpg
Views: 8
Size: 44.3 KB
Description:
Name: GPSSimPresettings1_292x600.jpg
Views: 5
Size: 47.9 KB
Description:

Now go back to the start screen and click on “ START ”, the symbol in the middle of the screen will now flash blue, streaming of NMEA messages has now started.

Name: GPSSimstreaming_292x600.jpg
Views: 6
Size: 72.4 KB
Description:

Now go to the Telemetry menu in your channel.
And click on " Discover new sensors "

Various sensors will now be found.
Tmp1, Tmp2, GPS, GAlt, GSpd, Hdg

Name: OTXGPSSim.jpg
Views: 8
Size: 27.4 KB
Description:

Have fun!
Sign up now
to remove ads between posts
Feb 18, 2020, 09:33 AM
Design Engineer
This looks super awesome! I'm going to have to give it a try.
Feb 20, 2020, 01:45 AM
Registered User
Hobby4Life's Avatar
Thread OP
Please let me know your findings :-)


Quick Reply
Message:
Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Opentx simulator MikeNH Radios 2 Apr 03, 2019 01:40 PM
Discussion OpenTx Companion Simulator Question lgs Radios 5 Nov 14, 2018 11:15 AM
Discussion FrSky D series arduino DIY hub with naza GPS data to openTX poteroa Radios 65 Jun 19, 2018 02:35 PM
Discussion Looking for GPS data simulator harralk Simulators 0 Jan 04, 2017 02:18 PM