Home

PICmicro

Projects

Web Design

Forums

Links

Contact

 

 

PIC RF Remote Control

 

 Overview

 

This project comprises of a UHF Remote Transmitter PCB and a UHF Remote Receiver PCB. The two PCB's can be hardwired via a DCI connector during program development, once completed the connector can be removed and the RF remote testing can be carried out.

There is a selection of 433MHz RF transmitter and receiver modules to choose from. They are inexpensive and ideally suited for remote control applications around the home, garage and garden. Interfacing them to a PIC couldn’t be easier. Some can operate over a 200m range. One of the advantages of UHF RF remote control is that it can operate where there is no line of sight as required with infrared remote control. Classified as “Low Interference Potential Devices” (LIPD) devices have no legal protection but can be used without a licence. The 433MHz modules send data by a method known as amplitude keying (ASK). Data is transmitted as a series of '1' and '0'. A '1' is represented by the transmitter carrier being switched ON and a '0' is represented by the transmitter carrier being OFF. In order for the UHF RF modules to function satisfactorily the data rate must be btween 300 and 10K bits per second. There are certain drawbacks, noise being the main one. With no signal sent by the transmitter the receiver outputs a continuos stream of noise, due to the receivers ‘Automatic Gain Control (AGC). If a microcontroller is used as the receiver interface the noise can be supressed or ignored by the PIC program software. The other drawback is that the receiver will respond to any other 433MHz transmitter in its vicinity, again using a microcontroller the problem can be overcome with the software.


PIC Software Program

From experience have found that sending plain RS232 does not work as well as it should. Manchester Encoding the data bytes before transmission goes a long in improving reliabilty by reducing data corruption. While RS232 works on maintaining the original width of the individual pulses, for example a 9600 baud being a 105uS wide pulse, Manchester Encoding relies on HIGH to LOW (bit 0), or LOW to HIGH (bit 1) transitions, the actual width of the pulses doesn't matter particularly (within reason), this is good, because wireless does not preserve the exact width of the transmitted pulses. Since radio transmission isn't as reliable as we would like it to be, we just cant send a single byte at a time as we do for RS232, if the receiver misses the START bit then the data byte will be of no use. So it is normal to use a PACKET system, where a number of different pieces of information are transmitted after each other in the form of a packet.

The actual transmission format is as follows:

Header section :

Used to synchronise the beginning of the packet. Usually referred as the preamble consisting of about 20 bits, followed by the START bit.

Address byte(s) :

In situations where there are more than one receiver, this is a specific byte or several bytes that the receiver checks to see if it is being addressed.

Data :

At least one or more byte of data, using more data bytes in larger packets speeds things up.

Checksum :

A checksum byte, used to make sure that the data is received correctly, if it fails the data should be discarded.
 

 

 

 Software Protocol

 

RS232

 

Transmitter

The protocol used is Serial Asynchronous mode. Assuming the transmission rate is 9600bps, then the bit duration is 105uS. The transmission starts with the preamble. After the preamble the transmitter sends the Start bit. The Start bit should be longer than the bit duration in order to enable the receiver to identify it as the Start bit. On completion of the start bit the transmitter waits for 105uS then sends the first data bit, followed by the remainder of the data.  

Receiver

The receiver waits for the Start bit sent by the Transmitter, once the receiver senses the the end of the Start bit waits for 1.5 bit duration, approximately 158uS, then samples the the incoming data bits once every 105uS.

 

 

 

 Hardware

 

 

RF Remote Transmitter

RF Remote Receiver

 

 

Hardware considerations :

Use a Crystal with both PIC Transmitter and PIC Receiver PCBs and not a ceramic filter or other components.

Strongly advice placing a transistor buffer between the RF Receiver data output and the PIC data input in order to prevent the PIC receiver from incorrectly decoding the incoming data bits due to indeterminate bit voltage levels (floating). A BC547 transistor with a 10K collector resistor load and a 1K base input resistor acts an an effective buffer.

If using 433MHz modules, for short range transmission and reception, a 17cm piece of wire makes an adequate aerial. 

 

The Transmitter and Receiver modules can hardwired with an IDC connector during program development, when done, they can then be separated for RF remote control testing.

 

 

Main Hardware : Microchip PIC16F876 28 pin microcontroller - Transmitter/Receiver UHF Remote Control Modules

Software : Assembly Code - Microcontroller Programmed with the Microchip PICKit2 Programmer