Accident Detection System using Arduino

Hello everyone, Welcome to our new project. Our new project plays a very important role in our daily life as it is directly connected to our lives. In this project, we are going to design an Accident Detection module. Accidents are the most common thing we hear about in the news, and in social media. Everyone here or there has seen accidents or has been with one. So when any such incidents happen, we inform respective stations or hospitals in that emergency situation. But what about the accidents that happen at night, or in places where there is very less crowd or you are alone. So, to address this issue and provide a potential solution for that, we are going to learn how to detect an accident automatically and inform nearby aid/help stations.

We can use this useful project for an engineering project’s showcase for electronics, electrical engineering students, and can be used in real-life situations where it can help people in disastrous situations.

According to WHO, research says that in the current scenario, 1.3 million people are the victims of road traffic crashes, and 40% of these accidents of all fatal accidents occur at night. In most cases, the accidents are not reported immediately, or the injured doesn’t receive any help during that time. The time between the accident and the arrival of medical help for the injured can sometimes make the difference between his life or death. In the future, we can interface with the vehicle airbag system. This will optimize the proposed technology to the maximum extent and result in the finest accident detection system possible. In this Modern era, everything is being automated and with this project, we are going to automate this process with some electronic components and Arduino. So Let’s dive in. Here's the video demonstration of this project:

Where To Buy?
No.ComponentsDistributorLink To Buy
1NEO-6MAmazonBuy Now
2SIM900AmazonBuy Now
3Arduino UnoAmazonBuy Now

Software to Install:

Instead of using real components, we will design this project using Proteus Simulation. Working with simulation before attempting to make it with real components is also a smart practice. We can figure out the issue that may arise while working on real components and avoid any kind of damage to our components by simulating it.

Proteus is a very fascinating tool that allows us to simulate and create electronic circuits. Despite the fact that Proteus software contains a large library of electronics components, it still lacks pre-installed modules such as Arduino boards, GPS or GSM modules, and so on.

Let’s install the required libraries which, we are going to use in this project:

You can download this whole project for example Proteus Simulation and Arduino Code, by tapping the below button

Accident Detection System using Arduino

Project Overview:

These are required components for Accident Detection, which are as follows:

  • Arduino Uno: Arduino Uno is a development board from the Arduino family, which is the main component of this project. The Microcontroller i.e., Arduino is responsible for the decisions that are going to be processed in the project.
  • Accelerometer: An accelerometer is a device that measures acceleration, which is the change in speed (velocity) per unit time. By measuring acceleration we can get information like object inclination and vibration which helps in detecting unusual activities/ accidents.
  • GSM: A GSM/GPRS Module is a device that is actually responsible for the wireless communication with the GSM Network, in this case, it is responsible for sending the appropriate information to rescue stations.

Components Needed:

  1. Arduino Uno
  2. GPRS Module
  3. Accelerometer
  4. GSM Module
  5. Bread Board
  6. Jumper Wires

Component details:

Arduino Uno:

  • The Arduino UNO is one of the Arduino family's programmable, open-source microcontroller boards.
  • It includes an Atmel Microchip ATMega328P microcontroller with an 8-bit RISC processing core and 32 KB flash memory from Atmel.
  • It has 14 digital I/O pins, including 6 PWM pins and 6 analog I/O pins with a resolution of 10 bits (0-1024).
  • It comes with one hardware UART, one I2C, and one SPI peripheral.
  • We can use the Arduino UNO with a voltage range of 7-12 volts, but not more than 9 volts is recommended because it may damage the Arduino board
  • To power the Arduino UNO we can use a USB-B cable (the same cable that we use to upload the sketch to Arduino UNO), a DC power jack, or the Vin pin on the board.

GPS Module:

  • The Global Positioning System (GPS) is a space-based global navigation satellite system that gives accurate location and timing in all weather and at all times around the world.
  • It sendLongitude, latitude, height, and time are the four variables that a GPS receiver determines.
  • Data determined by the module will be sent to the microcontroller (Arduino Uno) through the UART protocol.
  • With a USB interface, the GPS module is simple to operate. It operates on a 3.2 to 5V supply range, allowing it to interface with both 3.3V and 5V microcontrollers.
  • It has a default baud rate of 9600 and can be modified as per our requirement.
  • We have used this to get the current location of the user.

