1 Introduction
The following article describes an inexpensive RF communication
system for the MIT Handy Board or any Motorola 68HC11 based microcontroller.
Also with a few modifications, you can use this simple design for the Basic
Stamp microcontrollers or other microcontrollers of your choice--so experiment!
The RF transmitter and receiver module that is desribed in this article
comes from MING Microsystems and they are avaiable through Digikey
($11 each). The transmit/receive data rate is 1200 baud with 1 stop
bit and no parity. For most applications 1200 Baud is great for transferring
simple commands or data. This simple and inexpensive communication
system is ideal for small robot projects that require data transfer between
multiple systems such as to and from a host computer or between multiple
robots. The range is rougly 35-70 feet depending if you are indoors
or outdoors. Figure 1 below shows two Handy Board microcontrollers,
one with an RF transmitter and the other with an RF receiver.
Figure 1. Handy Boards with RF transmitter
& receiver.
2 Transmitter
Figure 2 below shows a circuit diagram for the transmitter
portion of the communication system. The MING transmitter board has
only three input pins (+V, Ground, and Data Line). The MING
systems comes pre-tuned at 300MHz and ready to operate out of the package.
The MING transmitter/receiver units are designed to accept RS232 serial
data, but with a few modifications, they can be easily interfaced to the
MCU of your choice as we shall see below for the MIT Handy Board.
In Figure 2, the top transistor circuit is simply an inverting
circuit that inverts the transmit data from the Handy Board microcontroller
to the MING transmitter module. Power the MING system with standard
+5V and add a 0.1uF bypass capacitor to smooth out any possible voltage
spikes coming from the power source. Notice that the optional LED
indicator cirucit is not required for proper operation. The LED in
the circuit flashes when data is being transmitted by the MCU, which is
useful for debugging purposes. To transmit data, have either the
Handy Board or other MCU send out data at 1200 baud with 1 stop bit and
no parity. The range of the RF transmitter/receiver system
is roughly 35-70 feet depending if you are indoors or outdoors--outdoor
range is higher. Sample code for the Handy Board is included at the
bottom as well as assembly code for the Motorola HC11 MCU.
Figure 2. RF Transmitter Circuit for the
Handy Board
2.1 Sample Tx code for the MIT Handy Board
I highly recommend that the following code be downloaded
into the Handy Board and used for testing. The sample code simply
configures the serial transmit line for 1200 baud and sends out an 8-bit
number from 0 to 255 every second and then repeats. Use this code
with the receiver below unit for testing.
/*
TX.C Kam Leang 1999 Serial Transmit Program for HB*/
void main(){
int i;
printf("Tx: Press Start\n");
while(!start_button()){} /*Wait for user to push
start button on HB*/
poke(0x102b,0x33); /*Set
serial baud rate to 1200*/
i=0; /*Initialize counter*/
while(1){ /*Infinite loop for transmitting*/
if (i>255) /*Reset the counter when i>255*/
i=0;
while (!(peek(0x102e) & 0x80)){} /* Wait for serial transmit
register to be empty */
poke(0x102f, i); /* send character */
printf("Tx Char=%d\n",i); /*Print Tx value to LCD*/
i=i+1; /*Increment counter by 1*/
sleep(1.); /*Delay for 1 second*/
}
}
2.2 Sample ASM Tx code for Motorola 68HC11 MCU
Click to download tx.asm code for
68HC11E2 (Botboard) MCU. Use a compiler such as Rapid or AS11 to
compile tx.asm code into tx.s19 format and then download the program to
a Motorola 68HC11 MCU. The program simply transmits 8-bit data specified
by the user. Use this program with RF receive program below for testing
the MING RF serial communication system.
3 Receiver
Figure 3 below shows the circuit diagram for the RF receiver
module and the additional external circuitry required for interfacing it
to the MIT Handy Board microcontroller. Similar to the transmitter
module from above, the top transistor circuit inverts the received RF serial
data from the MING Rx module before going into the Handy Board.
The optional LED indicator circuit is used for bebugging and testing.
The LED flashes when data is being received by the RF module. The
range of the receiver can be increased by incorporating an antenna based
on the manufactures specifications. Sample code for both the MIT Handy
Board microcontroller and Motorola 68HC11 MCU is included below.
Figure 3. RF Receiver Circuit Diagram for
the Handy Board.
3.1 Sample Rx code for the MIT Handy Board
The sample code below simply waits for a data and then
displays it on the LCD. Download the following code into the Handy
Board to test RF receiver module.
/*
RX.C Kam Leang 1999 Serial Transmit Program for HB*/
void main(){
int i;
printf("Rx: Press Start\n");
while(!start_button()){} /*Wait for user to push
start button on HB*/
poke(0x3c, 1); /*Disable pcode character receive mode*/
poke(0x102b,0x33); /*Set
serial baud rate to 1200*/
poke(0x102d,0x04); /*Enable receiver*/
i=0; /*Initialize counter*/
while(1){ /*Infinite loop*/
while (!(peek(0x102e) & 0x20)); /* Loop until
character is received*/
i=peek(0x102f); /*Transfer data from receive buffer*/
printf("Char Rx=%d\n",i); /*Display character on LCD*/
sleep(.2); /*Delay 0.2 seconds*/
}
}
3.2 Sample ASM Rx code for Motorola 68HC11 MCU
Click to download rx.asm code for
68HC11E2 (Botboard) MCU. Use a compiler such as Rapid or AS11 to
compile rx.asm code into rx.s19 format and then download the program to
a Motorola 68HC11 MCU. The program simply waits for serial data and
then sends the received data to PORT C. Connect LEDs to PORT
C to see data.
4 References
The author would like to acknowledge the following sources
of information related to this article.
-
Sheldon, Ryan Naked Data Nuts
& Volts Magazine, May 1998, pp. 85-89
-
Motorla M68HC11
Reference Manual Rev. 3 M68HC11RM/AD, Motorola 1991
-
The MIT Handy Board web site http://handyboard.com
5 Vendors
Here is a list of vendors to get parts:
-
Digikey
MING Microsystems distributor
-
Radio Shack
Basic electronic components such as resistors, capacitors, LEDs, etc.
-
Gleason
Research Preassembled Handy Board distributor.
-
Douglas Electronics
Distributor of blank Handy Board PCBs
|