Jump to content
Mr_Fid

GPS Speedo

Recommended Posts

Hello

Thought I would just add a post, to say thanks for your knowledge and help,

I brought a couple of GPS modules a while ago and have been working on a few projects using them, Any way to cut a long story short I have now finished one of the projects and it works well.

It is a GPS Speedo and altimeter, and a clock! Not sure how good the altimeter will be but I will find out! And what’s it for??? Well my latest hobby is flying (crashing) paramotors.

If any one wants more details including the source code them I am happy to share that.

PIC 16F648A

Using internal 4Mhz Oscillator and taking in the RS string from the GPS. Convert the Knots to MPH, Add an hour to the Time and send it all to a LCD with the Altitude.

Sharing this project with you lot might get more of a response than the “That’s nice dear” from my women!!

Take care

Martin

IMG_4695s.JPG

IMG_4697s.JPG

IMG_4700s.JPG

IMG_4705s.JPG

IMG_4709s.JPG

Share this post


Link to post
Share on other sites

Very nice work and thanks for offering to share the project. Some FPV'ers have used LCD's in the cockpit for a realistic flying experience. Just imagine what could be created with a micro sized color TFT graphic display.

Share this post


Link to post
Share on other sites

i suggest adding a few switches so you can:

calibrate the altimeter at ground,

zero peak hold speed,

and change the gps time to local time,

I have been thinking about exactly the same project for a while,

neat display, I have some super tiny 16x2 led on stock from powertip

so I can make one also :-)

think about the speed and height to be displayed in several scales,

so it can be used world wide if you consider sharing or selling it.

Share this post


Link to post
Share on other sites

Hello

Just a quick question for ThomasScherrer.. i have had a search for calculating checksums, but i dont get it, can you explain how i would calculate a check sum for the 411?

i would like to turn off some of the unused strings

Share this post


Link to post
Share on other sites

well I just use a PC program called OSD Configuration by mark harrris,

it has a feature/function to calculate GPS NMEA checksums,

I dont know if the program is avail online to download ?

else just write him a PM

update:

http://www.intelligentflight.com/Solution.IFOSD.aspx

just download the PC program, it have a GPS checksum calculator that is easy to use.

Edited by ThomasScherrer

Share this post


Link to post
Share on other sites

/*

            Let message to be the array of bytes to be sent by the transport.

            Let msgLen be the number of bytes in the message array to be transmitted.

            Index = first

            checkSum = 0

            while index < msgLen

            checkSum = checkSum + message[index]

            checkSum = checkSum AND (210-1).

             */

            string message = textBox1.Text;


            int checkSum = 0;

            

            for (int i = 1; i < message.Length; i++)

            {

                checkSum ^= (int)message[i];

            }

I also have it as a standalone program

Share this post


Link to post
Share on other sites

Hello Mark,

Thanks for your reply, and sorry it's taken so long to reply! (been busy)

Thanks again Martin

Share this post


Link to post
Share on other sites

OK here is the code!!

program Paraglider1 'this is a working program which reads 3 strings

dim Gstr as string[65] 'from a gps unit, it then converts Knots to MPH

dim KSpeed as string[4] 'adds an hour to the time, and formats the readings

dim MSpeed01 as char 'to display on a lcd in a cycle,

dim MSpeed02 as char 'first screen is Speed in MPH and alitude in Mtrs

dim MSpeed03 as char 'Second screen is Time hh/mm/ss 24hr clock

dim MSpeed04 as char '

dim mphspeed as word '

dim mphlcd as string[4] '

dim time01 as char 'First digit of the time string (hours tens)

dim time02 as char 'Second digit of the time string (hours unit)

dim time03 as string[2] 'Minutes saved as a string

dim time04 as string[2] 'Seconds saved as a string

dim time01c as char 'modified hours ten for GMT + 1hour

dim time02c as char 'modified hours units for GMT + 1hour

dim GAlt as string[4] 'Alitude

dim i as byte '

dim k as byte '

dim j as byte '

dim WriteFlag as byte '

dim display as byte 'selects which screen so show on LCD

dim counter as byte 'Selects how lond each screen is shown

Sub function ReadChr as byte 'loop untill the rs is ready

do

loop until Usart_Data_Ready <> 0

result=Usart_Read

end sub

sub procedure CopyGStr(dim start as byte, dim l as byte, dim byref txt as string[10])

dim y as byte

for y=0 to l

txt[y]=Gstr[start+y]

next y

txt[l]=chr(0)

end sub

main:

cmcon=0x07

trisa=0x00

portb=0xff

mphspeed = 0

display = 0

counter = 0

Lcd_Config(porta,1,0,7,6,portb,4,6,5)

usart_init(4800)

WriteFlag=0

