Mark's Next Challenge: Getting the Internet on His Watch
February 23, 2004
When he found a bunch of surplus miniature, alphanumeric LED displays, he knew he had the makings of a watch-but how far to go? Adding a barometer, altimeter, and temperature sensor makes it a perfect outdoor accessory. The coup de grace is the Trippy Bits / four letter word function-random bits sent to the display followed by a random four-letter word. It's better than TV.
Wrist-mounted entertainment center parts list
Amt | Part Description | Allied Part # |
---|---|---|
1 | Battery holder, plastic | 839-3480 |
1 | Resistor chip, 4700 ohm | 644-2120 |
1 | Resistor chip, 1000 ohm | 644-2306 |
1 | Transistor, 2N3904 | 263-0429 |
1 | Crystal watch, 32.768 kHz | 614-0190 |
1 | Schottky diode | 950-1512 |
1 | Capacitor, multi-layer ceramic | 644-0260 |
1 | Double-row pin header interconnect | 900-2045 |
This project is the culmination of a lifetime obsession with all kinds of watches. I was too young in the early 1980s to afford the television watch or the tape recorder watch (yup, tape recorder) so I got stuck with a Casio model F-10. Finding a bunch of Hewlett Packard HCMS2010 4 character alphanumeric displays in a local surplus store got my imagination fired up about making my own watch. I had read about the Nixie Tube wristwatch, "The Four Letter Word"(an art project that flashes random four letter words), and various homebrew altimeters. I decided to cram as many of these things into a reasonable sized wristwatch as I could. I also wanted to have something useful to accompany me on my trail running adventures. The ability to log altitude data will allow me to keep track of how many miles I run - perpendicular to the earth's surface!
Hardware
A well laid out, solder-masked printed circuit board is essential for this circuit. There are many companies in existence that will do small orders for a reasonable price, some of which even provide their own software. The cost of the circuit board is well worth the aggravation saved by not using a plug-in prototype breadboard.
The display draws about 150mA, depending on how many LEDs are illuminated, which rules out standard watch cells as a power source. Three AAA cells are not too much bigger than many commercial altimeter / thermometer / compass watches, so this was the logical choice. N cells would have made the whole thing narrower but they are more expensive and not as common. Carefully controlling the hardware (making sure no inputs float, making sure everything is shut down that can possibly be shut down, and making sure nothing is trying to drive a pin on a part that is powered down) keeps the sleep current to about 2 microamps.
The body of the watch is simply the battery holder itself. A nylon watchband is sandwiched between the printed circuit board and the battery holder, held in place with silicone adhesive.
Keeps on ticking and so much more...an inside look at Mark's watch& |
A PIC16F73 microcontroller running at 4MHz is the brains of the operation. The firmware is written in C, and a connector is provided for in-circuit program updates. The PIC's hardware SPI port provides high-speed communication with the HCMS2010 display and an LTC2411 24-bit ADC. The display contains a 28-bit shift register corresponding to the 7 dots in a given column of each 5x7 character. 5 column lines select which column to light. Five I/O pins have voltage dividers and emitter followers to provide about 3 volts at high current to the display's column lines.
Most home built altimeters (and many commercial ones) use a standard 3-amplifier instrumentation amplifier at a very high gain and a 12 to 16 bit ADC. I used an LTC2411 24 bit ADC that has a resolution of 1.45 microvolts, eliminating the need to amplify the Novasensor barometric pressure sensor's 100mV output. In theory, this setup has a resolution of about 8 inches of altitude change. In practice, it is about several feet.
Three devices are on the software driven I2C bus: a temperature sensor, real time clock, and 32k of nonvolatile memory. I took the easy way out with the temperature measurement and timekeeping; a Fairchild FM75 pre calibrated temperature sensor provides a digital temperature output at a resolution of 1/16 degrees C and a MAX6900 real-time clock keeps track of time. A 25LC256 EEPROM provides 32k bytes of storage for logging altitude and temperature data.
A Fairchild FDN306 P-channel FET controls power to the display and pressure sensor, as these devices would quickly drain the battery if left energized continuously.
Firmware
This project was a valuable learning experience in C programming for microcontrollers, which is arguably the most valuable skill a mixed signal application engineer can have. The firmware shows how to communicate with I2C and SPI peripherals, how to manage power consumption, how to use lookup tables, arrays, structures and unions, fixed point integer math, and the use of interrupts to make tasks like multiplexing the display transparent to the main program.
On power-up, the PIC initializes its internal registers including I/O port direction registers, SPI port configuration, and interrupts. It makes sure the power to the display is off, sets the FM75 to standby mode, and puts itself to sleep. Pressing one of the four buttons wakes up the PIC, which then reads which button is pushed and carries out the appropriate action.
An interrupt service routine updates the display shift register through the SPI port and sequences through the columns every 20ms. The main program writes to the display in one of three ways - directly to a character buffer containing four ASCII coded characters, through the "to_screen" subfunction that is called by the standard "printf" function (useful for formatting numerical data), or directly to the five 28-bit shift register buffers that control the individual dots. This is an example of "non-critical" interaction between a main program and an ISR. Even if there is a clash between the main program writing to the buffer and the ISR reading the buffer, the only result is an imperceptible blip in the display.
Functions
TIME/DATE simply reads and displays the time and date information from the real-time clock. As the time and date are being displayed, the TEMP and SURPRISE buttons can be used to set the time by incrementing the hours and minutes or month and day, respectively.
ALTI/BARO tells the LTC2411 to perform a conversion, converts the result to barometric pressure, and displays this information in millibars (altitude calculation is in development!!) Since the LTC2411 is on the same SPI bus as the display, this function must disable the display ISR to prevent corruption of ADC data.
TEMP brings the FM75 out of standby, reads and displays the temperature in degrees C, and then puts the FM75 back into standby mode.
SURPRISE grabs data from the PIC's internal timers and dumps it to the display's shift register for 2 seconds. The effect is sufficiently random to look like television "snow." Next it generates and displays a random four letter word. This algorithm is courtesy of Raymond Weisling (http://zetalink.biz/produ.html) who has created many four letter word projects. There is a lookup table for each of the four character positions containing the most common 10, 8, 10, and 10 characters for a large number of English four letter words. The PIC reads the real time clock and exclusive-Ors the 16 bit timer with the minutes and seconds to generate a random number seed. Once again, the effect is random enough that no pattern is distinguishable (at least to this human being.) Purists can use a linear feedback shift register to generate more randomness.
Future Plans...
There is still more to do. In the works are the altimeter equations, which will take the difference between the pressure recorded at the beginning of a journey and the present pressure and calculate the altitude change. A 1 millibar pressure drop corresponds to about 27 feet of elevation gain at sea level.
Data logging - the plan is to enable the watchdog timer such that it wakes up the processor at some interval, checks the time, and saves a pressure / temperature data point if some interval has passed. Data can then be dumped to a computer through the PICs serial port and captured with a terminal program.
Also, a nice looking enclosure would be good...
For a pdf schematic of Mark's watch, click here. For microcontroller source code, watchc.pdf, watchh.pdf, and misc1c.pdf
About the Author
You May Also Like