Accelerometer:

  • Accelerometer sensors are integrated circuits (ICs) that are used to measure acceleration, inclination, and various parameters regarding the x,y,z axes. It is the main component to detect the accident.
  • Here we used the MEMS (Microelectromechanical Systems) accelerometer. These types of accelerometers are used where we have to measure the vibration or shock without any fixed reference.
  • It monitors changes in the capacitance and converts that value to analog output voltage.
  • Gyro Range of the Accelerometer sensor is ± 250, 500, 1000, 2000 °/s (may vary depending upon the sensor).
  • Accelerometer Range of the sensor module is ± 2 ± 4 ± 8 ± 16 g (may vary depending upon the sensor).

GSM module:

  • This module is used to send the notification to the rescue station or the emergency numbers.
  • It communicates with the Arduino UNO using the UART protocol.
  • It works in a voltage range of 3.5 - 5 volts.
  • There are different types of GSM modules available but in this project, we have used the SIM900D module.
  • We operate them using the AT commands. As there are hundreds of AT commands but we will use some basic only just to send the message.

Proteus Simulation of Accident Detection Circuit:

Now, it is time to start designing the main circuit of Accident detection in Proteus Simulation software.

  • Most importantly, ensure that Proteus is installed on your PC/Laptop and download all the required libraries for Proteus ahead of starting the designing steps.
  • For this project, we are going to use libraries for Arduino Uno, GPRS Module, GSM module.
  • To add the libraries in the Proteus suite we have to go to the C drive then LabCenter Electronics >> Proteus 8 professional >> Data >> Library and paste the downloaded library files here.
  • The download links of all the libraries have been provided to you in the above sections, please go check them out.
  • Let’s start the making of a new project, open the new project in Proteus.
  • After that enter the name of your new project.
  • Now our working area will be open here we will import all the required components which we are going to use.
  • The following components need to be selected from the Proteus component library. We’ll connect the components and make the circuit complete.
  • Now we have imported all the required components for this project, after this, we will start connecting them.

Circuit Diagram and Working:

  • There are two modules GPRS and GSM modules, both communicate using the UART protocol but in the Arduino UNO there is only one hardware UART’s provision. Now, you may have doubts about how we are going to connect them. No worries, we will handle that on the coding side by declaring the different pins as UART pins.
  • We can use different pins for UART using the SoftSerial library of Arduino, which will be discussed in the code.
  • We will use the digital pins for UART connections, digital pins 2 and 3 for communication of the GSM module, which means connecting the Rx and Tx of the GSM module with the D2 and D3 pins of Arduino UNO respectively.
  • Connect the Rx and Tx of the GPRS module with the D10 and D11 pins of Arduino UNO respectively.
  • As modules are connected, now we will connect the accelerometer. As it will not be possible to simulate the accelerometer in Proteus so we have used the potentiometers to change the value of the X-axis, Y-axis and Z-axis.
  • You may have doubts about how we can replace the accelerometer with potentiometers. As we will use the MEMS accelerometer, which sends the analog voltages for each axis, so we can simulate that using the potentiometer because we will receive the same type of data.
  • We need three potentiometers, one for each axis. Potentiometers of the X-axis, Y-axis and Z-axis will be connected to A1, A2 and A3 pins of Arduino respectively.
  • We will connect a serial terminal for debugging purposes.

Arduino code for Accident Detection System

Before going to start the coding, it would be easy if you understood the circuit diagram connections.

  • When we start writing the code(called a sketch in Arduino IDE), we will first include all of the necessary libraries for this project.
  • So, if the essential libraries aren't already installed in the Arduino IDE, our first step would be to get them.
  • Here we use mainly two libraries, one for serial communication and parsing data from the GPS module.
  • By heading to 'Sketch > Include Library > Manage Library' in the Arduino IDE, we can install libraries related to Arduino. We can now search for our essential libraries in the library manager. We can also use zip files to install the libraries.
  • As we've installed all the specified libraries. Let’s include them in our sketch.
  • Now, we are declaring D2 and D3 pins for serial communication with GPRS modules and declaring GPS objects as well, which will pretty much do all the grunt work with the NMEA data.
  • After that, we will declare variables to store the GPS module data.
  • Now, we are declaring pins and variables for the accelerometer which we will use in our project. Here, we are using Analog Pins because we are reading the analog voltages from the potentiometer.
  • We need to declare two threshold values for change in acceleration when an accident is detected.
  • The min and max values can vary. So, it is highly recommended to measure the values by accelerometer for devices using.

