Editing Arduino/Raspberry Pi based Dancing 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 1: Line 1:
 
This is a rework of an earlier PIC based project, see:  [[PIC based Stepper Motor Dancing Analog Clock]]
 
This is a rework of an earlier PIC based project, see:  [[PIC based Stepper Motor Dancing Analog Clock]]
  
This is an article started by Russ Hensel, see ["http://www.opencircuits.com/index.php?title=Russ_hensel#About My Articles" '''About My Articles'''] for a bit of info.  The page is just begun, the project is 90% complete, it is the last 10% that kills you.
+
This is an article started by Russ Hensel, see "http://www.opencircuits.com/index.php?title=Russ_hensel#About My Articles" '''About My Articles''' for a bit of info.  The page is just begun, the project is 90% complete, it is the last 10% that kills you.
  
 
= next all copied from earlier article,  in process editing it =
 
= next all copied from earlier article,  in process editing it =
Line 131: Line 131:
  
 
==== Power Supply ====
 
==== Power Supply ====
 +
 +
This is a straight forward half wave rectifier with a linear regulator.  It is powered by a wall wart transformer rated at about 9 volts.  The unregulated voltage is over 9 volts ( 9 * ( 2 ^ 1/2 )) by simple theory.  This unregulated voltage is used directly by the steppers so choose you wall wart to match your stepper motors.  You should also size the filter caps based on the current that will be used by the motors.  A couple of volts of ripple is not a problem as long as you have enough overhead for the 5 volt regulator ( the PIC might run on less, let me know if you try it ).  An important part of the power supply is a 60 hz, roughly square wave.  It is clipped off from the AC input.  The 60 Hz power line tends to be very accurate over the long term, less so if you suffer power outages.  You could run the clock on batteries but the motors load down a battery pretty badly and you would need a different timing signal ( the original code has a subroutine for timing off the crystal ).
  
 
===== Power Supply =====
 
===== Power Supply =====
Line 140: Line 142:
  
 
===== Processor Schematic and Board =====
 
===== Processor Schematic and Board =====
 +
 +
