You always wanted wireless control of your project with a PC. e-Gizmo now brings you your building block module-
8/16-bit RF Wireless Remote Output that you can control using your PC! Designed and Written by Henry Chua
I met a lot of students and enthusiasts who build or are trying to build gadgets that they hope can be remotely controlled by RF (Radio Frequency). Because of the unavailability of any locally-built RF remote circuit boards, the moneyed ones simply purchase this stuff from overseas suppliers, spending 12,000 pesos, perhaps a bit more. Others resort to buying RC (Radio Controlled) cars, tearing it apart, taking only the much needed RF remote parts. A cheap RC car with two output functions can cost as little as 600 pesos. This seems to be attractive enough to jump into this solution, except that:
Typical Performance
• Unless you are an experienced electronics geek, finding the correct output and matching it with your circuit can be very tricky.
Frequency:
• Most R/C toys operate on 27MHz to 49MHz frequencies. If you are planning to use a microcontroller or microprocessor with your wireless, then you have a problem. As those who already tried this found out, microcontroller circuits generate all sorts of RF noise interference within these frequency bands. This severely affects the reception ability of the receiver circuit, reducing the control distance range to only a couple of meter or so. Of course, a wireless controlling distance within your arm's reach will not look impressive at all.
Output Power: 0dBm (1mW) Harmonics: 2nd < -15dB 3rd up < -25db
Our wireless kit is designed to be free from these problems. It operates at 433MHz unlicensed ISM (Industrial Scientific Medical) frequency, far from the interfering signal frequencies coming out of your microcontroller circuits. It is easy to use, fully documented. All available
433MHz nominal 430-439 MHz
Transmitter Side:
Receiver Side: Sensitivity: 8uV @ 2.4Khz 80%mod RF Bandwidth (-6db): 2.4 MHz typ Adjacent Frequency Rejection fo +/- 5MHz: - 55dB Control Distance: > 100ft in open space
Copyright 2005 by e-Gizmo Mechatronix Central All rights reserved. No part of this publication may be reproduced in any form without the written consent of e-Gizmo Mechatronix. Content subject to change without prior notice. All informations contained herein are believed to be correct and reliable.
Before using this document, you must agree with the following terms and conditions: 1. e-Gizmo Mechatronix and the author cannot be held liable for any damage that may occur with the use or misuse of any information contained in this document. 2. You are allowed to reproduce this publication and the product it describes for personal use only. Commercial reproduction is prohibited!
Page 1
Copyright 2005 e-Gizmo Mechatronix Central
I/Os are fully explained with some interfacing examples. The transmitters plugs into one of your PC serial com port. It is Visual Basic friendly, 10 lines of code is enough to operate it.
CIRCUIT EXPLAINED The wireless kit consists of two subsystems, the transmitter circuit, and the receiver/decoder circuit.
The circuit schematic of the transmitter is shown on Fig. 1. The circuit is remarkably simple, thanks to the RF module UC1817. I used this module because (after some modification) of its good frequency stability over temperature and time, although it contains no saw filter component at all. Of course, a 433 MHz saw filter-stabilized oscillator circuit would give much better frequency stability, but you'll need a load of luck to find one in the local hobby market. JDR1
J2
J3
J1
1 2 3 4 5 6
1 2 3 4 5 6
CON6
1 R1 2 D1
3 R2
5V1
4 5
CON6
1 6 2 7 3 8 4 9
6 7 8 9
5
1 CON1
CONN DSUB 9-R
Figure 1. Complete schematic diagram of the transmitter unit.
Power to the transmitter is directly drawn from the RS232C lines. With pin 4 (DTR) output permanently staying at the V+ side, the transmitter can be switched ON and OFF through pin 3's (TX) output of the serial port. In other words, the serial data output itself turns ON and OFF the transmitter, effecting a Amplitude Modulated system. D1 keeps the voltage to the transmitter from exceeding 5.1V, at the same time, limits the volt-
age to -0.6V in case pin 4's output suddenly decides to go negative. The receiver circuit is a bit more complicated, it will make more sense if we describe the circuit in its block diagram form as shown in Figure 2. The complete schematic of the receiver is shown on Figure 2a on page 3.
Figure 2. The receiver circuit functional block diagram 8/16-bit Wireless Remote Output
Page 2
CON1
1
J2
C
C17
PHONEJACK
C5
+
D1 1N4148
15k
R3
56k
R4
+V
VIN
U3 L7805/TO220
330pF
C2
330pF
C14
1
1pF
C4
GND 2
1 2 3
3
R1 5k6
C3 1n
C13
C1 0.5pF
C18
+
+
C6 10n
+ C8
C7
+ C9
R10
R5
R17
+5
2
3 -
+
1 2
C10
R6
U2A
CON2
J6
R15
LM358
1
C15 CAP
R11
R9
R7
C11
R14
C12
6
5
R12
CRY STAL
Y1
7 6
-
+
8 9 10
U2B
R8
R13
Z86E04
P20/D0 P21/D1 P22/D2 P23/D3 P24/D4 P25/D5 P26/D6 P27/D7
P00/CLR P01/CLK P02/PGM
C16
LM358
7
XTAL1/CE XTAL2
P31/OE P32/EPM P33/VPP
U1
Figure 2a. Complete schematic diagram of the Receiver Module.
15k
R2
NPN BCE L1 CHOKE RF
Q1
L2
VOUT
14
GND
J3
8 4
5 VCC
Page 3
Copyright 2005 e-Gizmo Mechatronix Central
15 16 17 18 1 2 3 4
11 12 13
We all know the function of the antenna; it grabs whatever radio signal wanders in its reach. Because of its finite length, it favors radio signals with frequencies that falls within half wavelength, which, by design, is 433MHz. The receiver is more picky. It will work only on 433MHz signals, totally ignoring all others. The very weak signal from the antenna is greatly amplified, at the same time demodulated in this block, resulting in the recovered data signal from the receiver output. The receiver block consists of components Q1, R1 to R4, C1 to C7, L1, L2 and D1.
Receiver Board Assembly Use a PCB layout pattern which is a faithful reproduction of the pattern shown in the downloads. If you choose not to, you may be buying yourself into trouble you must be certain you know what you are doing. Treat each component with reasonable care. The ICs are particularly susceptible to damage due to ESD (Electrostatic Discharge) and must be handled properly. Soldering workmanship is very important, this project must be built by a soldering iron master! Recommended reading:
The recovered data signal however is still too weak and is mixed with all sorts of noise. The amplifier stage boosts the signal to a more usable level, using to its advantage its inability to amplify high frequency noise, thereby improving its signal to noise ratio. Then, this preconditioned signal is fed to a pulse shaper where data signal is reconstructed into nice digital signals the microcontroller can now understand. The amplifier circuit consists of U2A and associated components, the pulse shaper is formed by U2B and associated parts wired as Schmitt trigger. The microcontroller then assembles the received data into an 8-bit data format. As wireless transmission is very prone to error due to unaccountable external influences, extra bits are transmitted and received as a form of error checking. If everything matches the error-checking code, then the received data is fed to its 8-bit output port. A successful data transmission is indicated by a flashing LED indicator in the receiver board. Data transmission format is discussed in detail in the Programming section. The microcontroller section is based on a Z86E02 microcontroller U1. U3 converts the DC supply input into a stable 5V source to supply the whole circuit.
General PCB Assembly procedure www.e-gizmo.com/ARTICLES/ProjectB/Assembly.htm
Figure 3. Component side of the receiver module.
ASSEMBLY INSTRUCTIONS Part of the circuit, the receiver circuit in particular, works at a very high RF frequency (UHF 433 MHz). The choice of components becomes very important. At this frequency, the PCB layout becomes very much part of the circuit. Each component is carefully laid out to minimize unwanted interaction against each other. Merely repositioning these components can have an astonishing effect on the performance of the circuit. Many people who do not understand this suspects that RF design is engineering mixed with witchcraft, or maybe the other way around.
8/16-bit Wireless Remote Output
Figure 4. Bottom side of the receiver module. Four components are soldered on this side; U1, U3, Q1, and D1.
Page 4
Mount and solder the components in the following order : resistor, capacitors, coils, transistor, diode, ICs, and whatever component is left out of this list. Keep all components lead as short as possible. Q1, U1, U3 and D1 are surface mount components - they are soldered directly on the copper side of the PCB.
Double side layout is used for the receiver board, with the component side copper used mainly as a ground plane. Some components must be soldered on the component side copper trace ( if the PCB you are using is not a plated through hole type), these are shown and are listed as follows:
Figure 5. Components with leads soldered on the component side.
1 - C18 2 - C15 3 - R14 4 - C12 5 - R13 6 - Crystal Can 7 - C16 8 - U2 pin 4 9 - C6 10 - R1
Form the antenna by cutting an AWG25 solid insulated hook up wire 35cm long. Note that this length corresponds to the half wavelength of the 433MHz RF signal. Making this wire any longer or shorter will not improve reception, in fact, it will do just the opposite. One problem we noticed though is the antenna does not like to be touched (i.e. hand effect). Grabbing the antenna with one hand will detune the receiver and can altogether stop reception. Swaying the antenna, will also have the same effect, although to a much lesser extent.
This phenomena is caused by insufficient isolation of the receiver's tuned circuit with the input port. We can easily solve this problem by winding the base portion of the antenna 8 turns around a 5mm diameter temporary form, forming it as shown in the picture below. Of course, this solution is a compromise, we do this at the expense of reduced transmission distance. But still, the control distance goes more than 100 feet in an open field.
Figure 6. The receiver module antenna.
Page 5
Copyright 2005 e-Gizmo Mechatronix Central
Transmitter Board Assembly Building the transmitter board is a breeze! You only have to solder a couple of resistor R1 and R2, a zener diode D1, the transmitter module, a DB-9 female connector,
Figure 7a. Transmitter component side.
and the antenna and its done. The antenna is formed out of solid AWG 16 tw wire cut to 35cm length.
Figure 7b. The RF module is soldered on
the copper side. TEST and ALIGNMENT EQUIPMENT NEEDED: a) Personal Computer (PC) with microsoft Visual Basic 6 software installed. b) Non metal screwdriver alignment tool. c) 9V Battery with Battery Snap.
Alignment Procedure: 1. Download and run the Visual Basic test program. 2. Install the transmitter to serial communication port1 (com1) of your PC. 3. You will be moving around with the receiver module as you align it for the farthest control distance. Use a 9V battery to temporarily power it while doing the alignment. Solder the battery snap red wire to the + pin of C14, with the black wire going to - pin of the same capacitor.
data terminal connector J1 and keep your fingers away from the high frequency receiver area as you do the adjustments. 5. Keeping an eye on the LED, move farther away from the transmitter until the LED stops flashing. 6. Slowly readjust L2 until the LED flashes again. 7. Repeat steps 5 and 6 until no further improvements can be obtained. You should have moved at least 100 feet away (open space) from the transmitter by the time the LED stops flashing if L2 is properly adjusted. Final distance will vary considerably if you do the alignment indoors, but it should not be less than 50 feet when obstructed with two concrete walls in between.
4. Working close to your transmitter, tune coil L2 using the screwdriver alignment tool until the receiver LED indicator D4 flashes. Hold the PCB module near the 8/16-bit Wireless Remote Output
Page 6
USING THE WIRELESS SYSTEM Wireless control is accomplished by sending a stream of data from the PC to the transmitter through the serial communications port (com1, com2,.. and so on). The serial data is then picked-up from a remote location by the receiver module and then reconstructed to appear as an 8 or 16 bit parallel data on its output. But serial transfer cannot be reliably accomplished in wireless realm by simply throwing data all by itself. A lot of things could happen as signal travels through space towards the receiver side. And when these things happens, it always leads to a erroneous data appearing on the receiver side. Obviously, we have to devise some way for the receiver to recognized whether the data it receives is intact or invalid. We can easily do this by transmitting extra data used mainly for error checking.
This data transmission scheme is very easy to implemented in Visual Basic. The downloadable test program source code serves as a sample showing how to do it. Output interfacing All outputs are 5V TTL/CMOS compatible, and following the specifications of the IC, each output is capable of directly driving two TTL loads only. Do not connect any inductive load to the outputs directly, unless it is really your intent to kill the IC U1. Examples of highly inductive loads are solenoids, relays, and motors. An output interfacing circuit example is shown in figure 8. The transistor circuit allows on/off control of loads and is capable of sinking up to 100mA. D1 is necessary when the load is inductive. It prevents the switch-off transient of the load from frying Q1.
Communications Format Aside from the 8-bit data of interest, we have to throw in two extra bytes of data preceding and succeeding the 8 bit data. Let us call these extra bytes as the Header and the Checksum. The communications format is then more clearly described as: [Header] + [Data] + [Checksum] This is a three byte transmission. Each data set enclosed with bracket is 8-bit wide. Header - The header is used mainly to tell the receiver that data transmission is started. This is a fixed data with a valid hexadecimal value of 54 (&H54 in Visual Basic format) or 55. Data -
Figure 8. A switching transistor circuit should be used when driving inductive loads, such as a relay.
This is the actual 8 bit data you are sending.
Checksum - 8-bit Sum of [Header] + [Data] (results truncated to 8 bits) Upon reception, the receiver checks the integrity of the header and proceeds to compute its own checksum and compares it with the received checksum. If the checksum matches, a valid data reception is assumed and the 8bit data is outputted on the receiver output port. Otherwise, if error is found in either header or checksum, the receiver rejects the data set by ignoring it.
Page 7
Copyright 2005 e-Gizmo Mechatronix Central
IF EIGHT IS NOT ENOUGH Throw in a couple of 374s and connect them as shown in the figure below and you get a 16-bit output. You can use 74LS374, or its HC and HCT equivalent. Power pins connections of the ICs (pin 10 - GND, pin 20 - Vcc) are not shown in the schematic, but you should connect them to the supply lines! For best results, add a 0.1uF multilayer capacitor across the Vcc to GND lines closest to the ICs.
To output an 8 bit data on U1, use a hexadecimal &H54 header value in the data communications (see Communications Format). To output an 8 bit data on U2, use a header value of &H55.
Figure 9. Adding a pair of 374 latches allows you to control up to 16 outputs.
MEASURED PERFORMANCE NOTES Performance test setup: View of the test bench and equipment used to evaluate the transmitter and receiver. Instruments used: - Advantest R3261C 9khz-2.6GHz Spectrum Analyser. - Hewlett Packard HP8647A 1GHz RF Signal Generator - Tektronix TDS754A 500MHz 2Gs/S Digital Oscilloscope - Tektronix 2465B 400MHz Analog Oscilloscope - Hewlett Packard HP6633A System Power Supply - Wavetek model 166 50MHz Function and Pulse Generator. 8/16-bit Wireless Remote Output
Page 8
Close up view of the receiver module under test. Tetronix probe P6137 were used.
To measure receiver sensitivity, the signal generator output is reduced until noise starts to show up on the digital pulse shaper output. The upper trace shows the output of signal amplifier U2A (1V/div) while the lower trace displays the pulse shaper output U2B. An analog oscilloscope is used to monitor the output so that all high frequency noise and artifacts can be seen, something a digital oscilloscope is not good at.
Under the test criteria described above, and with the signal generator externally modulated with a 2.4kHz square wave signal at 80% modulation depth, the signal generator reveals a respectable 18dBu (7.94 uV) receiver input sensitivity. The 6dB RF bandwidth measured 2.7MHz, not impressive actually, but it is not fair either to expect more for this type of receiver circuit.
The measured RF bandwidth is much wider than we need. We don't want excessive bandwidth because it makes the receiver more susceptible to noise and interference. On the other hand, we could make use of this excessive bandwidth to our advantage. Remember, our transmitter is not saw filter controlled, mean-
Page 9
ing, the frequency can wander a bit. The excess receiver bandwidth actually makes it tolerant to this kind of deficiency, ensuring a good data transmission even if the transmitter frequency alignment stray by as much as 1MHz.
Copyright 2005 e-Gizmo Mechatronix Central
Adjacent frequency rejection at +/- 5MHz and +/-10MHz frequency were also measured. Results are as follows: 431.2MHz + 5MHz - 62dB 431.2MHz - 5MHz - 58dB 431.2MHz + 10MHz - 78dB 431.2MHz - 10MHz - 65dB
The nominal operating voltage of the receiver is 9V. At this supply voltage, it consumes 18mA current (0.162W). It will work with supply voltage as low as 7V to as high as 16VDC.
The transmitter was evaluated using a spectrum analyzer. The transmitter is both powered and modulated by the model 166 function generator output set at 20Vp-p 2.4KHz square wave. This test condition is chosen to simulate the working condition when it is finally connected to an RS-232 PC communications port. A 20dB attenuator is used at the analyzer input to prevent input overloading. The picture on the right shows the resulting trace scan at 100kHz span. Antenna hand effect was also measured and turned out to be less than 30KHz.
The transmitter output scanned to 1MHz span. Here, it also indicates a 0dbm (1mW) output for the transmitter. This low output makes it less likely to cause harmful interference to an appliance or equipment operating near it.
8/16-bit Wireless Remote Output
Page 10
The transmitter output at full 2.6GHz span shows its spurious output signals. The second harmonic is 18db below the fundamental. The remaining harmonics are at least 30db below. We are currently measuring the short term and long term frequency drift, and how it behaves with changing temperature. We will publish the results when data becomes available.
8 PARALLEL INPUTS REMOTE CONTROLLER If your application do not require a PC (such as microcontroller based circuits ), or you just need a remote controller with push button functions, an 8input remote controller transmitter is also available. The operation of the controller is straightforward. The z8 microcontroller constantly read the inputs, if a change is detected, the new input states is transmitted via the UC1817 transmitter module into the correct communications format. The receiver module then perfoms the action, as described in the Circuit Explained section of this article (page 2), turning ON or OFF its output port corresponding to the inputs of this controller. The remote controller inputs can, at your option, be configured in push-on/push-off mode : push to turn it on, push a second time to turn it off, a very useful feature with push button operation. The board comes complete with 8 push button switches (soldered on the copper side). A snap-on wafer connector connects it to a controller circuit of your choice. The full schematic diagram of the controller is shown in figure 12.
Page 11
Figure 10. 8 parallel inputs remote controller module.
Z8 Microcontroller
UC1817 Transmitter
8 inputs Figure 11. Block diagram of the remote controller
Copyright 2005 e-Gizmo Mechatronix Central
CON2
1 2
J6
R20 10K
R19 10K
R18 10K
R17 10K
R16 10K
R15 10K
R14 10K
R13 10K
3.5874MHz
C1 22pF
4
1
4
1
C2 22pF
3
XTAL1/CE XTAL2
2
SW5
3
2
5
P31/OE P32/EPM P33/VPP
SW1
7 6
CON2
Y1
8 9 10
1 2
J8
GND 1
4
1
4
14
2
SW6
3
2
SW2
3
1
4
1
4
2
SW7
3
2
1
4
1
4
R5 R6 R7 R8 R9 R10 R11 R12
SW3
3
15 16 17 18 1 2 3 4
11 12 13
2
SW8
3
2
SW4
3
10K 10K 10K 10K 10K 10K 10K 10K
C4 0.1u
CON9
1 2 3 4 5 6 7 8 9
J4
R4 2K2
LED
D2
+
C5 47u
R3 2K2
2
3
VIN
U2 L7805/TO220
Q1 MPS3469
+
1 2 3 4 5 6
J1
1
CON6 UCN3815 CON6 TRANSMITTER MODULE
1 2 3 4 5 6
J3
R21 RESISTOR
Figure 12. Schematic diagram of the 8 parallel inputs remote controller.
P20/D0 P21/D1 P22/D2 P23/D3 P24/D4 P25/D5 P26/D6 P27/D7
P00/CLR P01/CLK P02/PGM
Z86E02
VCC
U1
1 3
R1 10K
GND 2
R2 10K
+
C6 100
Page 12 8/16-bit Wireless Remote Output
BILL OF MATERIALS Receiver Module ITEM
QUANTITY
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 17 21 22 23 24
1 2 2 1 1 2 1 2 1 1 2 1 1 1 1 1 1 1 1 1
25
9
26 27 28 29 30 31 32 33 34 35 36 37
1 1 2 1 1 1 1 1 1 1 1 1
REFERENCE
PART
C1 C2,C5 C3,C18 C4 C6 C7,C9 C8 C11,C12 C13 C14 C15,C16 C17 D1 D4 J1 J3 L1 L2 Q1 R1 R2,R5,R7,R9,R11,R13, R14, R15,R17
0.5pF Ceramic NPO 330pF Ceramic SL 1n Ceramic SL 1pF Ceramic NPO 4n7 Ceramic SL 47u/10V Electrolytic 4u7 Electrolytic 27p Ceramic SL 220u/6v3 Electrolytic 100u/16V Electrolytic 0u1 Multilayer Ceramic 39p Ceramic SL 1N4148 Signal Diode LED 3 or 5mm diameter 9 pin header connector with lock CROWN JACK 2u2H Adjustable Coil 2SC3707 5k6 1/4 watt carbon film resistor
R3 R4 R6,R8 R10 R12 R16 U1 U2 U3 Y1
6K2 1/4 watt carbon film resistor 22K 1/4 watt carbon film resistor 1M2 1/4 watt carbon film resistor 56 1/4 watt carbon film resistor 220K 1/4 watt carbon film resistor 220 1/4 watt carbon film resistor Z86E04 - RFW Microcontroller IC LM358 OPAMP IC L7805/TO220 Voltage Regulator IC 3.583MHZ Crystal PCB - receiver AWG #25 solid insulated wire, 35cm long
ANT
10K 1/4 watt carbon film resistor
Transmitter Assembly 2 1 1 1 1 1
1 2 3 4 5 6
Page 13
R1,R2 D1
JDR1 ANT
27 ohms 1/4 watt carbon film resistor 5V1 1/2W Zener Diode UC1817 (Modified) RF Module PCB Dsub-9 Female, PC Mount AWG # 16 solid TW wire, 35cm Long
Copyright 2005 e-Gizmo Mechatronix Central
PCB ARTWORKS Important: For personal use only. Commercial reproduction is strictly prohibited!
Transmitter Component Layout
Transmitter Copper pattern (shown on component side)
8/16-bit Wireless Remote Output
Page 14
PCB ARTWORKS Important: For personal use only. Commercial reproduction is strictly prohibited!
Receiver Component Layout
Receiver Component side
Receiver Copper pattern (shown on component side) Page 15
Copyright 2005 e-Gizmo Mechatronix Central
PCB ARTWORKS Important: For personal use only. Commercial reproduction is strictly prohibited!
Remote controller component Layout
Remote Controller component side (Jumper)
Remote Controller Copper pattern (shown on component side) 8/16-bit Wireless Remote Output
Page 16