Void Setup():

  • It is one of the most important functions which will execute only once in the whole process.
  • As we are using a GPS module in our project, We should first start serial communication between the components and Monitor them through “Serial Monitor” in the Arduino IDE.
  • “Serial.begin” is used to set up the serial configuration for the device which is connected to the Serial Port of the Arduino. Here, we will set the baud rate for that device i.e 9600 in our case.
  • “serial_connection.begin(9600)” is used to set up the UART configuration for the GPS module. As the GPS module communicates to the Arduino at the baud rate of 9600.
  • We are using an Accelerometer in the circuit and it was clearly explained in detail that it will sense the x,y,z coordinates of the device and send them to Arduino.
  • Here, we have initialized a for loop to collect the sample data for x, y, and z coordinates of the device in the ideal state.
  • Afterward, the sample coordinates have been successfully measured by the Accelerometer sensor, but we need an average value for smoothing the sample coordinate values. So here, we will calculate the average of each coordinate and print them in the serial monitor.
  • After the setup, we will write our main application code in the Void loop function.

Void loop():

  • It is the second most important function of Arduino code. It will come to action after the execution of “void setup()”
  • We'll write the code required to run in a continuous loop in this part. So this is where we'll write our primary application code.
  • As a result, when the code gets to the void loop portion, We firstly take the NMEA data from the GPS module and print it in the serial monitor.
  • Wait a minute, NMEA??, I can understand all the questions in your mind. Let us give you a simple explanation regarding NMEA and its applications.
  • The word NMEA stands for the National Marine Electronics Association, which is a mode of communication that existed before inventing GPS. NMEA-format GPS data can be accessed with a wide variety of GPS receivers, instead of creating a new custom interface every time. Thus, it makes our lives easier using the GPS Module.
  • When we are printing the NMEA data into the serial monitor, it will be printed in a specific structure. This NMEA data was output from a GPS receiver:

“$GPGGA,191605.00,4521.7785210,N,07331.7656561,W,2,19,1.00,674.354,M,19.900,M,0.90,0000*60”

  • All NMEA signals start with the ‘ $ ’ character and for every data field such as coordinates, and various parameters are separated by a comma. The data further includes Timestamp, Latitude, Longitude, Quality indicator, Number of satellites involved, Altitude, etc., which is not necessary to remember. Make sure to get the data from the GPS module. If we have succeeded in this step and get the data on the serial monitor, then we are good to go for further processing.
  • The “if” statement is to process the NMEA data and separate the data into the required format if there is any location updated to the GPS receiver.
  • As we have already received NMEA data in the previous step, the data will be separated into Latitude, Longitude and Altitude.
  • In the Loop function, the values of GPS and accelerometer will be continuously tracked.
  • Here, the analog values of x,y,z coordinates are being measured and printed in the serial monitor.
  • These are not the values we measured in the void setup, those were the values to take the readings in the ideal state of the device.
  • But in the loop, the values are the present x,y and z coordinates measured by the accelerometer.
  • This is the condition for accident detection, we have already discussed before that in the void loop the x,y,z coordinate values are continuously extracted and the “if” statement here compares the recent values with fixed min and max values of the coordinates.
  • If the recent values are indistinct or do not match with threshold values i.e., max value and min value, then it indicates that an accident has been detected.
  • When the accident detection condition is satisfied, the GPRS module will be activated and will call to rescue stations for aid/help and their home.
  • Here, we have programmed to give a call 5 times to the appropriate numbers in the “for” loop.
  • And the process also includes a messaging feature along with calling to rescue stations.
  • When the same accident condition is satisfied, the messaging feature will be activated and we are going to send the alerting message including the Location, Latitude, Longitude, and Google map location link by appending latitude and longitude values the to respective numbers.

Results / Working:

We have successfully completed our Accident detection project and it’s ready to test!
  • Before going to start the simulation, we need to import the hex files of Arduino code in the Proteus, to do so click on the Arduino and browse to the hex file of the code and select.
  • Now we need to add the program files for the GPS and GPRS modules.
  • Here we should note that we only need to upload the program files for the modules while we are working in simulation. In the real modules, they come up with pre-installed codes.

