Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

DIY Moon Phase Dial


Gina

Recommended Posts

Gina are you convinced that this is a software problem and not say some random irregularity in the clock's drive train. ?

just thinking out loud here but would it be worthwhile say plotting the time difference over say a 12 hour period, to see if there is any pattern. 

Jim

Link to comment
Share on other sites

  • Replies 1.1k
  • Created
  • Last Reply

I did say I would expect a pattern in the variation in the RTC readings due to the sloppiness of the axle and hence varying spacing of the minute hand from the Hall sensor.  The axle mounting wants improving.  There cannot be any variation in the gear ratios - it's "carved in stone" or rather solidly printed in plastic.  Gears can't "skip a beat" or change ratio as the teeth are permanently engaged.

The odd ratio of the 28BYJ-48 gearbox would always cause problems and need complicated correction.  Also, having the gearbox meant it could never be used to drive the seconds with a full seconds to hours gear train as it won't go fast enough to set the clock in a reasonable time.  Using a stepper motor without a gearbox means I can drive the seconds and still increase speed by 60 or 120 times for setting up etc.

Here is a log over 18 hours which I think is the longest I've run.

On 10/03/2016 at 10:11, Gina said:

  Here's the latest log results.

  Time       Diff   Total
 16:00:02             0
 16:59:58    -4    - 4
 17:59:58     0    - 4
 19:00:04   +6    +2
 20:00:00   - 4    - 2
 21:00:16  +16  +14
 22:00:18    +2  +16
 23:00:14    - 4  +12
  0:00:24   +10  +22
  1:00:24       0  +22
  2:00:28     +4  +26
  3:00:40    +12 +40
  4:00:38     - 2  +36
  5:00:48    +10 +46
  6:00:48       0  +46
  7:00:40     - 8  +38
  8:00:54   +14  +52
  9:00:58     +4  +56
 10:00:58       0  +56

Cumulative error is about a minute in 18 hours which is 1 in 1080 so we're ready now for the next level of correction, about 3s an hour.

 

Link to comment
Share on other sites

Here's a gear table for the clock that I calculated a while ago covering seconds to 24h - though I'm only using 12h so not using the 1:2 ratio.

post-13131-0-67840900-1448894093.jpg

For stepper motor to seconds shaft, gears of 20t and 24t at mod 2 will want a spacing of 44mm.  I shall need to design a new frame anyway so I can accommodate that and the gears should be a nice looking size.

To summarise then :-

  1. Stepper motor to seconds shaft 20t to 24t.  5:6
  2. Seconds to intermediate wheel - 5t to 50t  1:10
  3. Intermediate wheel to minutes shaft - 8t to 48t  1:6
  4. Minutes to intermediate - 12t to 48t  1:4
  5. Intermediate to hour shaft - 15t to 45t   1:3
  6. Hour shaft to moon ratchet - Cam to 42t
  7. Rachet wheel to moon globe - 32t to 45t  32:45

Physically the gears will be :-

  1. Stepper motor - 20t
  2. Seconds wheel - 24t & 5t
  3. Intermediate wheel S>M - 50t & 8t
  4. Minute wheel - 48t & 12t
  5. Intermediate wheel M>H - 48t & 15t
  6. Hour wheel - 45t
  7. Cam follower to paul - direct drive 1:1
  8. Ratchet wheel - 42t & 32t
  9. Moon globe gear - 45t
Link to comment
Share on other sites

Redesigned and now printing a new main frame for the NEMA16 stepper motor that I actually bought for my long case clock, but I want to get this clock working ASAP.  I can always buy another or swap it for the stepper motor I have on order from HK.

56e592bcaa841_MainFrameforNEMA1601.thumb

Link to comment
Share on other sites

That main frame design is flawed anyway - the stepper motor needs mounting away from the main gear train support frame.  Need to rethink that :D  Realised that after printing the motor gear and seconds wheel.

Link to comment
Share on other sites

Now printing the seconds to minutes intermediate wheel with 50t and 8t.  I already had the original minutes wheel and tube so don't need to print that.

Link to comment
Share on other sites

