Shop OBEX P1 Docs P2 Docs Learn Events
Help with using 433MHz Transcievers with the BS2 Stamp — Parallax Forums

Help with using 433MHz Transcievers with the BS2 Stamp

Slinkman44Slinkman44 Posts: 6
edited 2011-04-11 04:36 in BASIC Stamp
Hello, I am currently working on a school project and I need help. I am using two 433 MHz Transcievers with two basic stamps to try and get them to communicate with eachother. When I use the sample code in the documentation I seem to get random values that come up at random times in the debug terminal. I would apperciate it if someone could give me a brief introduction on how to program the transcievers to communicate with eachother on the BS2 stamp.

If I am posting in the wrong place I am sorry but I saw posts about the Transcievers all over the place.

Comments

  • shanebatyshanebaty Posts: 30
    edited 2011-04-04 17:40
    I actually had this same problem. I beleive all I did was change the lines *SERIN 0, N2400, ("!"), B3, B2, B5, B4* and *SEROUT 0, N2400, ("!", B3, B2, B5, B4)* I used a "W" instead of the "!". I am at work right now but when I get home I can look at my code and possible upload that part for you. I think it was just recieveing the 10101010 pattern from "noise"
  • shanebatyshanebaty Posts: 30
    edited 2011-04-04 17:42
    Sorry posted wrong example. i used a bs2 also, not bs1. I think you get the idea though.
  • Slinkman44Slinkman44 Posts: 6
    edited 2011-04-04 18:21
    Thanks I will definately try this once I can get back to my equipment. Unfortunately it must stay at school because the school owns the boards and stamps. Any other tips and programming examples that can be posted would be apperciated too. Thankyou again
  • shanebatyshanebaty Posts: 30
    edited 2011-04-04 23:51
    Ok this is was i was able to find in my programs.
    this first one is the receiving side.


    LOW 1 ' T/R Line
    DO
    LOW 0
    SERIN 0, 16468, [WAIT("!w"), x ]
    HIGH 0

    IF (x = 72) THEN Out_595F
    IF (x = 85 ) THEN Back
    IF (x = 41 ) THEN Lef
    IF (x = 22 ) THEN Righ
    IF (x = 54) THEN Cam
    LOOP
    STOP

    So it looks like i actually used "!w"

    here is a part of the transmit side

    x VAR Byte
    LR VAR Word
    UD VAR Word
    Main:

    DEBUG "still"
    x = 0
    HIGH 1 ' T/R Line
    DO

    PULSOUT 0, 1200 'Sync pulse for the receiver
    SEROUT 0, 16468, [ "!w",x]
    PAUSE 10

    HIGH 13
    PAUSE 2
    RCTIME 13, 1, UD

    HIGH 14
    PAUSE 2
    RCTIME 14, 1, LR
    IF IN4=1 THEN CamMain
    IF (LR > 700) THEN moveL
    IF (LR < 100) THEN MoveR
    IF (UD > 675) THEN MoveF
    IF (UD < 50) THEN MoveB
    LOOP

    MoveF:
    DO
    DEBUG "foward"
    x = 72
    HIGH 1 ' T/R Line
    PULSOUT 0, 1200 'Sync pulse for the receiver
    SEROUT 0, 16468, [ "!w", x]
    PAUSE 10
    HIGH 13
    PAUSE 2
    RCTIME 13, 1, UD

    HIGH 14
    PAUSE 2
    RCTIME 14, 1, LR
    PAUSE 10
    IF (UD<675) THEN Main
    LOOP

    Basically what this is doing is that it is constantly transmitting the value "0" unless certain conditions are met, then the transmitted value changes. also notice on the reciever side that it stays in loop and is always communicating with each other even when nothing is happening. I am sure there is a better way but i know this worked for me. Any ways hope this helps. sorry its so sloppy. it is bassically my code from a project for school i had to hurry and finish Because i ran into the same problem as you and once i got the code to work, i didnt clean it up much. haha
  • Slinkman44Slinkman44 Posts: 6
    edited 2011-04-05 17:20
    Ok I tried to fix it but now instead of random noise I get nothing. I am gunna put my code in here, It is just the standard code that comes in the documentation. I figured I should be able to at least get this working but it just doesnt seem to be cooperating.

    Sending
    ' Tcvr_TxCode_v1.1.bs2
    '{$STAMP BS2}
    '{$PBASIC 2.5}
    x VAR Word
    y VAR Word
    HIGH 1 ' T/R Line
    DO
    PULSOUT 0, 1200 'Sync pulse for the receiver
    SEROUT 0, 16468, [ "!w", x]
    x = x + 1
    y = y + 1
    PAUSE 10
    LOOP

    Recieving
    'Tcvr_RxCode_v1.1.bs2
    '{$STAMP BS2}
    '{$PBASIC 2.5}
    x VAR Word
    y VAR Word
    LOW 1 ' T/R Line
    DO
    LOW 0
    SERIN 0, 16468, [WAIT("!w"), x]
    HIGH 0
    DEBUG ? x
    DEBUG ? y
    LOOP


    Again any explinations tutorials or help at all would be apperciated. Thank you!
  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-06 19:49
    I don't understand why you have the LOW 0 before the SERIN and the HIGH 0 after the SERIN. I know the example shows this, but it doesn't make sense. At this point, you've set the transceiver to receive mode, so the data I/O pin from the transceiver should be outputting data.

    The bidirectional CRC examples do show a LOW Tx (like LOW 0) during initialization, but it precedes the LOW TxEnable (like LOW 1) so that, when the mode is switched to transmit later in the program, the state of the data line will be low initially.
  • shanebatyshanebaty Posts: 30
    edited 2011-04-06 23:23
    Maybe try putting
    x = 0
    y = 0

    right above the DO on the tx code

    and take out the

    debug ? y

    on the rx code

    And i know i was never able to get the sample code to work.
  • Slinkman44Slinkman44 Posts: 6
    edited 2011-04-07 21:14
    Thanks guys for your help. I spent most of today working with it and it did strike me as odd that the High 0 and LOW 0 would be placed before and after the SERIN command, so I tried it with out. I had no luck though. I also tried to use the download code that is also on the store page for this item and this did not work either. After pouring through different documentations I noted that the wavelength of this particular model was .69 meters (i think it was this number if not it was close). After finding this out I set the two units a little more than a meter apart but again to no luck. At this point I am worried that I blew out the CMOS chip that is on the transceiver seeing as that is a very sensitive chip to voltages.

    Is there any way to test to make sure the chip itself is not shot?
  • shanebatyshanebaty Posts: 30
    edited 2011-04-08 00:22
    I dont have any classes tomorrow so i can make simple code that i know that works for sure and send it to you. just let me know what pins you have everything set on
  • Slinkman44Slinkman44 Posts: 6
    edited 2011-04-08 04:42
    Awesome, Thanks.

    Pin 0 is data
    pin 1 is TX-RX
    pin 2 is PDN
    pin 3 is RSSI
  • shanebatyshanebaty Posts: 30
    edited 2011-04-09 12:29
    Sorry i dont have anything for you yet. i spent my day off of school in a doctors office instead. but im feeling much better today i should have something working for you by tomorrow so you can check and see if your transceivers are even working
  • shanebatyshanebaty Posts: 30
    edited 2011-04-11 00:25
    Okay here are 2 very simple programs that I have working for sure.
    First thing is that my pins are backwards in the program, that should be an easy fix.
    TX-RX pin 0
    DATA pin 1
    I do not have anything else plugged in.( Besides +5v and gnd of course)

    Next thing is that i made a simple switch on the Tx side using pin 15. just use a 220ohm pull down resistor and use a wire to plug and unplug from +5v as the "switch".

    Next... Well this is the easy part, just compile the programs into each of the basic stamp modules. I suggest doing the TX one first and then turn it off. After that, do the RX one and leave it plugged into the computer and you should see a debug terminal with nothing in it. Now go ahead and apply power back to the TX module and you should see 0's on the debug terminal for the RX. Once you plug the wire into the +5v (your switch), you should see the number 27, and then back to 0 once unpluged.

    Hope this helps!!!

    PROGRAMS

    TX

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    X VAR Byte
    TX CON 0
    LN CON 1

    MAIN:
    x = 0
    HIGH TX
    DO
    PULSOUT LN, 1200
    SEROUT LN, 16468, [ "!w",x]
    PAUSE 10
    IF IN15 = 1 THEN SEND
    LOOP

    SEND:
    x = 27
    HIGH TX
    DO
    PULSOUT LN, 1200
    SEROUT LN, 16468, [ "!w",x]
    PAUSE 10
    IF IN15 = 0 THEN MAIN
    LOOP





    RX

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}



    x VAR Byte
    TX CON 0
    LN CON 1
    DO
    LOW TX
    SERIN LN,16468,[WAIT ("!w"),x ]
    DEBUG ? x
    LOOP
  • shanebatyshanebaty Posts: 30
    edited 2011-04-11 00:31
    ONE MORE THOUGHT!!!
    Don't be afraid to change the code and try different pins on the stamp. You never know, the pins may be bad!!!
  • Slinkman44Slinkman44 Posts: 6
    edited 2011-04-11 04:36
    Thanks! My project is due tommorrow so this very much welcomed. I will work on this today and let you know if it works tonight. Thank you very much for all of your help!
Sign In or Register to comment.