Now we have done all the prerequisites of simulation.

  • Let’s power the circuit and start the simulation, firstly the void setup function will run and it will initialize all the required pins and variables and will read the ideal state values of the potentiometer.
  • Now to simulate the accident case, we will change the values from the potentiometer, so when the potentiometer’s value changes and the falls in the Min and Max value range the if condition will be stratified.
  • After this GSM module will call the stored number 5 times and send the GPS location with Google maps link in that.
  • We have used some serial monitors for debug purposes, you can see the current state of the project using them.

I hope you have a good understanding of how our Accident Detection project works and that you have liked it. Although I believe we have covered almost everything, please let us know if you have any questions or suggestions in the comments section.

Thank you very much for reading this project. All the best for your projects!

Real Time Security Control System using XBee and GSM

Hello everyone, I hope you all are doing great. In today's post, I am going to share a Final Year Project in detail, named as Real Time Security Control System using XBee and GSM. I will give you all the details so that you can easily design it on your own. I've given the Proteus Simulation to download below. In that zip file, you will get both the Arduino codes and Proteus Simulations.

I have divided this whole project design into four parts. If you got into any trouble in your project, then ask in comments and I will try my best to resolve them. So, today we are gonna have a look at the basics of this Security project. There are a lot of systems introduced in the market these days that are used to transfer sensor data from one node to another either wirelessly or through some wired connection. The proposed technique also works on this same principle. But a lot of modifications are intended to introduce in order to enhance this technique.

Where To Buy?
No.ComponentsDistributorLink To Buy
1LCD 20x4AmazonBuy Now
2NEO-6MAmazonBuy Now
3SIM900AmazonBuy Now
4DS18B20AmazonBuy Now
5Flame SensorsAmazonBuy Now
6MQ-2AmazonBuy Now
7Arduino UnoAmazonBuy Now

Real Time Security Control System

  • You can download this Project by clicking the below button:
Real Time Security Control System using XBee and GSM Now let's have a look at the project description:

Project Description

In this project, I have designed a real-time security system, which consists of two wireless nodes named as
  • Sensor Node
  • Base Node.
So, first of all, let's have a look at these two nodes one by one. First, I am going to discuss Sensor Node:

Sensor Node

The sensor node is placed in that building which is needed to be secured. Sensor node consists of three different sensors and two modules used for security purposes named as:
  • Sensors:
    • Smoke Sensor: To detect Smoke.
    • Flame Sensor: Used for Fire Detection.
    • Temperature Sensor: Measuring Temperature of surroundings.
  • Modules:
    • GSM module: is used to deliver the notification message if any fault occurs in the system.
    • GPS module: is used to locate the exact position of the fault that occurred.
Below two modules are used for controlling purposes:
  • Modules:
    • Arduino UNO: All these Sensors and modules are connected to Arduino UNO.
    • XBee Module: To send sensors' data & GPS Location to Base Node.
Block Diagram for the Sensor Unit of Real Time Security Control System using XBee and GSM is shown in below figure: Now let's have a look at the Base Unit of Real Time Security Control System using XBee and GSM.
Base Unit:
  • The base node will be placed in the Control Department. It could be your security guard's room or the nearby police station.
  • This node will receive the data from the sensor node via XBee module.
  • So, in total it will have three modules on it which are:
    • XBee Module: It is used to maintain wireless communication between the sensor node and base node.
    • LCD 20x4: It is used to display real-time conditions like sensors' values & GPS Location.
    • Arduino Mega 2560: It is used to control both of these modules.
  • Here's the block diagram of Base Unit for Real Time Security Control System using XBee and GSM:

Components Selected

In the previous section, we have had a look at the basic Introduction of our Real Time Security Control System using XBee and GSM. This section will elaborate on the selection of the components which is the most important factor before designing any project/product. This is basically a simulation based project so there is no hardware involved in this project. The proposed technique is designed in Proteus ISIS. All of the components are taken from the Proteus library.

Flame Sensor

  • The flame sensor is an electronic device usually used for fire detection purposes.
  • It can be used in homes, industries, offices, schools etc.
  • A certain threshold is adjusted while designing the algorithm.
  • When the fire flames cross that particular threshold, the flame sensor will send a signal to Arduino which will send that signal through Xbee to Base Unit immediately.
  • As soon as the signal will be received on the Base Unit, the alarm will turn ON and hence guards will come to know that this area has become dangerous now.
  • Immediate precautions must be taken in this case.
  • Flame Sensor is not available in Proteus so we have designed its library.
  • You should download this Flame Sensor Library for Proteus.