Now have the complete gear train done from stepper motor to the hands and moon phase dial.  Here is a photo showing the gears from seconds to hours including the cam for the moon drive.

56e5ebd60a26c_GearTrainSecondstoHours201

Link to comment
Share on other sites

To make a frame before I get my DIY Pilot printer working I think I would need to look at other construction methods such as wood or aluminium.  I guess I coul make it from pieces of 6mm plywood and blocks of solid wood.

It also needs new electronics to drive the alternative stepper motor.  The ULN2003A will be replaced with the Pololu A4988 Driver module but I think I should be able to do this on the same piece of stripboard.  I would like the driver to plug in as with 3D printers so I'll see if I've got any sockets. 

The Arduino sketch will need a small mod too but this will be a simplification as the new driver only needs a STEP pulse and DIRECTION logic level rather than an array of phases and multiple calls to outputs to drive the phases.  All the power output to the coils and sequencing is done within the A4988 chip.  Here's the A4988 Stepper Motor Driver Carrier which is the complete driver module.  It references the A4988 datasheet.

 

Link to comment
Share on other sites

Yes, I was very impressed with them when reading up about Reprap 3D printers and their construction :)  Whilst these drivers might be considered overkill for this application, their built-in safety factors, easy use and low price make using them a "no brainer" IMO :)  I shall be using them wherever I use stepper motors other than the ubiquitous 28BYJ-48 tiddlers.  I have a lightweight fork mount on the books for sometime in the future and this will use NEMA stepper motors and these drivers.  High speed and high resolution in one unit :)

Link to comment
Share on other sites

This shows the connections in diagram form.  Vdd to Arduino +5v O/P and motor power supply to the 12v.  STEP and DIR will go to two digital pins.

56e6af82719c7_UsingtheDriverA498801.thum

Link to comment
Share on other sites

I've checked and there's plenty of room for the driver module on the stripboard.  The STEP and DIR inputs will line up with D10 & D11 (or with D11 & D12).  I'll choose D11 for DIR and D12 for STEP.

Here's the timing diagram and minimum STEP pulse length is 1μs.  Arduino clock frequency is 16MHz so I'll add a delay of a few μs between STEP on and STEP off to make sure the length is enough.  This doesn't determine the time the coils are on - one or other is on all the time and the time between steps determines the stepping rate.

56e6cbcac1c95_A4988Timing01.thumb.JPG.ce

Link to comment
Share on other sites

As a starting point for the fast stepping mode let's take one revolution per second = 360°/s.  One step is 1.8° so 360° is 200 steps or a delay of 5ms between steps.  To test whether running straight off at this speed and stopping abruptly causes dropped steps or run-on I propose to stick a pointer on the stepper motor and drive it for 100 revolutions exactly at this speed and see if the pointer stops where it started.  That's 20,000 steps which should take 100 seconds or 1m 40s.

Here's the test sketch.

// Filename :- Moon_Clock_Test_for_NEMA16_stepper_01
// Arduino speed test sketch for NEMA16_stepper
//
int delayTime = 5;    //  Time between steps (ms)- 5ms gives 200 steps/s or 360° per sec = 1 revoultion per second
boolean done = false;
//
int dirPin = 10;  // DIRECTION pin
int stepPin = 11;  // STEP pin
//
void setup() {
  Serial.begin (9600);     // Enable Serial Monitor via USB
  pinMode(dirPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  digitalWrite(dirPin, 0);
  }
//
void stepForward(void){
  digitalWrite(stepPin, 1);
  delayMicroseconds(10);     // Make STEP pulse at least 10μs long
  digitalWrite(stepPin, 0);
  delay(delayTime);          // delay between steps
}
//
void loop(){
  if (done) {return; }
  for (int i = 20000; i >= 0; i--) { stepForward(); }  // rotate motor shaft 100 turns
  done = true;
}
// End

 

Link to comment
Share on other sites

Just finished wiring up the A4988 driver module.  I've left one ULN2003A chip to drive the RGB LED string and possible something else if I want later on :D  There are also 4 analogue pins available which may be used for inputs or digital outputs (except PWM).  A possibility for one analogue input is for an LDR to measure ambient light level and adjust the LED lighting.

56e6f181e6785_ElectronicsBoardv201.thumb

Link to comment
Share on other sites

It doesn't work :(:eek:

Yes it does :)  Mains plug wasn't making proper contact...

