Shop OBEX P1 Docs P2 Docs Learn Events
Programming problem with GPS module — Parallax Forums

Programming problem with GPS module

SteveJSteveJ Posts: 13
edited 2011-12-05 05:59 in General Discussion
Hi all,

I'm having a fundamental problem programming my GPS module (28146) . A propeller is being used.

My program name is GPS_SmartMode_demoOct22.spin and is based on GPS_SmartMode_demo.spin that many people use with this module.
I was not able to get information back from the module. On power up, the module I/O pin goes to 5V. After the green LED flashed the second time, the I/O pin goes to 2.2Volts.
To try and help debug, I toggle a Green LED off and on at different points to check the progress of the code. The LED did not toggle after reaching either the "Ser.str(string("!GPS"))" or "Ser.tx(GPS_GetInfo)" line. Since GPS_GetInfo is all zeros, GPS_GetLat and GPS_GetLong were added in a repeat loop expecting that there would be a repeating stream of 1's and 0's. This was not the case. The voltage did not change from 2.2 V.


********************************************************************
PUB start(offset, allowDST)
_time_offset := offset
_allow_DST := allowDST

'Oct22 -- below lines are to toggle an LED that confirms this PUB is being used.
TurnOnGreenLED
waitcnt(clkfreq * 2 + cnt)
TurnOffGreenLED
waitcnt(clkfreq * 2 + cnt)

'' Initialize the GPS Smart Mode Object
tx := rx := 11 ' Set tx & rx to P11, GPS pin SIO
baud := 4800 ' Set baud to 4800 bps
Ser.start(rx, tx, 00, baud) ' Start Full Duplex Serial Object for GPS module
TurnOnGreenLED ' Toggles LED on scope
waitcnt(clkfreq * 10 + cnt)
TurnOffGreenLED
' Ser.str(string("!GPS")) ' Send GPS Command Header
' Ser.tx(GPS_GetInfo) ' Send GPS Command
repeat 'Oct 22nd -- entend to repeat data to GPS to confirm signal on oscilloscope
Ser.str(string("!GPS")) ' Send GPS Command Header
Ser.tx(GPS_GetInfo) ' No toggle on scope. Loops and does not exit
Ser.tx(GPS_GetLat) 'Oct 22nd -- send more data
Ser.tx(GPS_GetLong) 'Oct 22nd -- send more data
TurnOnGreenLED
waitcnt(clkfreq * 10 + cnt)
TurnOffGreenLED

********************************************

Attached is the GPS_SmartMode_demoOct22.spin, GPS_SmartModeOct23, and FullDuplexSerioalSJOct11 files.
I think I am making a fundamental error. Have had a similar problem with a compass module that has not been resolved.

All help is welcome.

Thanks,
Steve

