One embodiment of the writing instrument described herein comprises a pen-like device containing three accelerometers and three gyroscopes. Data from these sensors are processed via an Euler transform. Prior to using the writing instrument, the user holds the writing instrument in multiple predefined positions and sensor readings are taken. The sensor readings are mapped to the corresponding predefined positions. In addition, the sensor readings are compared to expected sensor readings to compensate for environmental variations such as altitude or temperature as well as for the possible tilt of a writing surface. The sensor readings are interpolated to map sensor readings other than those at the predefined positions to other writing instrument positions. When the user writes with the writing instrument, sensor outputs are used to track the writing instrument to define strokes made by the user. The data describing the strokes may be stored or processed to accomplish a variety of tasks including faxing a message, recording information, etc.