GPS Distance Meter

Somnath Bera

20425
 

Read ‘Arduino as AVR Programmer’ article for programming it with 8MHz internal clock. You can get it at https://www.electronicsforu.com/electronics-projects/hardware-diy/arduino-avr-programmer

An advantage of 8MHz internal clock is that it is easy to make connections on a piece of veroboard. Besides, its power consumption is not even 10mA on 3.3V supply.

Various operations are implemented in the code, and following header files are included in the library. Each header file has definitions for the library, while the source file has the actual code.

622
Fig. 6: Readings after pressing S2 (while it is kept pressed)
722
Fig. 7: Readings showing values of d and D

LiquidCrystal.h for LCD panel. This library allows the Arduino board to control LCDs based on Hitachi HD44780 (or a compatible) chipset, which is found on most text based LCDs. The library works within either 4-bit or 8-bit mode (that is, using four or eight data lines in addition to RS, enable and, optionally, RW control lines).

TinyGPS.h for GPS. TinyGPS is a new Arduino library for parsing NMEA data streams provided by GPS modules.

SPI.h. This is for connecting the SD card. This library allows you to communicate with SPI devices, with Arduino as the master device.

SDFat.h. Arduino SdFat library provides read/write access to FAT16/FAT32 file systems on microSD/SDHC flash cards.

Construction and testing

An actual-size PCB pattern for the GPS distance meter circuit is shown in Fig. 2 and its component layout in Fig. 3.

Switch on the GPS receiver and wait till PPS LED on parts list22the GPS starts blinking. Soon you will find latitude and longitude values flashing on the LCD. Get the readings stabilised on the LCD.

Press S2 and you will get instantaneous distance (d) and total distance (D) values on the third line of the LCD panel. For example, if distance from point A to B is 10 metres and from point B to C is 20 metres, total distance D will be 30 metres. The distance from A to B or from B to C is the instantaneous distance.

To measure the distance from point A to C, press S2 and keep it pressed till you reach point B. Release S2 to stop the measurement; d/D values (instantaneous/overall distance) on LCD will be shown as 10/10. The same values will be stored on the microSD card. Now, press S2 again till you reach point C. Release S2 and note the d/D values. You will see 20/30 on the LCD.

Finally, when all measurement readings are taken, press S3 to close the file and halt the system. Reset Arduino to restart the system. Author’s prototype is shown in Fig. 4.

The log file gets stored on the microSD card. Every time you start the device, it will create a new log file by the names data0.csv, data01. csv, data02.csv and so on as given below:

Sl Date Time Lattitude Longitude Dist. Dist0

0 20/3/16 23:1:18 24.088750 82.648200 0.0000 0.0000
1 20/3/16 23:1:21 24.088750 82.648200 0.0000 0.0000
2 20/3/16 23:1:24 24.088750 82.648200 0.0000 0.0000
3 20/3/16 23:1:29 24.088750 82.648200 0.0000 0.0000

EFY note: The project was tested at EFY Lab on Arduino Uno with an external 16MHz crystal and was found to be working well.

Download The Source Code: CLICK HERE

Download the PCB and component layout PDFs: CLICK HERE


Somnath Bera is an avid user of open source software. Professionally, he is a thermal power expert and works as additional general manager at NTPC Ltd

 

3 COMMENTS

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here