Editing PIC based Stepper Motor Dancing Analog Clock

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 10: Line 10:
 
This is an analog clock, with real hands driven by stepper motors.  A clock for the confused dyslexics amoung us, for more informatinon on Dyslexia see DAM ( Mothers Against  Dyslexia ). Because stepper motors are quite powerful the clock could be made quite large, 3 feet in diameter is probably within reach still using inexpensive ( salvage ) stepper motors.  The project description includes eagle files for the circuits and a BoostC project with source code for the PIC.
 
This is an analog clock, with real hands driven by stepper motors.  A clock for the confused dyslexics amoung us, for more informatinon on Dyslexia see DAM ( Mothers Against  Dyslexia ). Because stepper motors are quite powerful the clock could be made quite large, 3 feet in diameter is probably within reach still using inexpensive ( salvage ) stepper motors.  The project description includes eagle files for the circuits and a BoostC project with source code for the PIC.
  
 
+
Comming Soon:  I have a second physical version of the clock that looks much nicer, including real clock hands.  Code has been improved a lot as well.
News:
 
* May '09  C code was missing from archive, this has been fixed.
 
 
 
* Comming Soon:  I have a second physical version of the clock that looks much nicer, including real clock hands.  Code has been improved a lot as well. ( code updated in new download below )
 
  
 
[[Image:ClockFace.png  | Clock Face ]]
 
[[Image:ClockFace.png  | Clock Face ]]
Line 371: Line 367:
  
 
=== Program ===
 
=== Program ===
 
==== Overview ====
 
  
 
Nothing very fancy here.  The 60 Hz input is fed to the port x interrupt.  This lets the PIC keep time.  The hands are not moved during the interrupt instead flags requesting hand movement are set and the main loop moves the hands.
 
Nothing very fancy here.  The 60 Hz input is fed to the port x interrupt.  This lets the PIC keep time.  The hands are not moved during the interrupt instead flags requesting hand movement are set and the main loop moves the hands.
Line 385: Line 379:
  
 
==== Compiling ====
 
==== Compiling ====
The zip file contains the entire source bootst project.  Unzip into a directory and open in source boost.  There are some additional notes at the top of the main source file.  Follow the instructions there, they will tell you about any compiler and/or linker options, and report on memory usage from a recent compile of mine. The compile should run without error.  
+
The zip file contains the entire source bootst project.  Unzip into a directory and open in source boost.  Set the target to 16F877A and change the linker options ( Settings -> options -> linker "-v  -swcs 6 2" ) My compiler reports something like:
 +
 
 +
Memory Usage Report
  
If you do not wish to compile you can use the precompiled hex version also included in the zip archive.
+
*RAM available:368 bytes, used:154 bytes (41.9%), free:214 bytes (58.1%),
 +
*Heap size:214 bytes, Heap max single alloc:95 bytes
 +
*ROM available:8192 words, used:4156 words (50.8%), free:4036 words (49.2%)
  
 
=== Building the Clock ===
 
=== Building the Clock ===
Line 402: Line 400:
 
=== Running the Clock ===
 
=== Running the Clock ===
  
==== Without the Serial Interface ====
+
==== With out the Serial Interface ====
  
*Before plugging it in set the hands to 12 oclock and and 0 minutes ( if the hands are accessable, else skip this ).
+
Before plugging it in set the hands to 12 oclock and and 0 minutes ( if the hands are accessable ).
  
*Plug in.  The hands should spin a bit and then stop.   
+
Plug in.  The hands should spin a bit and then stop.  The clock will be set to 12:00 and will immediately start running.  But the hands may not be initialized or adjusted to the correct zero positions.  To adjust them change the mode switch to Adj Hour Hand  and manipulate the up down switch untill the hour hand moves to 12:00 ( this does not change the internal time of the clock ), switch to Adj Minute Hand
 
 
*The clock will be set to 12:00 and will immediately start running.  But the hands may not be initialized or adjusted to the correct zero positions.  To adjust them change the mode switch to Adj Hour Hand  and manipulate the up down switch untill the hour hand moves to 12:00 ( this does not change the internal time of the clock ), switch to Adj Minute Hand and adjust it to 0 minutes.
 
 
 
*Switch the clock back to run, the hands may move a bit, the time is very near 12:00 ( unless it took you a long time to adjust the hands ).
 
 
 
*Switch to set hour to set the correct hour.
 
 
 
*Switch to set minute to set the correct minute.
 
 
 
*Switch to run and enjoy.
 
  
 
==== With the Serial Interface ====
 
==== With the Serial Interface ====
  
 
This interface is not necessary but can be very useful for playing around with the clock, or debugging new version of the code.
 
This interface is not necessary but can be very useful for playing around with the clock, or debugging new version of the code.
To use the serial interface you will need a cable, and perhaps a level shifter ( the Stepper Tester [[Stepper Motor Tester]] has a max232 level shifter, this circuit does not, you can get a level shifter as a seperate component or even built into a cable ).  You will also need a serial terminal, generally a program for your PC.  For information on a good terminal program see [[PC-Microcontroller Communications#Serial_Communications_from_a_PC_to_Microcontrollers]]
+
To use the serial interface you will need a cable, and perhaps a level shifter ( the Stepper Tester [[Stepper Motor Tester]] has a max232 level shifter, this circuit does not, you can get a level shifter as a seperate component or even built into a cable ).  You will also need a serial terminal, generally a program for your PC.  For information on a good terminal program see [PC-Microcontroller Communications#Serial_Communications_from_a_PC_to_Microcontrollers]]
  
Notes on terminal program set up.
+
Using the serial mode by connecting at 9600 baud 8n1.
 
 
*Baud rate should be 19.2K 8N1
 
*Most terminal programs can be set to treat a carriage return as a carriage return line feed. Do it.
 
Some terminal programs will not transmit in lower case ( all our commands are lower case ) unless specially set to do so. Set it to allow lower case.
 
  
 
The clock should send debugging information about once a minute ( maybe ).  It will also inform you of the changing of modes with the mode switch.
 
The clock should send debugging information about once a minute ( maybe ).  It will also inform you of the changing of modes with the mode switch.
Line 521: Line 505:
  
 
=== Download ===
 
=== Download ===
Note there may be a serious error in the schematic for the clock board.  You can jumper around it if you have already made the board, else wait for version X. ( may be fixed in version 2 below, but I need to check. )
+
Note there is a serious error in the schematic for the clock board.  You can jumper around it if you have already made the board, else wait for version 2.
Download includes the boostc project ( .c, .h, and ._c files ) some of the graphics, movie, and eagle files [http://home.comcast.net/~russ_hensel/OC/DDClock/DDClock_v2.zip Download Version 2] Questions? email me until then see [[russ_hensel]]
+
Here is a location for some of the graphics, movie, and eagle files [http://home.comcast.net/~russ_hensel/OC/DClock/DClock_v1.zip Download Version 1] More comming, email me until then see [[russ_hensel]]
  
 
=== Comment, Questions, Contributions? ===
 
=== Comment, Questions, Contributions? ===
  
 
Email me [[russ_hensel]], or use the talk page for this topic.  All feedback is welcome.
 
Email me [[russ_hensel]], or use the talk page for this topic.  All feedback is welcome.
 
[[category:projects]][[category:Serial Communications]][[category:Microcontroller]][[category:PIC]]
 
[[category: clock]]
 

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)