Comments

  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2011-10-22 18:03
    The Propeller can't drive the I/O line of the 28146 high enough for it to (reliably) receive the !GPS instructions. Try a 3.3-5V level shifter between the Prop and GPS. There are some other threads in the forums that discuss this. Here's one:

    http://forums.parallax.com/showthread.php?109983-gps-with-propeller-really-weird-wrong-results&highlight=smart+mode+propeller+voltage

    To make it easier to troubleshoot go back to the original Spin sample and object. And note there's a documentation error in it. I recall it says the GPS is connected to P0, when it's really P7 (I'm going from memory here; that may not be accurate, but it's easy enough to check). The pin assignment is hard-coded into the object so if you want to change it you'll need to edit and resave the object file.

    -- Gordon
  • SteveJSteveJ Posts: 13
    edited 2011-10-23 14:22
    Hi Gordon,

    Thanks very much for the suggestions. I took your advice to go back to the original and also tried to keep it simple instead of adding an LCD for output, etc. Good news,
    the Propeller is now putting out a signal that I can read on my scope and a portion of the pattern is repeating. I have not been able to confirm that it matches what should be put out by the GPS commands, but, at least debug can start again.

    FYI ... I'm using a Propeller Robot Control Board (28230) that contains a voltage translator for the I/O's, so they are providing 5 V signals to the GPS module.

    Thanks again for the suggestions. I can continue to move forward now.

    Steve
  • SteveJSteveJ Posts: 13
    edited 2011-11-29 07:01
    Hi all,

    In case there is anyone interested, the problem is solved, but, still a bit of a mystery.

    Since I wanted to create a new board using the Propeller Proto Board USB, I simplified the debug by moving only the GPS to the new board first (the ultimate K.I.S.S). It worked like a champ within 10 minutes of debug. I also had problems getting a HMC6352 to function properly and it also worked within 10 minutes of being moved to the new board from the Propeller Robot Control Board. It's possible that it was related to the difference in the board, but, most likely an operator error.

    Steve
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2011-11-29 10:06
    I often find these things are related to the power to the board. Under battery power things work for 10-15 minutes, then stop, because the batteries lack capacity. Stop for an hour, return, and for a few minutes things function again because the batteries have had a chance to recuperate slightly. Eventually, things stop working completely when the batteries drain too far.

    I try not to use battery power for development, but when I do, I ensure a fresh set. This is pretty easy when using rechargeables.

    Batteries may not be your specific problem, but it's something to keep in mind when you have intermittent and/or time-delayed issues.

    -- Gordon
  • SteveJSteveJ Posts: 13
    edited 2011-12-04 10:16
    Thank for the suggestion Gordon. I've had that problem from time to time. Lately I've been using rechargable batteries with a DMM handy and extra batteries in the recharger.


    Now I've found a new problem. The GPS module is consistantly reporting values (and I'm happy with that). I wanted to test the accuracy of the module so I put down my robot (with power off to the motors) waited 5 seconds and recorded the reading. Then walked about 10 feet, put down the robot and made another measurement, continueing this for 80 feet. The latitude was a constand 37.38783 for 80 feet. I did a power cycle and the reading "jumped" to 37.38764 on the next reading. This is close to the 80 foot change that was expected.
    I was expecting the value to change more gradually. As an experiment, I reran the procedue doing a power cycle before every reading. Suprisingly, the readings changed by about
    .03 for each of the 8 readings. So the GPS will give more accurate readings as long as it is power cycled??
    This sounds odd to me. Any suggestions as to how to get the more accurate reading without power cycling?


    Steve
  • PublisonPublison Posts: 12,366
    edited 2011-12-04 10:47
    SteveJ wrote: »
    Thank for the suggestion Gordon. I've had that problem from time to time. Lately I've been using rechargable batteries with a DMM handy and extra batteries in the recharger.


    Now I've found a new problem. The GPS module is consistantly reporting values (and I'm happy with that). I wanted to test the accuracy of the module so I put down my robot (with power off to the motors) waited 5 seconds and recorded the reading. Then walked about 10 feet, put down the robot and made another measurement, continueing this for 80 feet. The latitude was a constand 37.38783 for 80 feet. I did a power cycle and the reading "jumped" to 37.38764 on the next reading. This is close to the 80 foot change that was expected.
    I was expecting the value to change more gradually. As an experiment, I reran the procedue doing a power cycle before every reading. Suprisingly, the readings changed by about
    .03 for each of the 8 readings. So the GPS will give more accurate readings as long as it is power cycled??
    This sounds odd to me. Any suggestions as to how to get the more accurate reading without power cycling?


    Steve

    Steve,

    As you probably know, the GPS module is only good for +/- 5 meter accuracy, (on a good day). At rest, my GPS will fluctuate about 100-200 ft. I get much better readings on the move. A lot has to do with varying condition, (cloud cover, trees).

    I suspect with your power cycles, you get more accurate readings due to re-calibration from the satellites, (my opinion, not fact).
  • SteveJSteveJ Posts: 13
    edited 2011-12-04 21:19
    Hi Publison,

    I did another experiment doing 20x power cycles from the same position. The numbers support your > +/- 5 meter value.

    Steve
  • max72max72 Posts: 1,155
    edited 2011-12-05 05:59
    It realy depends on the GPS. Some simply won't change lat/long reading if you move a little, or slowly.
    You should be able to set this feature.
    I find this feature annoying for my GPS usage, but it could be helpful for long time logging. Suppose you log your position while still. Every reading will have a small difference, and if you sum the total "traveled" distance you'll find the still GPS have walked and climbed a lot. In this case the GPS changing seldom the coordinates will offer a travel log more accurate.
    For a navigation/UAV project it is simply useless.
    Check the manual and see if you can modify the settings.

    Massimo
Sign In or Register to comment.