Smoke Sensor

  • A smoke sensor is used to detect a certain level of smoke within the desired region.
  • It is usually used in homes and organizations for the detection of fire or internal burns.
  • It is a low-cost and very sensitive sensor that also beeps if someone is smoking in its coverage area.
  • This Smoke Sensor will detect any smoke in the area then it will warn the Arduino board which will, in turn, send a signal via XBee to Base Unit.
  • Proteus software doesn't have a smoke sensor in it so you should download this Smoke Sensor Library for Proteus.

Temperature Sensor

  • The temperature sensor is an electronic sensor used to estimate the temperature in the surroundings.
  • The temperature range can be adjusted while designing its algorithm.
  • When the temperature in the surroundings reaches the adjusted threshold, it generates a notification.
  • Most of the time an alarm is attached to the temperature sensor. The alarm starts to beep when the desired temperature is reached. It can be used in homes, offices and organizations to maintain the temperature of a certain area according to the desired requirements.
  • But in our project we want to send a signal to the base unit, so that's why this sensor will send a signal to the base unit.

XBee Module

  • XBee is selected as a wireless module. The proposed technique consists of two XBee modules.
  • One is attached to the base unit and the other is attached to the sensor unit.
  • The data is transmitted by the sensor unit via XBee module.
  • And the XBee module attached to the base unit receives that data from the sensor unit and sends it to the microcontroller to manipulate it.
  • There are many wireless modules available in the market these days e.g. Radio Frequency (RF) module.
  • Some of them are not used commonly due to their shorter ranges e.g. Bluetooth module.
  • XBee module is far better as compared to the Bluetooth module and provides a larger coverage area in comparison to similar wireless modules.
  • So, XBee is used in this project. XBee module is not available in Proteus so that's why you should download XBee Library for Proteus.

Arduino UNO

  • The microcontroller plays a vital role in any project and is like a backbone of a particular project.
  • Arduino UNO and Mega 2560 both are selected as a microcontroller.
  • Arduino UNO is attached to the sensor unit and Arduino Mega 2560 is attached to the base unit.
  • Arduino is an open-source device. Students can take online help in almost every task. Online source codes are also available for different tasks.
  • So, a student can easily perform them with a proper understanding.
  • Arduino boards are also not available in Proteus so you should download this Arduino Library for Proteus.

GPS Module

  • GPS module is used to locate the exact location of the fault.
  • GPS module will be attached to Sensor Unit, so if anything goes wrong then we can also get the GPS location via SMS.
  • It will provide us the longitude and latitude of the fault that occurred on the sensor unit.
  • So, now if any of these sensors goes wrong then you can easily get the location of your sensor node via SMS.
  • Proteus doesn't have GPS Module in it so you should download this GPS Library for Proteus.

GSM Module

  • GSM module is used for security purposes.
  • If a fault occurs at any position within the network, a notification message will be generated and sent towards the base unit from the sensor unit.
  • We can also generate a call using this GSM which will be a much better way.
  • This GSM module will also send the location via SMS. We have received this location from GPS in the form of longitude and latitude.
  • Proteus doesn't have GSM Module in it so you should download this GSM Library for Proteus.
So, these are all the components/modules, which I have used in this project. So, in the first part, have seen the basic Introduction of the project and then in the second section, we have had a detailed overview of all the modules used. So, now in the next section which is the third part I am gonna show you How to design these Proteus Simulations.

Proteus Simulation of Security Control System

In this section, we are gonna have a look at how to design these Proteus Simulations for Real Time Security Control System using XBee and GSM. As you know, I have used Arduino so we also need to discuss the code in order to run these simulations. So, first, we will design the proteus simulations and then we will write its code.

