Sunday, 25 May 2014

GPS - Lets take a look at it....

What Is GPS ?






          The Global Positioning System (GPS) is a satellite-based navigation system that sends data from satellites orbiting Earth to GPS receivers on the ground that can use that data to determine position and the current time anywhere on Earth. You are probably already familiar with GPS navigation devices used in cars or on your cell phone.

GPS, Global Positioning System, is a system for determining location using satellites and some really complex math and general relativity.But regardless of how it works, it is really cool, and pretty inexpensive considering what it is doing. I found this video very helpful..,




           Although we can’t create detailed map navigation systems with our Arduino, we can use a GPS module to determine position, time, and your approximate speed (if you’re traveling). We’ll do this by using the GPS Receiver - EM-506.




            To use this receiver, you’ll need the GPS Shield for Arduino. This part includes the receiver, a matching Arduino shield, and the connection cable. Also with the LCD display to see the position of your location, lcd i always use is Standard LCD 16x2 display + extras or Basic 16x2 Character LCD



Ways of hooking up GPS with Arduino


As many know Arduino come with different varieties of sheilds making it easy for enthusiast to work on lot of platforms without any much trouble.... there is a standard GPS sheild available as i have mentioned... connecting this sheild with arduino is pretty simple and easy.. just connecting it directly above the Arduino boards which i recommend for new users..





Another ways of using this system is done usually by the most of advanced 1s are using a breakout board such as GPS breakout with the arduino... i also have attached the circuit detailing the GPS connection without any sheilds..
here is how its connected,
- 5v to Arduino 5v supply
- GND to Arduino GND
- Tx of breakout to PIN 2 of Arduino
- Rx of breakout to PIN 3 of Arduino


Testing your GPS 

After you buy the GPS kit, it’s a good idea to make sure that it’s working and that you can receive GPS signals. GPS receivers require a line of sight to the sky, but their signals can pass through windows. It’s usually best to perform this test outdoors, but it might work just fine through an unobstructed window or skylight. To test reception, you’ll set up the shield and run a basic sketch that displays the raw received data.
To perform the test,
1. First connect your GPS receiver via the cable to the shield(mentioned in previous step) , and then attach this assembly to your Arduino.
2. Notice the small switch on the GPS shield.

3. When it’s time to upload and run sketch on your GPS shield, move the switch to the DLINE position. Code for testing is attached below,
4. Then change it to UART and be sure to turn on the power switch for the receiver.
// Test code

void setup()
{
Serial.begin(4800);
}
void loop()
{
byte a
if ( Serial.available() > 0 )
{
a = Serial.read(); // get the byte of data from the GPS
Serial.write(a);
}
}
5. Once you’ve uploaded the sketch, move the data switch back to UART. Now check the LED on the GPS receiver that tells us its status. If the LED is lit, the GPS is trying to lock onto the satellite signals. After about 30 seconds the LED should start blinking, which indicates that it is receiving data from the satellite. After the LED starts blinking, open the Serial Monitor window in the IDE and set the data speed to 4,800 baud. You should see a constant stream of data similar to the output shown.


The data is sent from the GPS receiver to the Arduino one character at a time, and then it is sent to the Serial monitor. But this isn’t very useful as is, so we need to use a new library that extracts information from this raw data and converts it to a usable form. To do this,TinyGPS library detailed in next step is being used widely.

Creating a Simple GPS Receiver




Now let’s create a simple GPS receiver. But first, because you’ll usually use your GPS outdoors—and to make things a little easier—we’ll add an LCD module to display the data. To display the current position coordinates received by the GPS on the LCD, we’ll create a very basic portable GPS that could be powered by a 9 V battery and connector. Connecting GPS is very similar to that of the test circuit, to wire your LCD screen to your Arduino, connect the following pins:
LCD RS pin to digital pin 4
LCD Enable pin to digital pin 5
LCD D4 pin to digital pin 6
LCD D5 pin to digital pin 7
LCD D6 pin to digital pin 8
LCD D7 pin to digital pin 9



You can also use an an sheild to simplify the task, to learn more about LCD here in arduino website - http://arduino.cc/en/Tutorial/LiquidCrystal...
Here is the code attached to receive the latitude and longitude plots of your position. 
// Creating a Simple GPS Receiver
#include <TinyGPS.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );
// Create an instance of the TinyGPS object
TinyGPS gps;
void getgps(TinyGPS &gps);
void setup()
{
Serial.begin(4800);
lcd.begin(16, 2);
}
void getgps(TinyGPS &gps)
// The getgps function will display the required data on the LCD
{
float latitude, longitude;
//decode and display position data
gps.f_get_position(&latitude, &longitude);
lcd.setCursor(0,0);
lcd.print("Lat:");
lcd.print(latitude,5);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("Long:");
lcd.print(longitude,5);
lcd.print(" ");
delay(3000); // wait for 3 seconds
lcd.clear();
}
void loop()
{
byte a;
if ( Serial.available() > 0 ) // if there is data coming into the serial line
{
a = Serial.read(); // get the byte of data
if(gps.encode(a)) // if there is valid GPS data...
{
getgps(gps); // grab the data and display it on the LCD
}
}
}
After the sketch has been uploaded and the GPS starts receiving data, your current position in decimal latitude and longitude should be displayed on your LCD.
But where on Earth is this? We can determine exactly where it is by using google maps. On the website, enter the latitude and longitude, separated by a comma and a space, into the search field, and Google Maps will return the location.
Looking Ahead...
As you can see, something that you might have thought too complex, such as working with GPS receivers, can be made pretty simply with your Arduino. Even everything is pretty simple and cool guys.. Next instructable will be on GSM mobile system and its interface with Arduino....
Enjoy and have fun... more to come stay tuned.....
& Don forget to visit my facebook page - https://www.facebook.com/ELECTRONICS.MADE.SIMPLE

Post a Comment