+ Reply to Thread
Results 1 to 12 of 12

Thread: RF module interface with PIC

  1. #1
    dilton13 Newbie
    Join Date
    Jan 2008
    Posts
    7

    Default RF module interface with PIC

    Hi,

    I am interfacing a 433 MHz transmitter receiver pair with PIC 16F73 using the serial port.

    I have connected the transmitter to another PIC.

    The transmitter PIC sends data serially, continuously, at baud rate 2400.
    I can receive the data with the receiver module. I can see the data stream in a scope, whose output is TTL.

    But when I connect it (the RX output) to the RX pin of PIC, the amplitude drops to 2V and an offset of 1V appears on the scope. I cant receive the data serially.

    But if I connect the two PICs with wires, the serial port works well and fine.

    Is it a problem with my RF receiver or do I have to add something else to the circuit??

    Thanks!!


  2. #2
    spectrum Newbie
    Join Date
    Nov 2007
    Posts
    26

    Default

    probably the RX pin is configured as an output, so you have a conflict on the line. At startup set TRISC (set Bit 7 for RC7 to 1), then set the registers to configure USART properly.

  3. #3
    dilton13 Newbie
    Join Date
    Jan 2008
    Posts
    7

    Default

    probably the RX pin is configured as an output, so you have a conflict on the line. At startup set TRISC (set Bit 7 for RC7 to 1), then set the registers to configure USART properly.
    RC7 is set already. The RX pin is not shared.

  4. #4
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,788

    Default

    You can't send plain RS232 data via RF modules reliably, check my PIC tutorials for a better way of doing it.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  5. #5
    picasm Good picasm Good
    Join Date
    Sep 2006
    Location
    UK
    Posts
    358

    Default

    Radio data modules should be used with "Manchester data encoding" in order to avoid DC levels as they are capacitively coupled - see http://en.wikipedia.org/wiki/Differe...ester_encoding

    Nigel has provided a tutorial that covers it: http://www.winpicprog.co.uk/pic_tutorial.htm

    It does the encoding and serial transmission all in software. The PIC hardware usart cannot do it by itself (Although it is possible to write some code to convert bytes to Manchester encoding then send them via the Usart in similar way).

    Edit: By the time I finished typing this, Nigel had already replied.
    Last edited by picasm; 17th January 2008 at 05:34 PM.

  6. #6
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,788

    Default

    Quote Originally Posted by picasm
    It does the encoding and serial transmission all in software. The PIC hardware usart cannot do it by itself (Although it is possible to write some code to convert bytes to Manchester encoding then send them via the Usart in similar way).
    Far better NOT to use the USART, it's really not suitable for sending Manchester coding - although there are some fairly limited 'bodges' to the data which can give a similar effect.

    If you check the data my tutorials use, you will see that a hardware UART couldn't do it, they are restricted to 7 or 8 bit data.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  7. #7
    dilton13 Newbie
    Join Date
    Jan 2008
    Posts
    7

    Default

    Nigel,
    Thanks for the tutorial. A good one!!

    But I was receiveing the serial data fairly good with the scope. I have already added headers, and I am sending continuous data.There are no long breaks of any sorts. I get fairly good TTL output with the output unconnected to PIC.

    for an update, i connected a buffer in between the PIC and the RF module. Now its working, though not reliably. I connected a .1uF tantalum across the power apart from the other discs, now it seems to be a bit ok (though not reliable, i guess.). I still wonder whats really happening..

  8. #8
    dilton13 Newbie
    Join Date
    Jan 2008
    Posts
    7

    Default

    Hmm.. Solved. Even though i do not know if it is the right design.

    The module couldn't drive an input, i guess. Even when i connect it to a 74245, the amplitude went low at times.

    So what i did was to connect a transistor (BC547) as a switch, and another one(BC 547) to the output to invert it. Now I get a clean signal at the scope even when i connect the PIC.

    The Manchester coding seems to be interesting, so i guess this will be the last time I use UART with the RF module.

    Thanks to all for the time. Please correct me if there is anything wrong in connecting two transistors like this.

    Thanks!

  9. #9
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,788

    Default

    From what I understand, you've inverted the logic of the RS232 (an inverter at either end) - this is mentioned in my tutorial, and provides a crude, less reliable system, which is why Manchester coding (or something similar) is always used.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  10. #10
    dilton13 Newbie
    Join Date
    Jan 2008
    Posts
    7

    Default

    From what I understand, you've inverted the logic of the RS232 (an inverter at either end) -
    No it wasnt the case.

    There was no logic inversion. The transmitter PIC transmitted as usual. The RF module received it, and the output of the RF module was switched by two transistors. I think it was more like a fan out problem of the RF receiver.

    As I mentioned earlier, the problem is not in receiveing, the problem was RF module could not 'drive' the RX pin of PIC, if it is ok to use the term 'drive'

    cheers!!

  11. #11
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,788

    Default

    Considering the PIC input is a CMOS gate, and is VERY!! high impedance, it shouldn't be a problem?.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  12. #12
    dilton13 Newbie
    Join Date
    Jan 2008
    Posts
    7

    Default

    That was even what I was wondering. But it worked well, really well, with the two transistors rather than a 74245 or a 7404.



    i tried with RC7 set and RC7 not set. the results were the same.

+ Reply to Thread

Similar Threads

  1. Replies: 51
    Latest: 9th January 2008, 08:54 AM
  2. pic and mosfet interface
    By h.d in forum General Electronics Chat
    Replies: 16
    Latest: 11th December 2007, 08:18 PM
  3. RF receive using PIC USART
    By col_implant in forum Electronic Projects Design/Ideas/Reviews
    Replies: 11
    Latest: 15th November 2007, 04:06 PM
  4. Rf Pic
    By flemmard in forum Electronic Projects Design/Ideas/Reviews
    Replies: 1
    Latest: 9th September 2007, 08:34 PM
  5. Motor control interface
    By dreamproject in forum Micro Controllers
    Replies: 0
    Latest: 31st March 2005, 03:48 AM

Tags for this Thread