In this tutorial you are going to learn how to simulate a GPS module in Proteus interfaced to an Arduino Uno. You may be working on a project which requires you to simulate GPS data. This tutorial will teach you exactly how to do that!.
As usual all source code and files used in this tutorial can be downloaded in the Resources section at the end of this post.
To run the simulation, we are going to make use of the following resources:
- A GPS library for Proteus designed by Theengineeringprojects.com which adds a GPS module to our components library and allows us to use GPS modules in our Proteus simulations
- The GPS Module hex file which defines how the GPS module should work and also contains dummy NMEA strings. The GPS hex file was also written by Theengineeringprojects.com and is included in the resources for this project at the bottom of the post.
- TinyGPS library, an NMEA (GPS Data) parser (written by Mikal Hart) so that we can make sense out of the random GPS data we will be receiving from the GPS module.
- Arduino Sketch
- Arduino hex file
I am assuming that you already have the Arduino library installed in Proteus. If not, learn how to install the Arduino library in Proteus.
I will be using Proteus 7.8 for this tutorials and for most of my Proteus tutorials.
So here is what is going to happen:
- The GPS module in Proteus has been designed to output some fake NMEA data. NMEA is just a format in which GPS devices output data.
- The NMEA data from the GPS module is received by the Arduino through its hardware serial port.
- The TinyGPS library parses the data received and “translates” it into understandable GPS data such as longitude and latitude.
- The data is displayed on a virtual terminal inside Proteus
Extracting the GPS library for Proteus
- Scroll to the Resources section and download the zipped file containing the GPS library, TinyGPS library and GPS Hex file.
- Upon opening the zipped file, you’ll see a number of files. Extract the files and save them somewhere on your PC.
- Next, extract the contents of the proteus-gps-library.zip into your Proteus library folder.
- If you use Proteus 7, the path will be something like C:\Program Files (x86)\Labcenter Electronics\Proteus 7 Professional\LIBRARY . Note: If your computer runs a 64bit architecture, the your Program Files folder will rather be Program Files (x86)
- If you use Proteus 8, the path will be something like C:\ProgramData\Labcenter (Electronics\Proteus 8 Professional\Data\LIBRARY
- After that, extract the content of the TinyGPSNew.zip into the Arduino libraries folder located at C:\Program Files (x86)\Arduino\libraries
Extract TinyGPS library into Arduino libraries folder
After extracting all files and libraries to their respective locations, open up Proteus and add Arduino Uno and GPS Module to your work space and connect them as shown in the image below.
- TXD pin of GPS module goes to PIN0 (RXD pin of Arduino) since the GPS module will be transmitting data to Arduino
- TXD pin of Arduino is connected to the Virtual terminal so that we can display and view GPS data in the Virtual terminal.
Next, double-click on the GPS module. A dialog box will appear. GO to the “Program File” section, click on the little folder icon on the right, navigate to the “ProteusGPSResources” folder and select GpsTEP.hex.
Repeat the same process for the Arduino Uno but this time, select “ArduinoGPS_ino.cpp.hex”.
And that’s it! You are all set. When you run the simulation, you should see something like this on your screen.
The Arduino Code used as well as the Proteus file is also attached so you can modify it as you please.
Here is the code below
/* This code demonstrates how to simulate GPS module in Proteus.
The GPS module library for Proteus was obtained from www.theengineeringprojects.com
The TinyGPS Arduino library was written by Mikal Hart (www.arduinana.org)
This example code was adapted from Mikal Hart's example code
modified 13th April 2016
by Isaac Sesi
The rest of the project can be found at http://www.currentcity.cc
TinyGPS gps; //Creates a new instance of the TinyGPS object
Serial.begin(9600); //Baud rate for simulation purposes. A lot of actual GPS modules use a 4800 baud rate
Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
// For one second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;)
char c = Serial.read();
//Serial.write(c); // uncomment this line if you want to see the GPS data flowing
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true; //newData variable is set to true
if (newData) //If newData is true
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print(" Latitude = ");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6); //Parse the NMEA data to extract and display the latitude
Serial.print(" Longitude = ");
Serial.println(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6); //Parse the NMEA data to extract and display the longitude
//This block checks if data coming in is fresh and to detect errors.
//This is not very necessary for a simulation but you can uncomment It if you want to see that data
gps.stats(&chars, &sentences, &failed);
Serial.print(" CSUM ERR=");
if (chars == 0)
Serial.println("** No characters received from GPS: check wiring **");
If you like this tutorial, have any questions or found any mistakes, please let us know in the comments section below.
Also please support the development of more tutorials by Buying Your Arduino or GPS Module from Amazon. I get a 4% commission if you buy anything using these links and that helps me keep this site running.