1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

GPS Data tracker for antenna aiming

Discussion in 'Oshonsoft' started by camerart, Apr 7, 2014.

  1. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    Hi,

    I am hoping to make a tracker that will aim antennas towards the signal, based on GPS, NMEA, AIS etc signals. This project is a bit beyond me unless I get helps for experts in different fields.

    1/ Receiving the incoming signals, receivers and antennas I can figure out.
    2/ Parsing, decoding and computing the signals is beyond my skills, although I have been reading up on it. This mainly includes NMEA data.
    (For information: NMEA data is sentences similar to: $GPGLL,4916.45,N,12311.12,W,225444,A,*1D which is sent from many vehicles etc. This example carries Location and time, but others carry more.) The code is not in Oshonsoft, and hope it can be converted, as this is what I use.

    3/ I am ok with the building and mechanics of the tracker.

    I hope to be able to use a 16F648A or 16F886 PIC if possible, and a Ublox GPS. I use Oshonsoft for programming and simulation.

    The tracker could be used to follow ships, satellites, multicopters 'radio fox hunting' etc.

    I hope it is of interest.

    Cheers, Camerart.
     
    Last edited: May 7, 2014
  2. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    Deleted as not relevant.
     
    Last edited: May 7, 2014
  3. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    Hi, Comrade.

    Could you edit your post so that the code is in the CODE=C tags:

    CODE=C
    .. your code, properly indented
    /CODE

    Put the tags in square brackets, so they take effect, like this: [TAG]

    About the project: Did I understand correctly that you have two (GPS) locations and you want to calculate a (compass) heading from one location to the other? Do you need help with the math, or just with coding the PIC? (or both)
    Math: http://www.movable-type.co.uk/scripts/latlong.html
     
    Last edited: Apr 8, 2014
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.

    Hi Mister T,

    The code I attached is in 'C' , but I don't know anything about 'C'. All I did was cut and paste it into post #2. The assembled code is also on the http://www.elektroniksforkids.com/projects page. I might have to blindly use this, but I won't understand it unless it is in Oshonsoft Basic.

    I am hoping to make a circuit, with PIC and LCD that will show the streamed sentence. (This is sent from satellites etc) This sentence tells you where it is sent from plus the time. A calculation between the received data and your position, then shows where it is. Thanks for the link you sent, but later on in the project, I'm hoping to find someone to help with the calculation to put onto the PIC (This is quite complicated)

    Cheers, Camerart.

     
  6. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    You didn't exactly answer any of my questions, but I think I know what you are after. I have not used oshonsoft or much PICs, so I'm not able to help you with the basics, but I can help with the math when you get there. And I don't bother reading your code until it is properly formatted in the CODE tags.

    Did you try? If you understand Basic, then understanding C code should not be that difficult.

    I don't think that the "sentence" is sent from satellites. The sentence is calculated and put together by GPS receiver.. then you need some communication method to send that sentence (location and time information) from the receiver to the PIC. What is the communication method you will use?

    And by "where it is" you mean a compass bearing from your position to the target position, right?

    I can certainly help to program the calculations once you get the basic "infrastructure" working.
     
    Last edited: Apr 9, 2014
  7. skimask87

    skimask87 Member

    Joined:
    Mar 23, 2014
    Messages:
    128
    Likes:
    10
    Location:
    Logan (Minot), ND
    Sounds like it's a good time to expand your programming knowledge overall.
    The part I especially enjoy is "All I did was cut and paste it into post #2". Now that takes effort.

    We all know (well, we all should know) what GPS is and how it works.
    And this project is not "quite complicated", not complicated at all. Getting the code to fit into a 16F648 will be complicated though....like fitting 6 gallons of water in a 5 gallon bucket.

    And without a heading input, the whole thing is practically useless when stationary.
     
  8. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
     
  9. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    I apologise for my limitations! I can assure you, that I spend many hours and will continue to, trying to understand and this project work, and for me it is very challenging.

    I don't think this should be called GPS, as it isn't to show where you are exactly, but to aim and antenna.

    Can you suggest a 6-10 gallon bucket (PIC chip) please. It needs UART, LCD enough pins, and as you say enough space for the code. I have the basic Oshonsoft program, but of course if necessary I can upgrade.

    Cheers, Camerart.
     
    • Like Like x 1
  10. skimask87

    skimask87 Member

    Joined:
    Mar 23, 2014
    Messages:
    128
    Likes:
    10
    Location:
    Logan (Minot), ND
    Then I guess you don't need the GPS module, nor the code to resolve the NMEA sentences...do you?

    Sure, I can suggest roughly more than 1/2 of the entire Microchip selection of microcontrollers.
    http://www.digikey.com/product-sear...dded-microcontrollers/2556109?k=microchip pic

    But first, you have to learn how to use the CODE tags as mentioned above...
    and again, if you're just going to cut-and-paste and expect the rest of the world to do the dirty work...well...
     
  11. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    Hi skimask87,

    To clarify: I do need a GPS module, as it sends me the NMEA data, with it's location 'sentence' or I could aim directly at one of the satellites the GPS uses, and get the satellite location 'sentence'. It's these sentences I'm hoping to use. Sorry if I mislead you.

    I'll look for a more suitable PIC, can you tell me your guess of the code memory size, to help my selection please?

    Cheers, Camerart.
     
  12. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    Could you explain this more. Why would you locate satellites? I don't understand how this would help to find out in what direction your "object" is? And how can you "aim" to a satellite, if you do not know where it is..?
     
  13. skimask87

    skimask87 Member

    Joined:
    Mar 23, 2014
    Messages:
    128
    Likes:
    10
    Location:
    Logan (Minot), ND
    The sentences won't tell you where a particular satellite is at any particular point in time. You would have to calculate that from the orbital data, AND, compensate for the lag between receiving said data and processing it as such.
     
  14. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    Hi MisterT,

    Firstly, I'm new to this and open to correction!

    The tracker will follow the source of the NMEA sentence. These sentences can be transmitted from many sources, satellites, vehicles, animals, RC models, with a GPS sending out 'sentences', in fact it's open to ideas what you would like to track. There are different 'sentences' that can give location, time, direction, height, speed etc in ASCII form.

    Some of the things are interesting to track don't have strong signals, so it's good to aim the antenna. To start the operation, either a guess, a known location perhaps from tables, or calculation can be got from the web or scan for a signal.

    Say you are tracking a satellite. First you would have to have some idea where it is, until a location sentence is received, then the tracker will take over. Some satellites are used to communicate by radio.
    Say you are tracking a radio control model, you can aim the antenna while it is in sight, then as it goes away, the tracker follows it. Some of these models have video sent back to 'base' and these signals tend to be difficult in certain circumstances, that are improved by a tracker.

    I have drawn a mock up of a tracker, to give you an idea.

    I hope this helps you understand, but ask anything.

    Cheers, Camerart.
     

    Attached Files:

  15. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    I think I know what you are talking about, but you are just all over the place.. try to keep it simple.

    What I understand about the system you are trying to build is:
    - You know your own location.
    - There is a flying object somewhere.
    - The flying object has a GPS receiver which calculates the location of itself.
    - The flying object sends its location to you.
    - You want to calculate the bearing (and elevation) to the flying object so that you can aim an antenna to it.

    .. did I nail it or did I miss something..?
     
  16. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    Yes, (keeping it simple) that's correct, you nailed it.
     
  17. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    Hi,

    I have connected a GPS to a PIC with LCD, and the program below shows changing single digits on the LCD. With WAITMS 100, the numbers change for a second, then stop at $. Can anyone suggest how to get the full sentence from the GPS please?

    Camerart.


    '16f684A xtl

    Define CONF_WORD = 0x3f41 'XTL
    Define CLOCK_FREQUENCY = 4 'Changed from 12
    AllDigital

    'Define SIMULATION_WAITMS_VALUE = 1 'SIMULATION ONLY
    '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    TRISA = %00000000
    'TRISA.0 = 0 'Pin 17 as RLED
    'TRISA.1 = 0 'Pin 18 as SPARE
    'TRISA.2 = 0 'Pin 1 as RS
    'TRISA.3 = 0 'Pin 2 as R/W If Define LCD_READ_BUSY_FLAG =

    0 then R/W can be connected to GND.
    'TRISA.4 = 0 'Pin 3 as E
    'TRISA.5 = 0 'Pin 4 as SPARE
    'TRISA.6 = 0 'Pin 16 as XTL clock
    'TRISA.7 = 0 'Pin 15 as XTL clock

    'port B
    TRISB = %01000000
    'TRISB.0 = 0 'Pin 6 as SPARE
    'TRISB.1 = 1 'Pin 7 as GPS RX
    'TRISB.2 = 0 'Pin 8 as Not used wrong voltage TX
    'TRISB.3 = 0 'Pin 9 as SPARE
    'TRISB.4 = 0 'Pin 10 as LCD D4
    'TRISB.5 = 0 'pin 11 as LCD D5
    'TRISB.6 = 0 'Pin 12 as LCD D6
    'TRISB.7 = 0 'Pin 13 as LCD d6

    Dim i As Byte

    '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    Define LCD_BITS = 4 'For 4 pins not 8
    Define LCD_DREG = PORTB
    Define LCD_DBIT = 4 'For 4-7 bits
    Define LCD_RSREG = PORTA
    Define LCD_RSBIT = 2
    Define LCD_RWREG = PORTA
    Define LCD_RWBIT = 3
    Define LCD_EREG = PORTA
    Define LCD_EBIT = 4
    Define LCD_READ_BUSY_FLAG = 1 'Possibly connect to ground

    instead?
    Lcdinit

    loop:
    Serin PORTB.1, 9600, i
    'Serout PORTC.6, 9600, "Number: ", #I, CrLf
    'Serin portc.7, 9600, i
    'Serout portc.6, 9600, "Number: ", #i, CrLf

    Lcdcmdout LcdClear
    Lcdout "WORKING"
    Lcdcmdout LcdLine2Home
    Lcdout "(", i, ") = ", i '#data
    'Lcdout "TEST"
    Toggle RA1
    WaitMs 1000
    Goto loop
     
  18. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    Hi, 16F886 with XTL.

    I am working through a program, and have a couple of points in it with question marks. Define LCD_LINES. I'm using a 4X20 LCD, so do I write 4 or 2? I've seen Define LCD_COMMANDUS = 2000 and Define LCD_DATAUS = 50, in other programs, are they needed for Oshonsoft? And SERIN, SERIN2 and HSERIN I'm still trying to find out which of these to use. These are varyations of what I've been trying! Am I getting anywhere near? Serin PORTB.1, 9600, latdeg
    'Hserin $gprmc,(","), 'dec2 hh, dec2 mm, wait(","), fix,

    Camerart
     
  19. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    I have been advised to choose one source of NMEA data, to make things less complicated. At first I chose to track my multicopter models, but I now think it will be better to choose to track satellites, as they are more predictable, slow and probably have more people interested. I can modify things later once I get the tracker working ok

    Camerart.
     
  20. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi,
    Why would you want to track a GPS satellite, as the serial output of the $GSV message already contains the ID, Azimuth and Elevation of the satellite???

    Just read read the $GSV string

    Eric
     
  21. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,423
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,

    The purpose of the tracker is to follow NMEA data sentence SOURCEs, and many of them don't have $GPGSV. Even though, as I've said, it might be better to follow Satellites at first, later it will have the calculation for more uses, such as multicopters etc. I think the most likely one is $GPGGA, as it has LAT,LON and ALT this seems to be quite common, but I'll find out more.

    C
     

Share This Page