Shop OBEX P1 Docs P2 Docs Learn Events
help for starting propeller with Parallax 433 MHz RF Transmitter and GPS — Parallax Forums

help for starting propeller with Parallax 433 MHz RF Transmitter and GPS

skybotskybot Posts: 14
edited 2008-12-10 10:52 in Propeller 1
Hi all,
I am a beginner for spin code and I am just starting to learn spin code.
What I want to do for my learning is·that reading GPS values and sending the GPS values to my pc via a 433 RF transmitter.
I have spin code sample for GPS but I do not have a code for the 433 RF Tx.
Does anyone know·a link to get the spin code for 433 RF Tx or have a sample spin code for 433 RF Tx?
Does anyone know how to capture·the live streams GPS data and pack data to Tx packet with spin code?
Please help me out.
Thank you.··
·

Comments

  • LeonLeon Posts: 7,620
    edited 2008-12-09 11:01
    Most of those 433 MHz units aren't all that suitable for sending data like that. It can be done, but it's complicated. You'd be better off with something using the 2.4 GHz Nordic RF nRF24L01 or the TI CC2500.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-12-09 11:38
    Hmm. I don't think it's all that complicated. Are you thinking about some odd non-Parallax 433 units? I assume he's talking about the sets that Parallax sells (which happen to be the daily deal...).

    There are a lot of things to send, but they're just bytes of data, and for the majority of GPS units, you're only getting one set of data per second. I put together a GPS/Parallax 433 transmitter on a BS2 stamp and a receiver with an LCD on a standard BS2 Homework Board last year, and it worked fine.

    skybot said...
    Does anyone know how to capture the live streams GPS data and pack data to Tx packet with spin code?

    You understand that's two separate questions, right? You'll read the GPS data into variables on your Propeller. Make sure that you can do that reliably, simply displaying them on an LCD or other terminal (TV, VGA) before you mess with transmitting them. For example, this little snippet from the GPS Smartmode object reads the data for time into six variables. Make sure you can get them and display them:

    Ser.str(string("!GPS"))                              ' Send GPS Command Header
      Ser.tx(GPS_GetTime)                                  ' Send GPS Command (GetTime)
      hrs := Ser.rx                                        ' Receive 1st byte
      mns := Ser.rx                                        ' Receive 2nd byte
      sec := Ser.rx                                        ' Receive 3rd byte
    
      Ser.str(string("!GPS"))                              ' Send GPS Command Header
      Ser.tx(GPS_GetDate)                                  ' Send GPS Command (GetDate)
      day := Ser.rx                                        ' Receive 1st byte
      mon := Ser.rx                                        ' Receive 2nd byte
      yy := Ser.rx                                         ' Receive 3rd byte, 2 digit year
    



    Then separately learn to send and receive byte-at-a-time on the 433 units using one of the serial objects (SimpleSerial or FullDuplexSerial). I don't have the code here now, but I had that set up with a Propeller and a 433 transmitter to send the data from a Wii Nunchuck controller to a 433 receiver connected to a BS2 and an LCD screen - that also worked fine, and that was certainly more data than you'd expect to send from the GPS.

    Post Edited (sylvie369) : 12/9/2008 1:37:33 PM GMT
  • LeonLeon Posts: 7,620
    edited 2008-12-09 13:14
    Yes, it depends on the units. NRZ might be needed.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-12-09 13:42
    Leon said...
    Yes, it depends on the units. NRZ might be needed.

    Leon

    The Parallax 433 units, at least, take care of the modulation stuff transparently. You don't even have to think about that kind of thing. Here is the entire code for transmitting and receiving with BS2 (from the documentation: comments removed):

    ' TxCode_v_1.0.bs2
    '{$STAMP BS2}
    '{$PBASIC 2.5}
    
    x VAR Word
    y VAR Word
    DO
    PULSOUT 8, 1200 'Sync pulse for the receiver
    SEROUT 8, 16468, [noparse][[/noparse] "!", x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE ]
    x = x + 1
    y = y + 1
    PAUSE 10
    LOOP
    
    
    'RxCode_v_1.0.bs2
    '{$STAMP BS2}
    '{$PBASIC 2.5}
    
    x VAR Word
    y VAR Word
    DO
    LOW 0
    SERIN 7, 16468, [noparse][[/noparse]WAIT("!"), x.HIGHBYTE, x.LOWBYTE, y.HIGHBYTE, y.LOWBYTE]
    HIGH 0
    DEBUG ? x
    DEBUG ? y
    LOOP
    
    



    It's just a matter of SERIN and SEROUT. Similarly on the Propeller it'll be just a matter of using the serial objects properly - slightly easier than on the BS2, in fact, because there's none of that messing with mysterious code numbers to set your baud rate. On the BS2 you get 9600 baud with that "16468" (and with different Stamp models you use different numbers). With the Propeller, you get 9600 baud with "9600".

    By the way, this code could be simpler if you were only sending one byte each time, as you would be with the GPS data. The demo code sends word-sized variables, one byte at a time (hence the "x.HIGHBYTE, x.LOWBYTE" stuff). If x and y were just one byte each, that'd say

    SERIN 7, 16468, [noparse][[/noparse]WAIT("!"), x, y]

    Post Edited (sylvie369) : 12/9/2008 1:49:46 PM GMT
  • skybotskybot Posts: 14
    edited 2008-12-10 06:30
    Thanks sylvie369,
    I have a question about your code that what x.HIGHBYTE and x.LOWBYTE does?
    What do HIGHBYTE and LOWBYTE mean?
    I used your code but I am get strange data.
    I am sending something like "-20 30 234" but getting them like "12343 13623 13332".
    Do you have any idea for that?
    Thank you for your help.
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-12-10 10:52
    HIGHBYTE and LOWBYTE refer, not surprisingly, to the high and low bytes that make up a word variable.

    x var word

    x = 515

    in binary, 515 = 00000010 00000011,
    so the HIGHBYTE (upper 8 bits) would be 00000010 and the LOWBYTE (lower 8 bits) would be 00000011.

    Debug DEC x.HIGHBYTE gives you "2" (00000010)
    Debug DEC x.LOWBYTE gives you "3" (00000011)

    Debug DEC x gives you "515"

    The 433 units can only send a byte at a time, so you send x.HIGHBYTE and then x.LOWBYTE - half of the number each time.

    As for "using my code", first of all, that code is not mine, but just the code from the documentation for the 433 units. Second of all, I can't tell what the problem is without seeing the actual code you're using. Since this is a Stamp question, not a Propeller one, you might want to post the question with the code attached over in the Stamp forum.

    Post Edited (sylvie369) : 12/10/2008 11:57:38 AM GMT
Sign In or Register to comment.