Shop OBEX P1 Docs P2 Docs Learn Events
Reading inverted GPS data — Parallax Forums

Reading inverted GPS data

sylvie369sylvie369 Posts: 1,622
edited 2010-01-05 13:50 in Accessories
One of my ongoing projects is to read GPS data from a small receiver and send them directly out an XBee module to a Prop-based receiver. I've been able to get the XBee to get data from the GPS (currently a Byonics GPS2, though I expect to use something smaller once I get going seriously on the project), but I get gibberish on the screen. I've confirmed (by turning on/off the GPS) that what I'm getting is data from the GPS, but I haven't been able to read them intelligibly.

Today I hooked the thing up without XBees directly to a BS2sx on a carrier board, and managed to get the data to display properly. I learned that the data from the GPS are inverted, and I strongly suspect that's why I'm not able to read them on my terminal program when I try sending them straight through the XBee. As far as I can see, the XBee cannot be set to interpret serial data coming in as inverted (though you can change all the other stuff - the baudrate, bits, parity, stopbits). I'd hoped that I could just receive the data and invert them·in my terminal program, but that just gives me a different kind of gibberish.

My question:
I suspect that what I need to do is put an inverter circuit (well, chip - a 7404?) between the GPS data in line and the transmitting XBee. Does that sound right?

=====================
While I'm asking, maybe someone familiar with XBees can confirm my other assumption. They default to 9600 8N1 communications*, and since the GPS sends data out at 4800, I had to change the serial settings on the XBee connected to the GPS to 4800 8N1. That seems to work just fine. I assume that I do NOT have to change the default (9600) setting on the XBee that will receive the data, though - that it will simply receive the data at whatever speed, and can use 9600 8N1 to communicate with the terminal program on the receiver side. Does that sound right?

* That is, communications with the host, be it a terminal program or a microprocessor. I don't think that the baudrate has anything to do directly with how one XBee communicates with another, but of course that's what I'm asking about. Can one that's set to talk to a terminal program at 9600 baud receive data from another one that's set to talk to a GPS at 4800 baud?

Post Edited (sylvie369) : 1/4/2010 5:28:34 PM GMT

Comments

  • BeanBean Posts: 8,129
    edited 2010-01-04 19:32
    You could also just use a transistor to invert the signal.

    attachment.php?attachmentid=66427

    Bean.




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134
    240 x 181 - 3K
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-01-05 01:36
    I see. Wow, that's interesting - I think I understand how it works. Does it need any particular kind of transistor? Would that 2N3904 that comes with the Basic Stamp Activity Kit do the job?

    I did find a couple of ancient 7404s here, and after making sure that one still worked, hooked it up. I did get the data properly un-inverted (they showed up properly in a DEBUG window when I read them with my BS2sx using the non-inverted SERIN code), at least briefly. However, somewhere along the way it stopped working, quite possibly because these 7404s have been sitting around here since roughly the time that dirt was invented (I think they're the old vacuum-tube type of IC, and might even have gears in 'em).

    I see that the data from the Parallax GPS are not inverted - apparently inverted data is not a GPS standard, I guess. I'm expecting to put together a board for this device, and I guess I'm going to have to decide for sure which GPS I'll be using.



    Thanks.
  • kwinnkwinn Posts: 8,697
    edited 2010-01-05 02:49
    The 2n3904 would be fine.
  • SRLMSRLM Posts: 5,045
    edited 2010-01-05 04:01
    sylvie369 said...
    I'm expecting to put together a board for this device, and I guess I'm going to have to decide for sure which GPS I'll be using.

    If you want to put off deciding on a GPS (or want the flexibility), you could always include a jumper on the board that switches between uninverted and inverted data sources.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Powered by enthusiasm
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-01-05 04:04
    SRLM said...

    You could always include a jumper on the board that switches between uninverted and inverted data sources.
    Yes, that occurred to me, but I don't think I'll have to.

    Hopefully I'll have time to mess with this tomorrow.
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-01-05 13:50
    Okay, I just set up Bean's circuit, and it works perfectly. Thanks. Now to see if I can get it to work with the XBees.

    (10 minutes later: ) Hot dang! It works! It's pumping out NMEA strings from the XBee receiver to a terminal program even as I write. Very nice. Thanks.



    Oh, and that answers my second question. I was right in my assumption: the XBee on the receiving end does not need to have its serial communications setting at the same speed as the one talking to the GPS on the transmitting end. Those serial baud rates have nothing to do with one XBee talking with another. One is getting data from GPS at 4800 baud while the other is sending data to the terminal program at 9600 baud. No problem.

    Post Edited (sylvie369) : 1/5/2010 2:19:30 PM GMT
Sign In or Register to comment.