Proteus Simulations

  • I have designed two simulations for this project.
  • First of all, what you need to do is to download all those above Proteus Libraries and add them properly.
  • I have given detailed instructions in each post about How to use them.
  • After adding all these Libraries, now restart your Proteus software and design a circuit for the Sensor Unit.
  • Proteus Simulation of Sensor Unit is shown in the below figure:
  • As you can see in the above figure, the Sensor unit consists of three different sensor modules, which are:
    • Temperature sensor.
    • Smoke sensor.
    • Flame sensor.
  • In this unit, Arduino UNO is used as a microcontroller to get data from all the sensors and this data will be transmitted wirelessly towards the base unit for proper monitoring.
  • XBee module is used for wireless communication between the sensor unit and the base unit.
  • GPS module is interfaced in order to locate the exact position of the fault that occurred in the system.
  • Now we are gonna design our second simulation for the Base Unit.
  • The Proteus Simulation of Base Unit is shown in the below figure:
  • The base unit is basically a monitoring end of the system.
  • All the data obtained from the sensors is transmitted by the sensor unit towards the base unit.
  • The base unit has an Arduino Mega 2560 as a micro-processing unit.
  • Just like the sensor unit, an XBee module is also attached to the base unit in order to receive the data wirelessly sent by the base unit.
  • There is an LCD on the base unit. It is used to visualize the obtained results. It displays different messages e.g. fault detection, sensors data etc.
  • GSM module is used in the base unit to send the notification if a fault occurs in the system or the system is showing some abnormal behavior even for an instance.
  • This GSM module will also send the location in SMS. You have to enter the number of recipients in the programming code.

Arduino Code of Security Control System

  • When you download this project, you will get a .rar file and within that file, you will find two folders.
  • One of them will have the Arduino Codes and the other one will have Proteus Simulations.
  • I have already added all the hex files so you just need to run these simulations.
  • If you got into any trouble then use our Contact Form and our team will help you out.
  • You should also need to read How to Get the hex file from your Arduino Software.

Proteus Simulation Results

  • Now coming towards the last section of this project, now I am gonna show you the results of these simulations.
  • So, I have run both of these Simulations and here's the first look at Base Unit:
  • The LCD on the base unit is displaying the title of our project.
  • Virtual Terminal is connected with Arduino so that we could also have a look at incoming or outgoing data.
  • After that first of all, Arduino will communicate with the GSM module and will set its settings, as shown in the below figure:
  • Now our GSM module has configured, so the next screen of the base unit is shown below:
  • As you can see in the above figure that LCD is displaying the values of all three sensors and because all are normal that's why the Alarm is OFF.
  • The temp value is 0 because we haven't yet received the data from the sensor unit.
  • Now let's run our Sensor Unit and make our Fire Sensor HIGH, then you will get results as shown in the below figure:
  • The alarm is also ON in the above figure and SMS has also been sent which is shown in Virtual Terminal.
  • In case, when both fire and smoke are detected, LCD will display smoke as well as fire detection messages.
  • SMS will also be sent as you can see in the Virtual Terminal. GSM has sent the message indicating Fire Detected and GPS Location.
  • Base Unit Proteus Simulation is shown in the below figure:
  • So, whenever you change any of these sensors' values in the Sensor Unit then the respective value will change in the Base Unit.
So, that was all about Real Time Security Control System using XBee and GSM. If you got into any trouble then ask in the comments and I will help you out. Thanks for reading, take care and have fun !!! :)

Interfacing of GPS Module with Arduino in Proteus ISIS

Hello Everyone, hope you all are fine and having fun with your lives. Today, I am going to interface GPS Module with Arduino in Proteus ISIS software. Recently, I have shared this amazing GPS Library for Proteus, using which you can quite easily simulate your GPS Module in Proteus software. Today, I am going to interface this GPS Module with the Arduino UNO board and will simulate the result in Proteus software. I am going to use TinyGPS Library and will get Longitude and Latitude out of this GPS Module.

So, if you are new to GPS and you haven't yet installed the GPS Library for Proteus, then you must first download that library and install it. I am using Arduino board in today's tutorial but you can use any other microcontroller as well like PIC Microcontroller or 8051 Microcontroller. So, let's get started with the Interfacing of GPS Module with Arduino in Proteus ISIS. I have explained this project in detail in the below video:

 

Interfacing of GPS Module with Arduino in Proteus ISIS

  • You can download the complete Simulation along with Arduino Code by clicking the below button, but as I always suggest, design it on your own so that you learn the most out of it.
Download Project Files
  • So, design a simulation in your Proteus software as shown in the below figure:
  • As shown in the above figure, I have used Arduino UNO along with GPS Module.
  • I have used a Virtual terminal to show values getting from the GPS Module.
  • So, I am getting data from the GPS Module via the RX pin of Arduino and then sending this data to Serial Terminal via TX pin.
  • Now, the next thing you need to do is to upload the below code to your Arduino board:
#include <TinyGPS.h>

TinyGPS gps;  //Creates a new instance of the TinyGPS object


void setup()
{
  Serial.begin(9600);  
  Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
  Serial.println("Testing GPS");
  Serial.println("Designed by: www.TheEngineeringProjects.com");
  Serial.println();
}

