Shop OBEX P1 Docs P2 Docs Learn Events
Transceiver communication failure still not solved! — Parallax Forums

Transceiver communication failure still not solved!

Luis_PLuis_P Posts: 246
edited 2010-05-27 15:20 in BASIC Stamp
· This is cracking my head! a simple RF transciver remote control with only one button and is not working!! the problem is that external noises activate the receiver and get into "my code". I know there is some examples about checksum (error check) but is to complicate for a simple code like mine. Too bad Parallax doesn't provide and example to send one value and check for errors. My remote control use BS1 with Transceiver (transmitter) and Bs2 as a receiver. I use Bs1 because is small and cheap.
This is what I have so far. Please help!!!
·{$STAMP BS1}
··
SYMBOL x1 = B2 ' variable to send value
Check1:
· PAUSE 100
· IF· PIN2 = 1 THEN press1· 'bs1 button if is high then go and send value
GOTO Check1
··· press1:
··· x1 =·$A5
···· HIGH 5····'Vdd line on - Receiver on
··· PAUSE 200
··· HIGH 1· 'T/R line
··· PULSOUT 0, 300 'Sync pulse for the Transceivers
··· SEROUT 0, N2400, ("!", x1)· ' send value of x1 ($A5)
··· PAUSE 150
··· LOW 5····· '+ line off - receiver off
··· PAUSE 200
'====================================================

The Bs2 is connected to another transceiver the loop is waiting for a signal, when I press button on BS1 (pin2) is out of the loop and goes to my code. This is the code for Bs2:

' {$STAMP BS2}··
LOW 1 ' T/R Line
DO
· LOW 0
· SERIN 0, 16780, [noparse][[/noparse]WAIT("!"), x1]
· HIGH 0
· IF x1 = $A5 THEN GOTO Main_Code
·
LOOP

Main_Code:
··· 'My code goes here

Notes:
·Will be nice to know what [noparse][[/noparse]WAIT("!"), x1] means and how to add a simple error check that only my remote control can get out of the loop on the BS2.

Gracias!!

Post Edited (Luis_P) : 5/26/2010 3:37:10 PM GMT

Comments

  • bill190bill190 Posts: 769
    edited 2010-05-26 15:59
    On the receiver end, you can use the following...

    DEBUG x1

    (Stick that in after the "SERIN 0, 16780, [noparse][[/noparse]WAIT("!"), x1]" line.

    Then you will be able to "see" what is being received·at the receiver end.

    The value of x1 will be displayed on the debug screen.

    If you are getting a lot of garbage due to external noise, you can place the transmitter close to the receiver, then place aluminum foil on the sides and top of the two making a "tunnel" between the two.

    The aluminum foil would block external signals and the receiver should then be quiet except for the signals you send.

    Then you should be able to see if your basic setup on both ends is working or not.

    The aluminum foil "surround" is called a "Faraday Cage". More·on that here...

    http://en.wikipedia.org/wiki/Faraday_cage

    Once you see that your basic setup will work, then identify the problem(s), then you can go about finding a solution.
  • bill190bill190 Posts: 769
    edited 2010-05-26 16:05
    P.S. At the following link, first post, I discuss solving a similar problem with an IR Remote Extender for my satellite system. There are pictures at the bottom of my "Faraday Cages"...

    http://www.satelliteguys.us/free-air-fta-discussion/96677-modified-extended-remote-works-fta-receiver.html
  • Luis_PLuis_P Posts: 246
    edited 2010-05-26 19:29
    Well, Mike Green suggest to use a ceros and ones comparation (I think this is the rigth word)
    so if you send a HEX value $A5 wich is equal to 10100101 and $5A = 10110110 the result of comparing $5A and $FF (11111111)·is·equal to $A5·so using this as an error check will do the trick:
    ' 10100101 =·01011010 ^ 11111111
    ······ '$A5············'$5A············ '$FF

    'On the transmitter BS1
    SEROUT 0, N2400, ("!", $A5, $5A) ' send hex values

    "On the receiver BS2
    SERIN 0, 16780, [noparse][[/noparse]WAIT("!"), x1, x2]
    if x1 = (x2 ^ $FF) then ' See the manual for ^ (Xnor) and what does.
    if x1 = $A5 then
    Goto My_Code
    else
    'do nothing "ERROR" external noise getting into your code
    endif
    endif

    I WILL TRY THIS LATER TO SEE IF REALLY WORKS!! PARALLAX SUPPORT PLEASE CHECK THIS OUT!!!
    YOU NEED AND EXAMPLE LIKE THIS FOR THE TRANSCEIVERS!!!!

    GRACIAS!

    Post Edited (Luis_P) : 5/26/2010 10:11:45 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2010-05-26 19:52
    Small error:

    ' 10100101 = 10100101 ^ 11111111
    '$A5 '$5A '$FF

    should be

    ' 10100101 = (01011010 ^ 11111111)
    '$A5 '$5A '$FF

    Note that you don't have to use $A5. I picked this because it has the same number of ones and zeroes and because there are very few adjacent bits that are the same. Both things increase the likelihood that errors from noise pulses will be detected.
  • Luis_PLuis_P Posts: 246
    edited 2010-05-26 22:11
    I fix my error, thanks. Tomorrow I'll tell u if it works.

    Luis
  • Luis_PLuis_P Posts: 246
    edited 2010-05-27 15:20
    The error check is working very well until now. Hope that little piece of code help to prevent external RF noises getting between transciever communications.
    I'm sorprised that Parallax do not provide Mike's solution since many buyers will get this product to create remote control applications.


    Gracias! sorry for my broken English
Sign In or Register to comment.