v. Wireless communications

Microcontrollers can easily transmit data through wireless data links. Today there are many wireless transmitter and receiver modules on the market. Most can be directly connected to a microcontroller. They are also low power devices, so a few miliwatts more won’t harm your microcontroller power supply. Most modules cost about 5 € a piece. Usually each transmitter module has a corresponding receiver module.

NOTE: If you need bidirectional communications, you can also use Hoperf RFC transivers. A transiver is a single module, which has transmitter and receiver functionalities and also saves space on your PCB. However, the basic principles described here remain the same.

Simple modules

The simplest solutions only asynchronously transfer one bit of data. The data rate is limited to a relatively small range from a few hundreds of Hz to a few kHz (bauds). This means that one can only transmit data within the transmitter’s frequency range.

The simplest way of utilizing this functionality is to transmit a stream of FM (frequency modulation) and/or PWM (pulse width modulation) modulated binary data. The receiving transmitting microcontroller can use its internal ECCP (Enhanced Capture, Compare and PWM) module to detect the received binary stream frequency and phase. This way it is possible to use simplex, half-duplex or full duplex communication. Full duplex communication can only be achieved, if each pair of transmitter and receiver modules uses a different carrier frequency. If all the modules work on the same carrier frequency, a bidirectional wireless communication (simplex or half-duplex) between two or more remote microcontrollers can only be accomplished with a single transmitter module active at a time. Therefore each microcontroller should listen for any ongoing transmissions before it starts transmitting data.

Modules with digital logic

Complex modules have an inbuilt digital logic or a dedicated microcontroller. Most use one bit serial communication protocols to transfer data. They also have configuration registers. A valid configuration has to be set to the transmitter and receiver modules before the data can be transmitted. However, a programmer does not have to cope with the binary signal properties, like FM and PWM. A binary stream of data is automatically coded and decoded by transmitter and receiver modules.

Example: Using Hoperf Electronic RFC83C and RFM85 modules

RFC85 transmitter module uses a predefined carrier frequency (usually 433.92 MHz or 315 MHz, depending on the inbuilt crystal oscillator) and allows baud rate form 300 Hz to 10 kHz. It is connected to a single microcontroller digital output. The rest three pins are used for ground, power supply and antenna connections. Its operating range from 2.1 V to 5.5 V is ideal for 3.3 V and 5 V microcontrollers.

Here is a full duplex transiver schematic for PIC18F2xJ50 microcontrollers (See Basic circuit for PIC18F24J50 or PIC18F26J50 to work over USB for more information on biuildeing the basic circuit):

Use a microcontroller input (applicable to PIC18F2xJ50 and PIC32MX2xxFxxxB microcontrollers) to connect RFC83CL receiver data pin. See subsection 5.m Frequency and impulse width measurement on details on frequency and impulse width measurement. Connect RFC85 data input to a microcontroller output. Use PWM1 generator output to generate 2.4 kHz PWM signal to be transmitted.

Add the following VB.NET code to Frequency and impulse width measurement example to set the maximum prescaler value (16) for PWM1 generator.

x=PIC.DataMemRead(&HFCA)

if x>=0 then

x=x or 3

PIC.DataMemWrite(&HFCA,x)

end if

See subsection 9.r. How to set the PWM prescaler value for details.

Here is a full duplex transiver schematic for PIC32MX2xxFxxB microcontrollers (See q. Basic circuit for PIC32MX2xxFxxxB to work over USB with a 20 MHz external oscillator for more information on biuildeing the basic circuit):

RFC83C(L) is the receiver module for RFC85. It operates on the same carrier frequency (usually 433.92 MHz or 315 MHz, depending on the inbuilt crystal oscillator) and supports baud rates from 300 Hz to 2.5 kHz. The operating voltage range is different for RFC83C (from 3.6 V to 5.5 V) and RFC83CL (from 2.1 V to 3.6 V). Therefore RFC83C module is more suitable for 5 V microcontrollers (PIC16C745, PIC18F2550, … ) and RFC83CL module more suitable for 3.3 V, like PIC18F and PIC32.

Two basic microcontroller circuits and two pairs of RFC85 and RFC83CL with carrier frequencies of 315 MHz and 433.92 MHz are needed. One of the microcontrollers is connected to RFC85 transmitter module with carrier frequency of 315 MHz and RFC83CL receiver module with carrier frequency of 433.92 MHz. The second microcontroller is connected to RFC85 transmitter module with carrier frequency of 433.92 MHz and RFC83CL receiver module with carrier frequency of 315 MHz. Thus we have two simultaneous communication that enable full duplex communication between the microcontrollers. Go to Downloads section to get the latest firmware and the latest DLL for your microcontroller. PIC18F24J50, PIC18F26J50 and PIC32MX250F128B microcontrollers are supported.

See programming guides for PIC18F2xJ50 and PIC32MX250F128B for details.

Click on the photo to enlarge it.