Seems to stop in the right place :)  I'll double the speed and see what happens :D

Link to comment
Share on other sites

About 2-3° short at 120rpm.  That's not bad :) 3° is one part in 12000.  At setup this would be an error of 1/1000th of an hour = 3.6s   I don't think that would bother me too much :D  But I think I'll run it a bit clower for the hour change.

Link to comment
Share on other sites

Decided to clamp the motor as it was moving on the bench and with it clamped there was no error - tried it three times :(  Doesn't half stop with a clunk :D

Still stopping dead on the mark at 150rpm - 2ms delay between steps.  But it doesn't like 1ms (300rpm) :D

Link to comment
Share on other sites

Maximum time taken to set the clock - 12 hours - at 150rpm on the seconds shaft will be 12 hours / 150 = 12 x 60m / 150 = 4.8m.  To "change the clocks" would take 3600 / 150 = 24s.

For this test I've simply put the seconds hand directly on the motor shaft and it diasppears in a blur at this speed :D

Link to comment
Share on other sites

18 minutes ago, Gina said:

Decided to clamp the motor as it was moving on the bench and with it clamped there was no error - tried it three times :(  Doesn't half stop with a clunk :D

Still stopping dead on the mark at 150rpm - 2ms delay between steps.  But it doesn't like 1ms (300rpm) :D

It would run much faster but you'd have to ramp the speed up - using AccelStepper. It's trying go from zero to full speed within the first step otherwise ;-)

ChrisH

Link to comment
Share on other sites

Yes, I know - I was quite expecting to have to ramp it up and down again but it's not necessary.  Using ramping would make calculating the time to set up difficult.  Of course, I'll have to test again with the inertia of the gears but these are pretty light being air filled ABS.  But if I went from 2ms to 3ms step delay, the setup time would still be a maximum of 7.2m which is well acceptable.

If I wanted to make it much faster I could run the setup in stages, starting at 2ms and changing to 1ms after a certain time and maybe similarly at the end off the time.  That would make the calculation feasible.  But it doesn't seem to be necessary.

Link to comment
Share on other sites

1 hour ago, Gina said:

Decided to clamp the motor as it was moving on the bench and with it clamped there was no error - tried it three times :(  Doesn't half stop with a clunk :D

Still stopping dead on the mark at 150rpm - 2ms delay between steps.  But it doesn't like 1ms (300rpm) :D

Looks like it was unreliable stepping in the little geared ones all along. Perhaps they will always be dodgy, or maybe you has a bad un'.

Now you can get it all to work reliable and start adding the fancy stuff.

Link to comment
Share on other sites

Thank you Neil - yes, the little geared steppers were not suitable really.  In fact I realise with hindsight that I should have given up on them as soon as I found the gearbox ratio wasn't exactly 64:1. 

Yes, I feel pretty confident that the NEMA type stepper motor will work correctly and should provide an ideal solution. 

Next job is to sort out the gear train support framework and I have had an idea to simplify things.  I had a problem with the space taken by the NEMA16 motro shaft but by moving it further out so that it clears the largest gears on the main and intermediate axles it can overlap the gears.  This means that I can mount the motor on the same panel as the axles are mounted to.  Here's a diagram to explain what I mean.

56e72ce623eab_GearLayoutwithNEMA1601.thu

Link to comment
Share on other sites

I suppose that to set the clock exactly on the "dot" I ought to have Hall sensing on the seconds hand as well as the minute and hour.  Then it could be set to the second :D  Alternatively, I could have one of those tiny digital encoders with knob to adjust the time.  That would allow me to correct for the tiny error in the RTC too...

Link to comment
Share on other sites

I have a piece of aluminium that came from another project and is now spare that I could use for the main mounting plate 197mm x 100mm x 3mm.  A plate 140mm x 90mm is what is required with this layout
56e74b17b2db5_MainMountingPlate01.thumb.

But I see no reason why a bigger plate would be a problem.
56e74e54711cf_MainMountingPlate02.thumb.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.