Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

DIY Moon Phase Dial


Gina

Recommended Posts

Gained 3m in 5 hours = 3 in 300 = 1% so I need to increase the 986111 μs by 1% = 995972 μs.  Sketch updated and uploaded and clock hung on wall out of the way :)

I shall now clear the table and play about with the sensors I plan to use to detect when the hands read 3 o'clock (or whatever).

Link to comment
Share on other sites

  • Replies 1.1k
  • Created
  • Last Reply

This works but I would prefer to use a Hall effect device and magnet as that takes far less power and uses fewer components.  I think a tiny magnet mounted on the minute hand just behind the pointer end and Hall effect device glued to the dial just above the 12 should work.  I think there's a good chance of getting an accuracy of less than half a minute which would be fine.  I have a number of rare-earth "supermagnets" just 3mm cube that I've already tested and installed in my anemometer (measures wind speed).  The range is a couple of mm.

Link to comment
Share on other sites

I think the magnet and Hall effect device will work fine for both hands.  I have some bigger magnets that work at around 5mm so a magnet on the hour hand and the Hall effect device the other side of the acrylic panel should be fine.  The Hall effect devices run on any voltage from 4.5 to 24 at around 5mA so I'll run them directly from the 12v supply and save load on the +5v Arduino output.  The device output is open collector NPN transistor so with a pull-up resistor could use either analogue or digital input.

That sorts out the clock hand sensors.  Fitting the parts to the clock should be simple.

Link to comment
Share on other sites

I've been looking more closely at the Arduino Nano and find that the analogue pins other than 6 and 7 can be used as digital pins thereby extending the number of digital pins.  A4 and A5 will be in use for I2C comms to the RTC but that still leaves A0 - A3.  Two analogue pins may be used for the hands sensors.  That leaves two pins left.  Unfortunately, I don't think that will be enough to control the calendar display unless I can come up with something clever :icon_scratch:

Link to comment
Share on other sites

I made a mistake above - the hand sensors can use A6 and A7 as analogue inputs.  So there are 4 spare and if I could use servo motors for the calendar I could get away with it.  ATM I haven't worked out how I'm going to control the display.

I was thinking of using split flap displays for weekday, day of month and month but these have to be moved in one direction only.  A servo motor could advance the displays a step at a time using a ratchet mechanism (like the moon phase drive) but the starting position would have to be set by hand.  Stepper motors might be better but even then there needs to be some way to connect the absolute position with the stepper.  One way would be to do the same as for the clock hands - magnets and Hall effect devices.  OTOH is it really any great hardship to set the date manually to start with? - I don't think so :D

Weekday and month just step round continuously but the day of month will need moving on more than one step for months that don't have 31 days.  This can simply be programmed in code by using a month table.  Alternatively, a Hall sensor could detect day 01 and the display advance until the Hall sensor detected the 01 for the first day of the month.  I think the former method would suffice and saves on parts.

The upshot of all this is that I believe I can determine the board design straight away.  The pin assignment could be as follows :-

  1. D0 D1 - reserved for use with USB to serial chip
  2. D2 - interrupt SQW from RTC
  3. D3 D4 D5 D6 - minutes stepper motor
  4. D7 D8 D9 D10 - seconds stepper motor
  5. D11 D12 D13 - RGB LED light strip
  6. A0 A1 A2 - Servo motors used to advance the calendar displays
  7. A3 - Not used
  8. A4 A5 - I2C for RTC
  9. A6 A7 - Hall effect sensors for hands

I think I'll need to check if using analogue pins as digital output will work with servo motors and the servo library.  If not I could swap items 5. and 6. above since the RGB LED is simply ON/OFF for each colour.  I'm not thinking of using PWM for colour mixing.

A bit later...  I've checked the info on the servo library and it says it will only work with the digital pins so I shall need to change the connections around.  I'll take another look at the layout since just swapping 5. and 6. above may not give the best layout.

Link to comment
Share on other sites

Hi Gina,

Quote
3 hours ago, Gina said:

