Sending data over an RF link to a PC
There are many articles on the internet describing how someone can add wireless capabilities to a project. A plethora range of options and technologies exist and the choice is based upon the specific application.
In general, sub-1GHz frequencies are used for long range applications. The selection of the rf module is made after considering amongst others, the desired range, bandwidth, reliability and cost. Obviously, the cheaper the module, the less reliable it is.
Most of the hobby projects on the internet that employ RF communication, use Arduinos and special software libraries, like VirtualWire. The latter provides Manchester encoding/decoding routines to balance the voltages used for the RF receiver gain averaging circuit.
This instructable however, describes how you can make a Pic microcontroller talk to a cheap RF module (433MHz) through its USART port, to send data over a wireless link to another Pic. The first part demonstrates how to program a PIC12F1822 to send a simple string to an RF transmitter, and then how to get this string through an RF receiver and display it on a terminal application.
My tests showed that for continuous transmission from a PIC to another PIC (or PC) @1200 baud and maximum range of approximately 20 meters through house walls the results were excellent.
- A pair of Tx/Rx 433MHz modules
- A couple of 433MHz helical antennas
- A couple of 22pf ceramic capacitors
- 4MHz crystal
- 4.7K 1/4W resistor
- 0.9-5V to 5V DC-DC Boost Converter Step Up Module
- A couple of AAA battery holders + batteries
- A couple of half size breadboards
- A few connecting wires
- PICkit 3 programmer
- USB to TTL module (any)
- MPLAB- X IDE RealTerm software (or any other pc terminal application)
Step 1: Τransmitter Setup
The transmitter unit consists of the following:
- power supply
My decision to use a single AAA battery was due to size restrictions as I wanted to use a small enclosure for my transmitter. Moreover, my final project is low power and a single AAA battery can provide with enough mAh for my transmitter to work effectively. Further to this, I wanted to experiment with off the shelf dc-dc boost converter modules and check their efficiency and reliability. The specific boost module I use, can lift the voltage from a 1.5V battery (up to 0.9V wear out) to 5V which is perfect for the PIC and Transmitter to operate. As far as power is concerned, transmitter only draws <40mA, whereas Pic operating current is negligible.
PICs were always my favourites. The specific PIC I use, is a very flexible and powerful microcontroller, incorporating a bunch of functionalities under an 8-pin footprint. It only needs an external crystal (or you can use its internal oscillator) and a couple of caps to operate. I used MBLAB-x IDE and PICkit 3 to build and download the code.
- TX 433MHz
This usually comes as a pair with the RX 433Mhz module used on the receiver. It has three pins, DATA, Vcc, GND. Vcc can be any voltage between 3V ->12V whereas DATA accepts logic level digital data.
Step 2: Receiver Setup and PC Interface
The receiver consists only of the power supply and RF receiver module. The operation is very straightforward. The RX module gets the RF signal and relays it via a USB to UART TTL cable adapter to a PC. I only used two cables from the adapter, RX(white) connected to RX's Data out, and Ground(black). RealTerm was used to display the data at 1200 baud.
Step 3: Results and Part 2
This instructable presented a project about a simplex (one way) communication through an RF link. The RF modules used are a very affordable and easy way to add wireless functionality to a PIC (or any other μC) based project and can give very satisfactory results for low data rates and short range.
On the next instructable I will show how to add a second PIC on the receiver to decode and validate the data and will try to make the communication more reliable and resilient to noise.
Participated in the
Circuits Contest 2016