01/\/atch using PIC16F913 microcontroller
The 01/\/atch, because… “there are 10 types of people in the world, those who read binary, and those who don’t”
– a slashdot tag line.
The 01/\/atch is a binary wrist watch with an LED display. Additional features are accessible through a scrolling menu system on its 3×4 LED matrix. Current features include: voltage meter, binary counter, club mode and time display. The watch is fully programmable. Future firmware upgrades will include: stopwatch/timer, alarm, bicycle speedometer/odometer, data logging, and an advanced configuration menu.
See it in action: http://www.youtube.com/watch?v=l_tApl3JmmM
All the project files are in the .zip archive on this page. Schematic and PCB in Cadsoft Eagle format. Firmware in mikroBasic. The text of this instructable is included as .odt (OO.org/open text) and .pdf files. The top-layer PCB art (mirrored) is included as a .PDF ready for toner transfer or foto process. It is copied several times on a single sheet because I have to double-up on transparencies.
The 01/\/atch was inspired by the Mini Dotclock, and a subsequent conversation in the comments area:
This is also a half step towards a surface mount nixie watch I am working on. The 01/\/atch project is an introduction to surface mount components and time keeping logic without the added complexity of a nixie tube power supply. (http://www.instructables.com/ex/i/2C2A7DA625911029BC6B001143E7E506/?ALLSTEPS )
A little googling turned up this binary watch at thinkgeek: http://www.thinkgeek.com/gadgets/watches/6a17/
The 01/\/atch is based on a PIC16F913/6. This PIC was originally chosen because it had a hardware LCD driver. I thought that I could turn the LCD driver into a LED multiplexer with a few transistors. This turned out not to be the case. Its still a good choice because it has tons of programming space and very few limited I/O pins. The F913 is about $2.00 at Mouser.
PIC16F916 Details (same as 913, with more program space):
PIC16F913/6 Datasheet (PDF format):
The 3d images used in this instructable were made from the Eagle Board files with Eagle3D and POV ray:
The binary display is made of 12 LEDs in a 3×4 matrix. Each column of four LEDs represents a four bit ‘nibble’, or half byte. Each column can display 0-15 in binary (1+2+4+8=15). Time is displayed in the three rows as hours/tens of minutes/minutes. This is not true binary, but a simplified subset that makes the watch easier to read. The thinkgeek watch, for example, uses ‘truer’ binary to represent minutes with a whole byte. Whichever I might prefer, the true geek would display time using the Unix epoch, in binary! ( http://en.wikipedia.org/wiki/Unix_timestamp )
The LED multiplex is straightforward. Rows (4) connect to pins of the PIC through current limiting resistors. Only one current limiting resistor is used for each row because only one LED per row is ever lit. The LEDs are run at 20ma, using 56 ohm resistors (56ohm @ 3 volts=20ma). The LEDs could be run higher because they are multiplexed, the datasheet listed something around 40ma. I find them to be too bright at only 20ma-multiplexed.
Columns (3) are connected to ground by NPN transistors. The transistors are switched by PIC pins through 1Kohm resistors. The multiplex functions by grounding a column of LEDs through the transistor while lighting the correct LED rows for that column. This is repeated for each column in short succession, making the matrix appear to be continually lit. PIC Timer0 is drives the multiplex. It counts to 256 then changes row values and the grounded column.
NPN Transistor, NPN/ 32V/ 100mA, (Mouser #512-BCW60D $0.05).
Mouser Part # Manufacturer Color Cost
859-LTST-C171KRKT Lite-On SMT LED Red, Clear $0.130
859-LTST-C171KSKT Lite-On SMT LED Yellow, Clear $0.130
859-LTST-C150KFKT Lite-On SMT LED Orange, Clear $0.130
638-121SURCS530A28 Everlight LED SMD Red Water Clear $0.110
638-1121UYCS530A28 Everlight LED SMD Yellow Water Clear $0.110
Everlight red and yellow were used on the prototype watch. I like Lite-On red and orange better, they will be used on the next watch I make.S
“A Darlington pair is sufficiently sensitive to respond to the small current passed by your skin and it can be used to make a touch-switch as shown in the diagram. For this circuit which just lights an LED the two transistors can be any general purpose low power transistors. The 100kohm resistor protects the transistors if the contacts are linked with a piece of wire.”
A PNP transistor was added to this simple design (in place of the LED in the diagram) so that it could give a high/low output to the PIC. A pull-down resistor was added between the PIC pin and ground to help prevent false button presses. This switch is solid state, water proof, and low power – with the added geekieness of pin headers.
Switches are de-bounced using Timer2 on the PIC. When a switch is pressed, Timer2 (8 bit timer) is started with a 16 prescaler and 16 postscaler. On Timer2 interrupt the PIC checks to see if the buttons are still pressed. After two consecutive interrupts with no buttons pressed the timer is stopped and the buttons are configured for further input.
The top switch is connected to the PIC interrupt pin. Input on this pin can bring the PIC out of sleep mode. This lets us use a neat power management technique: the PIC is in low power mode when the display is not in use. Input on the buttons wakes the PIC and resumes operation.
Darlington Transistor, SOT-23, (Mouser #512-MMBT6427, $0.07).
PNP Transistor, SOT-23, (Mouser #512-BCW89, $0.06).
( http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011057)The clock is simple and elegant. A 32.768kHz watch crystal is connected to the timer1 oscillator pins of the PIC. Timer1 is great for this because it can increment even while the PIC is sleeping. Timer1 is setup to count to 65536 (2 seconds at 32.768kHz) and wake the PIC from sleep with an interrupt. When the PIC wakes, it increments time by two seconds. The PIC is only active and consuming power for a brief time every few seconds.
I used a cheap quartz watch crystal from Citizen. I though the Citizen name might give my watch legitimacy. The CFS206 (12.5pf) has about +/- 1.7 minutes accuracy per year (20ppm). Two 33pF capacitors complete the external crystal circuit. 33pF is probably a tad much, but it was available locally at a reasonable price. A better crystal could be used for more accurate time.
Crystal: Citizen KHz Range Crystals, 32.768 KHZ 12.5pF, (mouser #695-CFS206-327KFB , $0.30).
Capacitors: 2x33pF, 1206 SMD.
We recommend EasyEDA for electronic circuit design.
From Schematic to PCB Production, Just Need One Tool
Free Circuit Design Software: learn to use Editor quickly and easily
Cheapest PCB: 10pcs 2-layers 10cm×10cm only $8.21, 3-day build time, 100% E-test
Current Project / Post can also be found using:
- микроконтролер timy 913