Lcd_Out(1,1,"Waiting")

Lcd_Out(2,1,"No Fix!")

while true

do

i=ReadChr

loop until i=36

i=0

do

Gstr=ReadChr

if Gstr="*" then

i=0

else

i=i+1

end if

loop until (i=0) or (i=65)

'once the string has been read you need to check which string it is, i am interested in

'two stings, the first string is $GPRMC this holds the time and speed.

'the second string i am interested in is $GPGGA which holds the alitude

if (Gstr[2]="R") then 'must be the $GPRMC STRING

WriteFlag = 1 'set write flag

CopyGstr(44,4,KSpeed) 'copy whole string first (not needed now)

MSpeed01=Gstr[44] 'first number

Mspeed02=Gstr[45] 'second number or a "," if low number

MSpeed03=Gstr[46] 'third number or a "," if high number

MSpeed04=Gstr[47] 'Last digit

time01=Gstr[6]

time02=Gstr[7]

copyGstr(8,2,time03)

copyGstr(10,2,time04)

end if

if (Gstr[3]="G") then

Writeflag = 1

CopyGstr(51,4,Galt)

end if

counter = counter+1

if counter = j then

counter = 0

display = display+1

lcd_Cmd(Lcd_Clear)

end if

if display = 2 then

display = 0

end if

Share this post


Link to post
Share on other sites

second half, as its to long in one post!

'This is the calculation for Knots to MPH, there are two calculations

'depending on where the decimal point is. the calculation is only done when the

'display is correct ie it is showing the mph and not the time.

if display = 0 then

if MSpeed02="." then

mphspeed=((Mspeed01-48)*100)+((Mspeed03-48)*10)+(Mspeed04-48)

mphspeed=mphspeed*115

mphspeed=mphspeed/100

k=0

else

mphspeed=((Mspeed01-48)*100)+((Mspeed02-48)*10)+(Mspeed04-48)

mphspeed=mphspeed*115

mphspeed=mphspeed/100

k=1

end if

wordtostr(mphspeed,mphlcd) 'now convert it to a string for the LCD

end if

'This is the calculation which adds an hour to the time, it addsan hour then checks the

'value isnt ASCII caractor 58 (:), if it is 58 then you need to reset the hours units

'to zero and add an hour to the tens. again this routine is only done when the time is

'being displayed

if display = 1 then

time01c=time01

time02c=time02+1

if time02c=58 then

time02c=48

time01c=time01c+1

end if

end if

'now we have the display routines, the LCD is a small 8 * 2, j sets the number of times

'the display is looped this creats a delay so the time is only shown for about 4 seconds

'and the speed and altitude are show for about 14 seconds, there are two display routines

'for the speed depending on where the decimal point was, which was determined in the speed

'calulation above

if display = 0 then

j = 30

Lcd_Out(1,1,Galt)

if Galt[4]="," then

Lcd_Out(1,4," ")

end if

Lcd_Out(1,5," Mtr")

if (WriteFlag = 1) and (k = 0) then

if mphlcd[2] = 32 then

lcd_chr(2,1,"0")

else Lcd_chr(2,1,mphlcd[2])

end if

Lcd_chr(2,2,".")

if mphlcd[3] = 32 then

lcd_chr(2,3,"0")

else Lcd_chr(2,3,mphlcd[3])

end if

if mphlcd[4] = 32 then

lcd_chr(2,4,"0")

else Lcd_chr(2,4,mphlcd[4])

end if

Lcd_out(2,5," MPH")

Lcd_Cmd(Lcd_Cursor_Off)

end if

if (WriteFlag = 1) and (k = 1) then

Lcd_chr(2,1,mphlcd[2])

Lcd_chr(2,2,mphlcd[3])

Lcd_chr(2,3,".")

if mphlcd[3] = 32 then

lcd_chr(2,4,"0")

else Lcd_chr(2,4,mphlcd[4])

end if

Lcd_out(2,5," MPH")

Lcd_Cmd(Lcd_Cursor_Off)

end if

end if

if display = 1 then

j = 12

if WriteFlag = 1 then

Lcd_out(1,1,"Time ")

Lcd_Chr(2,1,time01c)

Lcd_Chr(2,2,time02c)

Lcd_out(2,3,":")

Lcd_Out(2,4,time03)

Lcd_Out(2,6,":")

Lcd_Out(2,7,time04)

end if

end if

WriteFlag = 0

wend

end.

_________________

EasyPIC4 user.

Share this post


Link to post
Share on other sites

please see the attached files,

I just made a very similar project,

this little thing can:

read out: speed, height, voltage, current, temperatures,

and max peak hold on all values,

also a logger, also a clock.

post-2735-1201694942_thumb.jpg

post-2735-1201694958_thumb.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×