void loop()
{
  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;)
  {
    while (Serial.available())
    {
      char c = Serial.read();
      //Serial.print(c);
      if (gps.encode(c)) 
        newData = 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);
    Serial.print(" Longitude = ");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);

  }
 
  Serial.println(failed);
 // if (chars == 0)
   // Serial.println("** No characters received from GPS: check wiring **");
}
  • Now Get the Hex File from Arduino software, and upload it to your Arduino board.
  • Now run your simulation and if everything goes fine then you will get results, as shown in the below figure:
  • Now you can see in the above figure that we have our Latitude and Longitude.
  • This Latitude and Longitude will not change because we have added the dummy values in our GPS module.
  • So, that's how you can quite easily simulate your GPS module with Arduino in Proteus ISIS.

If you have any questions then ask in the comments and I will try to resolve them. Take care. :)

GPS Library for Proteus

Hello friends, hope you all are fine and having fun with your lives. In today's tutorial, I am gonna share another awesome library designed by our team for Proteus, which is GPS Library for Proteus. It's my second library for Proteus, the first one was Arduino Library for Proteus which I have already shared. I am really enjoying designing these modules in Proteus because its a new and quite challenging thing. I haven't found even a single website who has designed these modules in Proteus already. So, now for the first time, you can have the GPS Library for Proteus using which you can easily simulate your GPS module in Proteus and can design your code for Arduino, PIC Microcontroller or 8051 Microcontroller.

Other bloggers are welcome to share this library and its my humble request that do mention our blog in credits. :) The GPS module, I have designed for Proteus is a simple GPS which has TX and RX pins and when you start the simulation, this module starts sending the NMEA data on its TX pin, which you can easily check using Virtual Terminal. I am gonna show you how to check it in today's post. Another important thing, obviously in Proteus Simulation we can't get the actual values of longitude,latitude etc, so in our model, I have used the dummy values for all these data. The benefit of this module is that you can easily design your code for GPS and can test it in your simulation. Plus, its design is cool as well. ;)

Note:

GPS Library for Proteus

  • First of all, click on the below button and download GPS Library for Proteus.
GPS Library for Proteus
  • After downloading, you will get a zip file containing three files in it.
  • Now extract all these three files named as:
    • GpsTEP.LIB
    • GpsTEP.IDX
    • GpsTEP.HEX
  • Place these files in Libraries folder of your Proteus software.
Note:
  • Now open your Proteus software, if you have already opened it then restart your Proteus software.
  • Now in components list search for GPS Module and place it in your workspace.
  • If everything's fine then you will get your module as shown in below figure:
  • As you can see in the above figure, it has two pins in total which are TX and RX.
  • Now double click this GPS module and you will get to its properties as shown in below figure:
  • Now, one last thing you need to do is to upload the GpsTEP.HEX file, which you got in the downloaded zip file, in the Program File section.
  • This GpsTEP.HEX file is essential for this model as its adding the functionality of GPS in this model.
  • So, after adding the link of GpsTEP.HEX file in the Program File section, now your Gps module is ready to use in your circuit.
  • So, now let's add a Virtual terminal and check the output of this GPS Module. If you haven't worked on Virtual Terminal before then you should read How to use Virtual Terminal in Proteus ISIS.
  • Design a small circuit as shown in below figure:
Note:
  • The baud rate of this GPS Module is 9600.
  • The data sent by this GPS module is dummy as we can't get these values in simulation.
  • Now let's run the simulation and check the Virtual Terminal and if everything goes fine then you will get results as shown in below figure:
  • The first line is just the intro for this module and after that you will start receiving data which is in NMEA format.
  • NMEA data will remain constant but will keep on coming.
  • Now, instead of using this Virtual Terminal, you can use any microcontroller here like Arduino, PIC Microcontroller or 8051 Microcontroller etc. and can write your code easily and test it.
  • In my coming tutorials, I am gonna share examples for this GPS module in which I will interface it with different Microcontroller.
  • In the below video, I have explained this tutorial again so if you got any trouble then watch it as well.
That's all for today. You should also have a look at Interfacing of GPS Module with Arduino in Proteus ISIS. I hope you guys have enjoyed today's post and are gonna get benefit from it. Let me know your views about today's tutorial and also give your suggestions and help us in making this GPS Library for Proteus more smarter. :)
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir