PIC18LF2550 2.4GHz Serial Link

I wanted to make a wireless serial link that would allow me to send and receive data between Microchip PIC microcontrollers and a computer. I found some very useful information and some helpful code for utilizing a Laipac TRW-24G 2.4GHz wireless transceiver with a PIC16F88 as a wireless serial link. The PIC16F88 is a nice little chip that provides a number of useful features (including an onboard USART and the ability to use a bootloader). I am a fan of the PIC16F88; however, I believe that the PIC18 series are much more robust, so I created a circuit that would allow much more flexibility in design and deployment. This project is a relatively simple circuit that utilizes a PIC18LF2550 microcontroller and the Laipac TRW-24G 2.4GHz transceiver to create a wireless serial link.

Full circuit

The source and firmware for the circuit can be found at the bottom of the page. Each section of the circuit is labeled in the schematic above. All of the sections and their components are described below. The part numbers for the components are linked to websites for data and more information when available.

Power Supply

The power supply uses a 9 volt battery and a TC1264-3.0V high-accuracy low-dropout linear voltage regulator to provide a stable 3 volt supply for the microcontroller and the transceiver. A 1uF (microFarad) polarized decoupling capacitor is necessary on the output of the voltage regulator to prevent spikes or ripples. A wall wart power supply as low as 3.3V can be substituted for the 9 Volt battery.

RF-24G Transceiver

The Laipac TRW-24G 2.4GHz transceiver uses a Nordic Semiconductor nRF2401a transceiver chip and includes all of the necessary components. The TRW-24G (also called the RF-24G and TXRX24G) requires a 3 Volt power supply and 3 Volt logic, so running the circuit at 5 volts is not a viable option. Information on the chip’s interface cam be found in the following data sheets:
http://www.sparkfun.com/datasheets/RF/RF-24G_datasheet.pdf
http://www.sparkfun.com/datasheets/RF/RF-24G.pdf
http://www.sparkfun.com/datasheets/RF/nRF2401rev1_1.pdf
https://www.sparkfun.com/datasheets/RF/RF-24G.pdf

Microcontroller

The microcontroller used was a Microchip PIC18LF2550. I modified the PIC18F2550 Tiny PIC Bootloader assembly file so I could use a 10MHz crystal/resonator at 57,600 baud (the modified bootloader can be found at the bottom of the page). The PIC18LF2550 runs at a maximum speed of 16MHz (4 MIPs) with a 3 Volt power supply; however, I had 10MHz and 20MHz ceramic resonators on-hand, so I ran at the fastest ‘safe’ speed possible (I could overclock the PIC by running it at 20MHz with a 3 volt supply, but it would be running out of spec. so it may not operate reliably). The firmware was written in C (using CCS PICC) and can be found at the bottom of the page, in addition to a generic RF-24G driver for Laipac TRW-24G 2.4GHz transceivers. R1 is a pull-up resistor necessary for operation. C1 is a stabilizing capacitor that is used for the onboard USB voltage regulator (which is not utilized in this project). The component marked ‘RES’ is a 10MHz resonator.

RS232 Level Converter

A MAX233 was used to convert the logic level signals of the PIC18F2550 to RS-232 compatible voltage levels. The MAX233 is running at 3 Volts, which is under the nominal operating voltage of 5 Volts; however, the circuit design would necessitate an additional voltage regulator (for the 5 Volt supply) and repeated testing found no problems with communication performance. It is a little hypocritical of me to use the “running out of spec.” argument for the microcontroller, but not for the RS232 level converter; however, the MAX233 was the only chip I had on-hand and there are 3V RS-232 transceivers available (including the MAX3323E), which can easily be substituted.

Source and Firmware

The PIC must initially programmed with the ‘SAC_tinybld18F2550_10MHz_57600′ hex file to program the bootloader on the PIC. Then, using Tiny PIC Bootloader, the ’18LF2550 RF-24G Serial’ hex file can be placed on the chip using the Tiny PIC Bootloader frontend with ’12h 34h 56h 78h 90h’ in the ‘List of codes to send first:’ in the ‘Options’ menu. Please feel free to contact me if you have any problems.
SAC_tinybld18F2550_10MHz_57600.asm (hex)
18LF2550 RF-24G Serial.c (hex)
RF-24G.c

