PIC-PIC RF Comms


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429

    Default PIC-PIC RF Communication - Range of 1m ??

    Ive set up 2 16F84A's to talk to eachother via RF using a 433Mhz Trans/Recv pair running at 4800 baud.

    My code is below, but something must be wrong becuase the range is a mere 1m. Any further than 1m and it just doesnt work.

    Anyone have any ideas on what could be wrong?

    These are the data sheets of my RF units:
    http://www.altronics.com.au/download...eets/Z6905.pdf
    http://www.altronics.com.au/download...eets/Z6900.pdf

    Transmitter Code:

    Code:
    low PORTB.1                                 ' Initialise RB1
    
    start:
    Serout2 PORTB.1,16572,[$55,$55,$66,$95]     ' Transmit "$95"
    Pause 500                                   ' Wait
    Serout2 PORTB.1,16572,[$55,$55,$66,$99]     ' Transmit "$99"
    Pause 500                                   ' Wait
    Goto start                                  ' Repeat
    End
    Reciever Code:

    Code:
    recvd var word                              ' variable decrarations
    recvd=0                                     ' clear recvd
    low PORTB.0                                 ' turn off LED
    input PORTB.1                               ' set RB1 to input
    
    start:
    Serin2 PORTB.1,16572,[wait ($66),recvd]     ' wait for $66, then store data
    if recvd=$95 then High PORTB.0              ' if recvd=1 turn on LED
    if recvd=$99 then Low PORTB.0               ' if recvd=2 turn off LED
    goto start                                  ' loop
    
    end
    Last edited by Kamikaze47; - 3rd November 2005 at 15:23.

  2. #2
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Thumbs up Be more specific

    Can you qualify more the statement "it just doesnt work"?

    Does it not receive anything? garbage?

    The way you have it setup it will sit on "Serin2 PORTB.1,16572,[wait ($66),recvd]" until it receives $66. So you may want to have a timeout, and even here noise will probably cause the same problem (i.e. timeout will never occur).

    A quick look at the receiver module says it supports 4800bps and 3kpbs as maximum data rates (this in itself is contradictory). Even if it did support 4800bps for maximum rate you probably do not want to excercise this. Try 1200bps to begin with.

    This are just some ideas to get you going. There are many threads on RF comms here, search them as they have very useful information.

  3. #3
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Im not sure what its recieving once it gets past 1m. I dont have an LCD handy to send the recieved data to (I will pick one up tomorrow). Once its more than 1m away, the LED stops flashing, indicating that its not recieving the data that i am sending it.

    I'll try reducing the baud to 1200 and see what happens.

  4. #4
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Reducing the baud to 1200 improved the range a fair bit. At 5v I now get about 15m line of sight. At 12v, about 30m... Still a fair way short of the 100m these units are supposed to achieve, but not too bad.

  5. #5
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    Just for giggles, try increasing the number of $55s you send to..say 8. Next pick a more balanced header character like $AA. You can also put a small character delay using DEFINE (Maybe 1 mS). If this helps, you need more of a preamble to balance the data slicer.
    What are you using for antennas? Usually the companies range test their units with twelve element Yagis. Well, maybe not that bad, but the test data is usually taken in an optimum noise free environment with no multipath. These parameters don't exist on our earth, and you should probably halve most manufacturers range estimates. I've had to test most offerings in the OOK market, and upgraded to FSK for my more serious work, and better impulse noise immunity.

    Ron

  6. #6
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    For antennas Ive tried using 1/2 Wavelength and 1/4 Wavelengh bits of coathanger wire, and found the 1/4 Wavelengh (6.47 inches) to give better range.

    The reason I used $66 as a start character is becuase it is fairly balaced (same number of 1's and 0's). I will try $AA though, and will also try adding more $55s and see if it improves the situation.

    Thanks for the advice guys.

Similar Threads

  1. RF transmiter reciever using PIC
    By drama in forum mel PIC BASIC
    Replies: 5
    Last Post: - 4th October 2007, 16:26
  2. Generating RF from a PIC
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 26th January 2006, 20:26
  3. PIC to PIC serial comms
    By damiko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th July 2005, 17:40
  4. Pic to Pc Comms
    By Darrenmac in forum General
    Replies: 2
    Last Post: - 21st May 2005, 01:44
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts