PDA

View Full Version : RF link



n qwerty
- 4th February 2008, 21:40
im currently using a pic16f88 and have a rtfq1 (tx) and a rrfq1 (rx) and i simply want to transmit an identifier (so that the receiver knows it is data from the tx) and either a 1 or 0 on the end of the string to perform and action when a 1 is received at the other end, but im am new to this and need some help.

I have looked at Ioannis code for the manchester encoding, but i am kind of stuck. Any help would be greatly appreciated. Thanks

Ioannis
- 4th February 2008, 21:47
First of all, check if you have a good pin to pin link of the 2 PIC you are using and then move on to RF link.

Second, a schematic and your up to this moment code would be needed to debug your errors. As I stated in another thread, we cannot provide a solution in a plate...

Ioannis

n qwerty
- 4th February 2008, 21:50
how do you go about going from pic to pic then. I am planning to use the usart on the pic but dont really know how to use serial communications.

mackrackit
- 4th February 2008, 21:52
For sending
First the receiver needs "trained" by sending 01010101.....
Then send in this example "9" then the next character is used to do something.


TRAIN VAR BYTE

TRAIN=$55
SEROUT PORTC.4,T2400,[TRAIN,TRAIN,TRAIN,TRAIN,TRAIN,9,3]

For receiving


net VAR WORD
SERIN PORTC.4,T2400,[9],net
IF net = 3 THEN DO SOMETHING


This is the basics, when you get this working try for some type of encoding.

Ioannis
- 4th February 2008, 21:53
how do you go about going from pic to pic then.

Just put a wire from the transmitter pic to the receiver pic!


I am planning to use the usart on the pic but dont really know how to use serial communications.

Hmm, what projects have you already completed with success in PBP?

Ioannis

n qwerty
- 7th February 2008, 22:10
thanks for the advice, admittedly im not that experienced with pics but have done a couple of projects using them. Will try training the receiver and hopefully i get some good results.

mackrackit
- 8th February 2008, 04:24
The first step is to setup communications with wires, then go for the RF.

Ioannis
- 8th February 2008, 06:32
As macrackit stated, taken it easy. RF link is a medium to difficult project. Start by doing simple steps, one at a time.

Send one character from the Tx pic to the Rx pic with wires.

Then use some sort of encoding.

Then use some sort of CRC or Checksum stuff.

Then move on RF link.

All the above steps are well documented in the forum threads.

Ioannis

n qwerty
- 5th March 2008, 15:54
Using the FM-RTFQ1-433 transmitter and a FM-RRFQ1-433CTC receiver to send some data across a short range from one PIC to another. Using the code above

Tx code

include "modedefs.bas"

TRISA=%00000000
TRISB=%00001000

OPTION_REG.7=0 'Enable Pull-Up's on PORTB

ANSEL = 0 'turns off analogue inputs

OSCCON =$60 'sets internal osc to 4MHz

TRAIN VAR BYTE

PORTB.4 = 1 'turn enable pin high
TRAIN=$55

SEROUT PORTB.5,T2400,[TRAIN,TRAIN,TRAIN,TRAIN,TRAIN,9,3]

goto main

Rx code (part of)

test VAR WORD
SERIN PORTC.7,T2400,[9],test
IF test = 3 THEN

T1CON.0 = 1 ‘start timer module


When I try this code using a wire from pic to pic the timer starts but when I try to send the data over the rf link the timer doesn’t work. I can see the data out on the receiving module and I know rf is present since I have connected it to a spectrum analyser and there is a nice peak at 433Mhz. The pins have supply voltage and ground where required. Is there anything in particular that I am doing wrong in order to get the rf link to work?

Any help would be good since im getting stuck

Thanks

skimask
- 5th March 2008, 16:20
Is there anything in particular that I am doing wrong in order to get the rf link to work?

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvv

OSCCON =$60 'sets internal osc to 4MHz
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I might not know what's wrong...but I know what's probably not helping matters any...

n qwerty
- 5th March 2008, 16:35
yes, sorry my mistake.

I have taken that bit of code out but it still doesnt work.

Well, it does work occasionally when disconnecting and then connecting the power to the transmitting circuit, but it seems very unreliable that it may as well not work, but at least i no it is receiving data sent across the rf link. Is there something to make it more reliable. I have tried several different baud rates and pre ambles but nothing seems to make it more reliable.

thanks

mackrackit
- 5th March 2008, 16:37
I agree with Mr.mask. Lucky the internal osc works with wires, RF is even more touchy.

If changing the osc does not help, test the RF.

The 010101... is for setting up the receiver for serial input. Test the RF by sending a HIGH and then a LOW. Have maybe a half second pause between the signals.

dhouston
- 5th March 2008, 17:16
Using the FM-RTFQ1-433 transmitter and a FM-RRFQ1-433CTC receiver to send some data across a short range from one PIC to another. Using the code above the timer starts but when I try to send the data over the rf link the timer doesn’t work. I can see the data out on the receiving module and I know rf is present since I have connected it to a spectrum analyser and there is a nice peak at 433Mhz. The pins have supply voltage and ground where required. Is there anything in particular that I am doing wrong in order to get the rf link to work?
See p4 of the datasheet for the receiver. The RSSI pin outputs a voltage that is proportional to the received signal strength. This should be zero in the absence of a signal. You can use it with an ADC pin to determine when a signal is being received or amplify it and use it as a Carrier Detect signal.. Since these are FSK (i.e. FM), I would dispense with the TRAIN,TRAIN,TRAIN chain (personally, I dispense with it for ASK, also). What is the application?

EDIT: If you are not using the pins for something else, you can use one of the 16F88 comparators to create a CD (carrier Detect) signal. With the RSSI pin as one input and the other input to GND, configure the comparator so the output is high when there's a signal and low when there's no signal.

n qwerty
- 5th March 2008, 17:33
ok thanks for the advice, i will give it a try and no doubt will be back on here.

Ioannis
- 6th March 2008, 09:46
...
'
SEROUT PORTB.5,T2400,[TRAIN,TRAIN,TRAIN,TRAIN,TRAIN,9,3]

goto main



1. Where is <main>?

2. As I stated on post #8 you have to take specific steps.
a. Did you implement some sort of encoding? (Manchester or Bi-phase?)
b. Did you implement some sort of error detection (Checksum or CRC?)
c. If the transmission was not succesful, do you have any way to re-transmit the packet?

All of the above are documented on the forum. Use the google search tool that D. Taylor has offered to all (http://www.picbasic.co.uk/forum/showthread.php?t=4751).

Ioannis