34 thoughts to “PIC18LF2550 2.4GHz Serial Link”

  1. Hello,
    This is rajesh,
    http://www.semifluid.com/?p=25
    I need the clarification for the above said pic project,
    I have understude that the transmitter is controled through the pc computer RS232.
    But what i need is want to control it through joystich for pan and tilt function (POT)
    (Not with the computer rs232 controller).
    Please let me know how to do that with the manual joystich control and the compleate schematic diagram ???
    Awaiting for your favourable reply
    Thankyou/Regards
    Rajesh

  2. Hello,
    This is rajesh,
    http://www.semifluid.com/?p=19
    I need the clarification for the above said pic project,
    I have understude that the transmitter is controled through the pc computer RS232.
    But what i need is want to control it through joystich for pan and tilt function (POT)
    (Not with the computer rs232 controller).
    Please let me know how to do that with the manual joystich control and the compleate schematic diagram ???
    Awaiting for your favourable reply
    Thankyou/Regards
    Rajesh

  3. hello,

    Just a question about the project above:
    Do you need two RF-24G modules? (one at pc side and one at target pcb board)
    Or do you use only one at target pcb board? In this case, how do you connect to the wireless link at pc side? Probably with the wireless connection possibility of a notebook, but how do you acces the link (softwarewise)?

  4. Kris – Yes, you need two RF-24G modules. One needs to be connected to the computer using a receiver circuit, while the other is connected to the target PCB. The issue is that the RF-24G uses a proprietary control scheme, so you can’t directly connect a TTL asyc serial port to it. The link appears as a normal serial connection to the PC, so there is no need for proprietary software. All that you need is an RS-232 serial port and it will act as a wireless bridge.

  5. Steve- thx for the quick answer. I thought it was possible to acces the RF-24G directly with the wireless network card of a computer. Seems it’s just a wireless RS232 transfer.
    I think I’ll just use some 433Mhz transmitters then, no need for me to use such a high frequency.
    By the way, can I ask why U want to use such a high frequency for the communication? I think a ordinary 433Mhz transmitter is more cheaper and better available then the ones U use.

  6. Kris – The RF-24G has a number of features that make it very appealing including CRC generation & checking, up to 1Mbps transfer rate (with “Shockburst”), integrated antenna, long transmission and reception range, and very configurable (i.e. addressing, output power, etc.). It only costs $13, which is a steal for a transceiver. It is not specifically designed for RS-232 communication, so it can be configured for other projects and applications. The high frequency band is less noisy and less prone to packet loss, so it is much more favorable. I actually have a 433MHz transmitter and receiver and while they work alright in close vicinity, their performance dramatically decreases with increased range. I have been very happy using the nRF2401a chipset, but I have heard the newer nRF24L01 is even better (automatic ack/syn and retransmission).

  7. dear friend:
    I am trying to develop a project using the chip 24l01 from Nordic. we purchased some nRF24L01-REFMOD modules from a reseller, here in Brazil.

    I wish to know if you had some experience with this chip. The software for the 2401 doesn´t work for the 24l01 (the 24l01 has spi comm, 2Mbits speed, etc…).

    our project will have a transmitter (rf tag), based on the microchip 12f683 and a receiver, based on the 16f88.

    I am trying to find some example source code to try to learn how I can achieve this project.

    Thank you very much.

    Sergio

  8. I have to build an USB link for a telemetry/teleoperation project, specificaly one capable to receive data from an USB camera (LEGO Mindstorm) and transmit moving commands for two LEGOs. Do you think the TRW-24G is capable to do those tasks?, and if it’s true, can you help me about this, I haven’t found many useful information, so I’m becoming nuts.

    Please help me about an USB RF link…

    (Sorry for my english, I’m from Colombia)

    Thank you very much!!!

  9. Hi There
    I am trying to fiend a simple circuit transceiver for my battery operated smoke detectors so I can interlink with each other by
    RF when one triggers other detectors triggers at the same times it is called common signalling.
    Thanks
    Varoosh

  10. Hello my friends, i just found this website 1 month ago, and i decided to build 24G serial link , i almost done with the components but i still have two questions in my mind because i am not so familiar with PICs in general.
    The first one is : can i use a 18F2550 instead of 18LF2550 and change the supply voltage to 5V instead of 3V ? I mean is the source code compatible with 18F2550 ?
    Second one :
    I have an Microchip ICD2 Debugger and programmer and i wanted to know if i have to change anything in the configuration bits section to use that 10MHz quartz. I loaded the hex you provided and i programmed the PIC succesfully but i still wait for the 24G to test it to see that if it will work.
    Many Thanks
    Teo

  11. Hello,

    i search source code in assembler for PIC16F88 and nRF24L01. I need Rx and Tx soubrutine. Can you help me ?

    Thanks

    Robert

  12. This is in reference to Comment #8 above. You have mentioned that nRF2401 has a better range performance. Can you kindly share your experience as in what was the maximum range you got when doing your experiments.

    I am basically in the choosing-a-chip phase of my project and this shall help me make a better decision as I am also considering ZigBee with it.

    Thanks.

    Rakesh

  13. hello

    i am trying to implement clustree wireless sensor network using nRF24L01
    and PIC of 18f series. i m looking for source code to interface tranceiver with micro. can u help me out.

    krishnakant

  14. hello sir, i have a project to be done and i don’t know what to use to communicate the PIC16f877A to a computer using wireless. and if you have any suggestion on other PIC aside from PIC16f877A. Our project is a weather observatory with few devices for wind speed, wind direction, temp and humidity and we will place it in a rooftop but how can we send data to a computer using wireless system?

  15. I’m searching for a PIC program written in C language which can use for serial transmission. If u can please provide me.
    Thanks.

  16. i am trying to compile the source code using MPLAB IDE v8.1 which uses C18 compiler. but always i get a syntax error at #device ADC=10. should i use certain C compiler. any suggestions

  17. Hi! I am trying to build a circuit which will conect (over 2.4 GHz) HDMI AV Source with HDMI conector on LCD TV. Any suggestions!?
    njofranjofra (Croatia)

  18. Pingback: List of Projects - Embedded Systems « Mohit Kumar
  19. Dear Mr. Steve
    Lately i have been exploring your website and i have found it quite enlightening. I stumbled into it in my quest for RF coding/decoding techniques for wireless data transmission. I downloaded a document 9014a.pdf from the microchip website that has a sample receiving assembly language routine but that has proved quite hard to digest.
    I have two questions to ask in that respect:
    1. can two interrupts RB0 and Tmr0 be used in a single routine calling the same ISR?
    2. how can such a method be used (wonder if you could elaborate the manchester method in flowchart) to write a receive routine for manchester encoded data?
    In fact i want to use interrupts to decode manchester data maintaining accurate data.

    hope you would oblige by answering at the earliest.
    Thank you.

  20. hello , this project is just what im looking for! im building an ultra-sonic self maintaining mobile radar scanner for my BS project.. big name huh?! i tried usb communication but im stuck with a short range! so i need it wireless, and preferably i want to use ur project to make my last 25% part of my project. Can you help me and send me the source codes to my email ahmad_kaderi@hotmail.com ..cause HEX are useless if i want to change the program. And i will add your name in my BS report to maintain all rights. thank you in advance

  21. srry for the comment.. didnt notice the asm and .c ! im so sorry thanks for the project

  22. Please need help for do the wireless comunication over two pics, my main problem is impossible find your wireless chip, I have the NRF24L01, can you help me with this module or you recomended other, thanks

    carkis s m@gmail.com

  23. I’d like to share my experience after using this TRW-24G RF transceiver module.
    It is very easy to get the hand-on and easy to integrate into wireless application. I am the designer myself and I have used this module in various wireless application. I also found that there is a Taiwanese based company who’s the true manufacturer of this transceiver module. That is Wenshing (http://www.wenshing.com.tw/Products/RF_Module/Transceiver_Module/TRW-24G_2.4GHz_RF_Tranceiver_Module/)

    You guys may have the same experience as I have while use it.

  24. Hi ! I am interested in your project. I compiled the asm code with MPLAB but unfortunately the built failed. There are several errors mainly about the configuration. Could you help me please? By the way I want to transmit and receive by rf from one pic to another. I mention this in case you have a program to do this. Thanks in advance, Mariana.

Leave a Reply to Mohammed AloqlahCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.