Ying-zong Huang

EE281 Project,Stanford University, Fall 2002

Wireless Freeform Input Device




The project hardware is implemented on standalone perforated boards. Testing was done with the help of the STK500 evaluation boards from Atmel. The three main parts of hardware system are: the AVR Mega232 microprocessors, the accelerometer, and the radio modules. Click on the hardware page for hardware design choices, schematics, and parts list.

The software is implemented on the AVR Mega232 microprocessors using both C and AVR assembly. Click on the software page for software design choices and code listing.


During normal operation, two PWM outputs are taken from the accelerometers and read into AVR port pins. At the same time, each edge change on the accelerometers triggers an input-capture interrupt on the AVR, during each of which the line levels of the PWM inputs and a 16-bit timestamp are recorded into a buffer.

In the background, the timestamps together with the line levels are decoded into on-time and an off-time time durations. There is the possibility that two edge changes overlap, and some of these are not known to the AVR, so the process also probabilistically corrects for those. The on-times are written into another buffer.

It is not very easy to do accurate division of on-time by the sum of on-time and off-time to get the duty cycle, so we make the assumption that the duty cycle period does not change very much. The off-time is available, however, if needed.

Next, a first-order low-pass Butterworth filter implemented as an IIR filter runs through the on-time buffer and produces slow-varying version of the accelerometer data. This is considered the tilt data. We then normalize this to an 8-bit range and center this value to a user-defined "zero" tilt. We add in a dead-zone around "zero" tilt. Then, we combine this with the states of the pushbuttons on the transmitter to generate a 3-byte serial mouse packet to tell the computer to move the cursor by an amount proportional to the tilt and to generate mouse button events.

The serial mouse packet is sent across the radio link with one inversion so that the modulator is off while idling. The receiver end gets the packet and runs it to another AVR, whose task at this point is only to echo the packets to the serial port of a host PC.

The PC, with its mouse driver, decodes the serial mouse packet and moves the mouse cursor and clicks buttons.


In the end, the core of the project, including the hardware, was completed as proposed, with one main deviation: the device was proposed to be positional-, not tilt-based. As suspected, positional information cannot be reliably derived from a two-dimensional projection of the force vector. A probable solution is to implement the extended part of the proposal, with at least three dimensions of data on the force, but this was not done due to time constraints. The mode of input was therefore changed to provide a working, reliable input device, which is the main goal of this project, as well as to demonstrate what is feasible, and to provide a platform for testing various processing algorithms.