|
combination-controlled, fully customizable radio frequency remote control
|
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).
|
|
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.
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.
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 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 |
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).
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.
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:
|