Monday, October 11, 2010

DIY hard drive clock (part 5)

PIC18F2320 based controller for hard drive clock.

Hard drive clock is powered by Microchip PIC18F2320 clocked at 40MHz.
PIC18F2320 is a fast and versatile microcontroller with hardware I2C serial interface and plenty of I/O ports to handle communication with all external modules.

Actually, any medium range microcontroller can be adapted for this project. I have quite a collection of various PIC microcontrollers and I've chosen chip with excess of memory and I/O ports to allow some modification in the future.      

PIC18F2320 based clock controller.

Controller is assembled on a double sided home-made PCB which was fabricated using proven heat toner transfer method.

Home-made double sided PCB for clock controller.

Compact sized board bundled with LCD, hosts PIC18F2320 microcontroller with clock crystals, LED switching MOSFETS and real time clock module.    

Clock controller, LCD, RTC.
Upon powering-up microcontroller reads current time and date from external RTC and use this data to initialize internal clock. To stay synchronized with RTC module, microcontroller requests latest time data from external RTC and refreshes internal variables every hour.

To multitask parallel operations microcontroller employs two independent internal timers.

Short interval timer0 is dedicated for measuring time of full disk revolution.
External interrupt function resets Timer0 upon signal from index sensor. Current time value is used to calculate precise moment for LEDs to switch ON and OFF. Because of that, clock displays correct position of clock hands regardless of disk RPM.

Clock controller assembled.
Long interval timer1 is connected to external 32768 Hz watch crystal and configured as real time clock with period 0.25sec. Timers interrupt sets control flags to inquire start service routines in main program loop.

Main program loop is used to check and reset control flags, scan keyboard, refresh LCD, recalculate latest position of clock hands and toggle RGB LEDs accordingly.

LCD with blue backlight.

Controller is connected with external modules via 8 connectors and whole unit can be easily taken apart and reassembled back.

Keyboard assembly contains two illuminated buttons which are used to set correct time, date and select clock mode.
Current time, date and service information are displayed on LCD.

Free for noncommercial use technical notes include:
- schematics;
- PCB in PDF format;
- BOM;
- HEX file for PIC18F2320;
- C source code for CCS compiler.
Hardware documentation available for download.
Firmware documentation  available for download.

(part 4)<--- DIY hard drive clock ---> (part 6)

1 comment:

  1. wauw, that design looks really neat. i love the way you put alot attention to detail and how everything fits perfectly. good work!