logo1.bmp (61374 byte)



designs f.a.q.


crc guide who am I ? awards


RF pad (doubles as serial-pad)

combination-controlled, fully customizable radio frequency remote control

  • 2 years operation from a 9V battery (8uA in standby)
  • up to 16 keys in a 4 by 4 matrix, fully configurable
  • key-bleep on every key
  • three separate combinations, expandable
  • full source code provided (GNU C vompiler for AVR)
  • replaces remote controls based on MM53200, UM3750 and UM86409
  • 433.92 MHz output (other frequencies changing module)
  • ASCII serial output for using as serial keyboard with PC or Basic Stamps


Perfect as a remote replacement for access control and for switching on/off burglar alarms, it emits an RF code every time you digit the correct combination on its keyboard.

Three different combinations for three different actions can be entered at program-time. The keyboard layout is configurable, too: you can use any matrix up to 4 rows by 4 columns, assigning your own ASCII codes to each key.

The code is compatible with popular remote controls as well as Nut chips (see also the Nut-based burglar alarm project).

Alternatively, you can drop off the RF part and use it as serial keyboard. Keypresses are available as ASCII codes at pin 3, allowing direct connection to a Basic Stamp and similar controllers. Connecting to a PC requires a polarity inversion (the Nut chip interface is suitable for that job).


my prototype uses only 12 keys out of the 16 theoretically available

The circuit (full schematic here)

I don't like to reinvent the wheel, but I was surprised by the number of components involved in the "Wake up on keypress" application note from the Atmel's web site. You know, I like simplicity, so I dropped off almost everything.


The software

RF pad is written in GNU C. The good news is that this is is an excellent free compiler, ANSI compliant, with legendary portability between many platforms. The bad news is that it is difficult to set up and master at first time (this may be due to the fact it is developed by very clever people). If you have never seen a command-line compiler before and you are unfamiliar with commands like make and compiler flags be prepared for an hard work.

Fortunately, you don't need the compiler to make an RF-pad, and you can customize your RF pad without recompiling the code, just editing a few bytes at program time.


The prototype

I built my prototype from a perf board (veroboard). With so few components involved, a PCB is not really necessary. The board is big enough to host the battery, put in place with biadhesive tape. On the solder side, a 10 cm. long wire forms the antenna.

The keyboard is a surplus one from a telephone, using only 12 of the 16 keys theoretically available.
The big black buzzer is a 9 volt type instead of 5 volt, but it works as well at lower voltages.
The AVR micro is placed on a socket: it could be reprogrammed in-system, but in practice I found faster to remove it and place into the programmer instead of wiring an appropriate connector.

The whole circuit is housed in a nice plastic console: the hard part is cutting the keyboard hole. It needs a good shaw, a set of files, a firm vice, and lots, lots, lots of patience to get a clean result.

my prototype, opened


Files available:

Download or view on-line the RF pad schematic (28kB .GIF file)

Download the RF pad sources, executables, schematic in one .ZIP file (53 kB).


Customizing RF pad

Customizing the key matrix

The key matrix of my prototype comes from a surplus telephone and it is like this:

1 2 3
4 5 6
7 8 9
 * 0 #

It's a 4 rows by 3 columns keybaord, so it uses only 12 of the 16 keys handled by RF pad.
However, the code is pre-programmed for a layout like this:

1 2 3 A
4 5 6 B
7 8 9 C
 * 0 # D

You can choose any layout you wish as long as it fits in a 4 by 4 matrix. You can simply omit any key without changing the software. You can assign any ASCII code to your keys based on key's position. The only ASCII code you can't assign is NULL, that evaluates to zero.

If you have the GNU C compiler you modify the keyboard matrix initialization:

//keyboard ASCII matrix, replace your own characters here
//DON'T USE 0x00 as it breaks string compare
const unsigned char keys[MAX_ROWS][MAX_COLUMNS] =
{ {'1', '2', '3', 'A' },
  {'4', '5', '6', 'B' },
  {'7', '8', '9', 'C' },
  {'*', '0', '#', 'D' } };

The following code changes the keyboard from "telephone" (with 1 at top-left) to "calculator" layout(with 7 top-left).

const unsigned char keys[MAX_ROWS][MAX_COLUMNS] =
{ {'7', '8', '9', 'A' },
  {'4', '5', '6', 'B' },
  {'1', '2', '3', 'C' },
  {'*', '0', '#', 'D' } };

(Note that you must initialize all 16 keys even if you don't use them all.)

If you don't have the compiler (or you don't want to recompile) then modify the executable prior to programming the chip. The following example shows how to do the same modifications with Pony Prog.

  1. Select the AT90S2313 and load the rf_pad.rom file. Scroll the hex window until you see the keyboard matrix (It is located near the end of the program, address is $34E). Here I highlighted it in yellow:

  2. Select "Edit buffer enabled" from the "Edit" menu. This allows you to change the hex or alpha codes by clicking them.

  3. Change the codes to get the following:


Changing combinations and RF codes

If you have the GNU C compiler, it is simply a matter of changing some #defines:

//replace here your own ASCII key combination / 12 bit rf codes pairs
//very important: the combination must be the same length as
//the key_combination[] (see below)
#define COMBINATION_1 "111111"
#define RF_CODE_1 0xAAA    //will be AA 0A in code dump
#define COMBINATION_2 "222222"
#define RF_CODE_2 0xBBB    //will be BB 0B in code dump
#define COMBINATION_3 "333333"
#define RF_CODE_3 0xCCC    //will be CC 0C in code dump


If you don't have the compiler, you can "hack" the executable as explained above:



designs f.a.q.


crc guide who am I ? awards
home | nutchips | designs | f.a.q. | provokations | crc guide | who am I ? | awards