Single sided, for toner transfer, in Eagle ( semi-final, less ground plane, files may be more up to date )  To get a readable copy download the Eagle files and open in Eagle, see: [[Techniques#Software_design_tools | Techniques, Software Design Tools]]
 +
 +
[[Image:ProcessorBoardSch.png  | Power Supply Schematic ]]
 +
 +
[[Image:ProcessorBoardBrd.png  | Power Supply Board ]]
 +
 +
 +
Parts
 +
 +
{| class="wikitable"
 +
|-valign="top"
 +
|Part
 +
|Details
 +
 +
|-valign="top"
 +
|Wall Wart
 +
|You need one with AC output to get the 60 Hz timing signal from the power line.  Mine is a 9 v 800 ma unit.  I found it somewhere.  The output voltage, when rectified, needs to be enough to drive the motor, the PIC runs off a regulator so it does not care much about the input voltage.
 +
<!-------------------------------->
 +
 +
|-valign="top"
 +
|PIC16F877A
 +
|My favorate 16 series part, relatively lots of memory and pins.  Bigger than you need, but only about 8 bucks.  Try with an 18 series part, should not be hard and will leave you more up to date.  Let me know.
 +
<!-------------------------------->
 +
|-valign="top"
 +
|MODE_1...MODE_6 = Rotory Switch connections
 +
|I used an old Radio Shack 12 position switch only 6 of them are used here.  You could use seperate pushbuttons, the advantage is that the position of the rotory switch indicates which mode you are in, else you may want an led for each one, perhaps using another bunch of ports.
 +
<!-------------------------------->
 +
|-valign="top"
 +
|Single Pole double throw Momentry Switch
 +
|( or could be 2 momentary push buttons ) one moves the hands up, the other down, in the set and adjust modes.  From my junk box.
 +
<!-------------------------------->
 +
|-valign="top"
 +
|Pull Up/Down Resistors
 +
|10k more or less
 +
<!-------------------------------->
 +
|-valign="top"
 +
|CQ1, CQ2 = capicators for the crystal
 +
|about 20 pf seems to work, see the PIC16F877A manual
 +
<!--------------------------------
 +
|-valign="top"
 +
|xx
 +
|
 +
<!--------------------------------
 +
|-valign="top"
 +
|xx
 +
|
 +
<!-------------------------------->
 +
|-valign="top"
 +
|Q = crystal
 +
|4 meg Hz is what I used.  May be quite a bit faster than needed, I have not looked into this.  The 4 meg crystal seems to work ok on a proto board.  Note that some of the code is dependent on this frequency, but could be fairly easily changed.
 +
<!-------------------------------->
 +
|-valign="top"
 +
|RA4, RA5 = Pull up resistors
 +
|10K more or less
 +
<!-------------------------------->
 +
|-valign="top"
 +
|RB1 ... RB6 = Pull up resistors
 +
|10K more or less
 +
<!-------------------------------->
 +
|-valign="top"
 +
|RRA2, RRA3  = Pull up resistors
 +
|10K more or less
 +
<!-------------------------------->
 +
|-valign="top"
 +
|C_BP  = By Pass Cap.
 +
|.01 to .1 mfd mica or other by pass cap, good at high frequency seems good.
 +
<!-------------------------------->
 +
|-valign="top"
 +
|RRA1 = Pull Up resistor
 +
|10K more or less
 +
<!--------------------------------
 +
|-valign="top"
 +
|
 +
|
 +
<!-------------------------------->
 +
|-valign="top"
 +
|DRIVER  = Driver
 +
|Driver chip for stepper.  ULN2803.  Good for up to .5 amp 35 volts I think.  Could use discrete transistors ( possibly darlingtons ) if you want higher current.  You should not need more current unless you make a really big clock.
 +
<!-------------------------------->
 +
|-valign="top"
 +
|RMC  = Pull up resistor for master clear ( pull down with push button switch to reset ).
 +
|10k more or less
 +
<!-------------------------------->
 +
|-valign="top"
 +
|PUSH_BUTTON_SWITCH  = Reset
 +
|Push to reset the processor.  Mine was from salvage.
 +
<!--------------------------------
 +
|-valign="top"
 +
|  =
 +
|
 +
<!--------------------------------
 +
|-valign="top"
 +
|  =
 +
|
 +
<!--------------------------------
 +
|-valign="top"
 +
|  =
 +
|
 +
<!--------------------------------
 +
|-valign="top"
 +
|  =
 +
|
 +
<!--------------------------------
 +
|-valign="top"
 +
|  =
 +
|
 +
<!-------------------------------->
 +
|-valign="top"
 +
|CLOCK  = Clock input signal
 +
|Connect to CLOCK_OUT on power supply.
 +
<!-------------------------------->
 +
|-valign="top"
 +
|VDD = Positive Power
 +
|5 volts from power supply.
 +
<!-------------------------------->
 +
|-valign="top"
 +
|G1  = Ground Connection
 +
|To the power supply.
 +
<!-------------------------------->
 +
|-valign="top"
 +
|SW_UP, SW_DOWN = Setting switch
 +
|I used a momentary double throw, single pole, you could use 2 momentary push buttons.
 +
<!--------------------------------
 +
|-valign="top"
 +
|  =
 +
|
 +
<!--------------------------------
 +
|-valign="top"
 +
|  =
 +
|
 +
<!--------------------------------
 +
|-valign="top"
 +
|  =
 +
|
 +
<!-------------------------------->
 +
|-valign="top"
 +
|MOUNT_1...4
 +
|Mounting holes.
 +
<!--------------------------------
 +
|-valign="top"
 +
|  =
 +
|
 +
<!-------------------------------->
 +
 +
|}
  
 
=== Program ===
 
=== Program ===
Line 156: Line 304:
  
 
==== 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. 
 +
 +
If you do not wish to compile you can use the precompiled hex version also included in the zip archive.
  
 
=== Building the Clock ===
 
=== Building the Clock ===
Line 171: Line 322:
  
 
==== Without the Serial Interface ====
 
==== Without 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 ).
 +
 +
*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 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 ====
Line 275: Line 440:
  
 
=== Download ===
 
=== Download ===
Will be at GitHub soon?
+
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. )
 +
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]]
  
 
=== Comment, Questions, Contributions? ===
 
=== Comment, Questions, Contributions? ===
Line 281: Line 447:
 
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:Arduino/RaspberryPi]]  
+
[[category:projects]][[category:Serial Communications]][[category:Microcontroller]][[category:PIC]]
 
[[category: clock]]
 
[[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)