A bit later...  I've checked the info on the servo library and it says it will only work with the digital pins so I shall need to change the connections around. 

 

I find this a bit surprising. AFAIK the 'analogue'pins can act as perfectly ordinary digital pins. I can imagine that  the other way round would be true for devices that require an analogue voltage, but digital is digital is digital.....

 What servo library are you using?

Regards, Hugh

Link to comment
Share on other sites

Thank you Hugh :)  I was going by THIS PAGE which I believe is the standard Arduino Server Library.  Actually, it works out quite easy to use A0, A1, A2 and A3 to feed the stepper driver for the seconds stepper motor and use D10, D11 and D12 for the servos, and D7, D8 and D9 via ULN2003AN to drive the RGB LED strip.

So this would be the new pin assignments :-

  1. D0 D1 - reserved for use with USB to serial chip
  2. D2 - interrupt SQW from RTC
  3. D3 D4 D5 D6 - minutes stepper motor
  4. D7 D8 D9 - RGB LED light strip
  5. D10 D11 D12 - Servo motors used to advance the calendar displays
  6. D13 - Not used (except for built-in LED)
  7. A0 A1 A2 A3 - seconds stepper motor
  8. A4 A5 - I2C for RTC
  9. A6 A7 - Hall effect sensors for hands
Link to comment
Share on other sites

Clock timekeeping is getting better - estimated 30s slow in 4 hours = 1 part in 480 or approx 0.2%.  New value  for Timer1 wants to be 986012μs - 0.2% = 984040μs

Clock sketch modified, uploaded and clock restarted and set to correct time at 1518.

Link to comment
Share on other sites

I think it's still running very slightly slow - maybe around 0.1% or a little more.  Guess I'll do another correction an a little while.

Meanwhile, I'm building the new control circuit.  I have a piece of stripboard that is just big enough.  I'll take and post a photo shortly.  Once built I'll use a simple test sketch just connecting the input on pin D2 to the internal LED on pin D13.  Then I can experiment with setting the control register on the RTC until I get the LED flashing once a second.

Link to comment
Share on other sites

Clock stopped and I found the gears were jamming so I took it apart and fixed it.  Then set it to the right time - just after 11pm.  I'll see how t is in the morning.

Link to comment
Share on other sites

8am and 9 hours after setting the clock it is showing 17m slow.  17m in 540 = 0.031.  Current timer setting = 982000.  Multiply by 1 - 0.031 = 951085.  Call it 951000.  I'm puzzled that it seems to keep needing correcting and the error seems a lot for a crystal controlled oscillator - it's now being corrected by 5%.

Link to comment
Share on other sites

Unjammed the gears again and put the dial back on loosly.  Put minute hand on only and watching it.  Running freely now and gaining a bit.  I'm interleaving work on the clock mechanics with building the new electronics board.

Link to comment
Share on other sites

New control board completed (I think) - here are some photos.  I've made use of the RTC mofule having two sets of connections - one set pointing straight down and covering Gnd, Vcc, SDA and SCL and the other set pointing out sideways with those connections plus 32K and SQW, the square wave I shall use for the interrupt and which can be set to a frequency of 1Hz ie. period of one second.  I have bent the Gnd sideways connection down and soldered to the stripboard and the SQW upwards with a fly lead to D2 on the other side of the Arduino Nano.  This saves on several links and some space.

This shows the components laid out on the stripboard.

56b5feb955e53_ControlBoardwithRTC01.thum

Wire links added.

56b5febd6bcad_ControlBoardwithRTC02.thum

RTC module added.

56b5fec175535_ControlBoardwithRTC03.thum

Link to comment
Share on other sites

I've plugged the new circuit board into USB on my desktop ready to try the RTC.  Arduino and RTC module powered by the USB - I'm not using the stepper drivers or anything other than the RTC so not using the 12v supply.  First thing is to see if I can read the RTC and check that it's working properly then if that's alright I can try controlling the RTC registers to enable the 1Hz square wave output.

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.