Yes! Another clock! This one has a mechanical minute hand with a retrograde action. The hand moves from "zero" to the "sixty" minute position, once the minutes reach sixty, the hand rotates anticlockwise, back to zero and the hour indicated on the LED display progresses to the new hour.
The video shows the clock being powered up and moving to the current time. When first plugged in, the LED display shows the software build date ( 21 - 05 - 21 ), the minute hand rotates anticlockwise to zero minutes, the hand then rotates to the sixty minute position (this is to check that the limit switches are working) during this proceedure, the LED display shows a count of the steps needed to move the hand from one position to the other - if this is less than that required, an error would be displayed. The minute hand then returns back to zero. The clock module is initialised (the LED momentarily shows "IC") and assuming the time can be loaded, the current time (hours then minutes) is shown on the LED. The minute hand then moves to point to the current time, the LED shows the hours and timekeeping commences.
Inspired by the range of Reservoir Watches.
Code updated with "Error" changed to "ErrorSub" following Anobium's suggestion. When the PCBs arrived I found that the steps required needed a change or two to allow a full rotation, not unexpected really given the prototype was made with a sheet of cardboard with holes punched to mount the motor. This code has those minor tweaks made.
#OptionExplicit'Pic 16F1829 Retrograde minute clock'(c) MkEDS 2021'This is to drive a 28YBJ-48 Stepper motor.'The motor driver transistor bases are connected'to MtrA, MtrB, MtrC and MtrD. The collectors of'these transistors are connected to the A,B,C and D'windings of the motor.'The wires of the motor are:'Red 5V'Ora A'Yel B'Pnk C'Blu D'A serial two digit LED display is connected to show the hours.'The stepper motor points to the minutes.'A DS3231 clock module is connected to keep the time.'The date is always set to the compile date as the date cannot be displayed.'When powered on, the compile date is shown on the display.'The stepper motor is then turned anticlockwise until the pointer makes contact'with the start switch.'The stepper motor is then turned clockwise until the pointer makes contact with'the end switch.'The stepper motor is then turned anticlockwise back to the start position.'The start contacts should be positioned and aligned with the zero minute marker.'The end contacts should be algned just past the sixty minute marker.'If the stepper motor fails to rotate for the correct number of steps (more than'2999 and less than 3500) the display will show "EH" and will halt to indicate'an error with the hand.'The DS3231 will be initialised with the display showing briefly "IC".'If the DS3231 is not detected the display will show "EC" and will halt to indicate'an error with the clock.'If there are no errors, the hours will be shown with a decimal point on the first'digit, followed by the minutes with a decimal point on the second digit.'The display will then show the current hour and the pointer will move to indicate the'current minutes.'At 59 minutes and 55 seconds, the minute pointer will move anticlockwise back to'zero minutes. This takes around 8 seconds, the hour will update to show the new'hour.'Hours are only ever displayed in 12 hour format with a leading zero.'If the DS3231 has stalled due to a power failure, the two decimal points will alternate'every second. This will indicate that the time needs checking. Setting the time will'clear this.'There are three buttons fitted, Up Down and OK.'While not in setting mode, pressing the "Up" button will show the temperature'on the display, with no decimal point. Pressing the "Down" button will show the'minute with a decimal point on the second digit.'To adjust the time:'Press and hold the "Ok" button for a second.'The clock will show the hour, with a decimal point on the first digit, pressing'the up or down buttons will adjust the hour. Press and release the "Ok" button'to store the hour and adjust the minute. The minute will be displayed with a'decimal point on the second digit, pressing the up or down buttons will adjust'the current minute. Press the "Ok" button to store the time. If the minutes'have been altered, the seconds will be set to zero and timekeeping will start'when the "Ok" button is finally pressed then released.'The date cannot be shown and is reset to the compile date when ever the time is'adjusted.'Should the pointer be turned accidentally:'If it is advanced, it will reach the end switch before sixty minutes, the pointer'will return to zero minutes, then rotate to the correct time.'If it is retarded, it will return to zero minutes at 59 minutes and 55 seconds'then continue as normal.#Chip16F1829,32#ConfigCP=On'Read protectedSetNot_WPUEN=0'Enable pullups in general.SetWPUA0=0SetWPUA1=0SetWPUA2=0SetWPUA3=1'OKSetWPUA4=1'I2C_DatSetWPUA5=1'I2C_ClkSetWPUb4=0SetWPUb5=0SetWPUb6=0SetWPUb7=1'P10SetWPUc0=0SetWPUc1=1'P15SetWPUc2=1'P14SetWPUc3=1'StSwSetWPUc4=1'UpSetWPUc5=1'DnSetWPUc6=1'EnSwSetWPUc7=1'P9#Include<DS3231.h>'Define I2C settings - S/W I2C#DefineI2C_MODEMaster#DefineI2C_DISABLE_INTERRUPTSOn#DefineI2C_CLOCKPortA.5'Pin 2#DefineI2C_DATAPortA.4'Pin 3#DefineOkSwPortA.3'Pin 4 In only#DefineDnSwPortC.5'Pin 5#DefineUpSwPortC.4'Pin 6'These switches are made active when the pointer on the stepper motor contacts'with pins on the clockface. The pointer has solder points on it to attach a'loop of wire which is fabricated to short out the pins protruding from the clock'face. The start switch (at zero minutes) should be arranged to make contact when'the pointer is aligned with the zero minute marker. The end switch (at sixty'minutes) should be arranged so that it makes contact when the pointer has just'passed the sixty minute marker.#DefineStSwPortC.3'Pin 7#DefineEnSwPortC.6'Pin 8'These switches are made active when the pointer on the stepper motor contacts'with pins on the clockface. The pointer has solder points on it to attach a'loop of wire which is fabricated to short out the pins protruding from the clock'face. The start switch (at zero minutes) should be arranged to make contact when'the pointer is aligned with the zero minute marker. The end switch (at sixty'minutes) should be arranged so that it makes contact when the pointer has just'passed the sixty minute marker.#DefineP9PortC.7'Pin 9#DefineP10PortB.7'Pin 10#DefineD_LatPortB.6'Pin 11#DefineD_DataPortB.5'Pin 12#DefineD_ClkPortB.4'Pin 13#DefineP14PortC.2'Pin 14#DefineP15PortC.1'Pin 15#DefineMtrDPortC.0'Pin 16#DefineMtrCPortA.2'Pin 17#DefineMtrBPortA.1'Pin 18#DefineMtrAPortA.0'Pin 19#DefineE_Hands1#DefineE_DS32312#DefineE_Other13#DefineE_Other24#DefineBlank5#DefineS_Hrs20'Hours#DefineS_Mns21'Minutes#DefineDp_Hr2#DefineDp_Mn1DirOkSwInDirDnSwInDirUpSwIn'These switches are made active when the pointer on the stepper motor contacts'with pins on the clockface. The pointer has solder points on it to attach a'loop of wire which is fabricated to short out the pins protruding from the clock'face. The start switch (at zero minutes) should be arranged to make contact when'the pointer is aligned with the zero minute marker. The end switch (at sixty'minutes) should be arranged so that it makes contact when the pointer has just'passed the sixty minute marker.DirStSwInDirEnSwIn'These switches are made active when the pointer on the stepper motor contacts'with pins on the clockface. The pointer has solder points on it to attach a'loop of wire which is fabricated to short out the pins protruding from the clock'face. The start switch (at zero minutes) should be arranged to make contact when'the pointer is aligned with the zero minute marker. The end switch (at sixty'minutes) should be arranged so that it makes contact when the pointer has just'passed the sixty minute marker.DirD_ClkOutDirD_DataOutDirD_LatOutDirMtrAOutDirMtrBOutDirMtrCOutDirMtrDOut'Variables usedDimDatAsWordDimTempAsByteDimClocksAsByteDimDigitAsByteDimD1AsWordDimD2AsWordDimD3AsWordDimD4AsWordDimDtAsWordDimCountedMvAsWordDimCENTURY_FLAGAsByteDimPOWERLOSSAsByteDimChangedAsBitDimHourAsByteDimMinAsByteDimSecAsByteDimAm_PmAsByteDimTimeTAsByteDimTargetAsWordDimLastHourAsWordDimLastMinAsWordDimDateAsByteDimMonthAsByteDimYearAsByteDimDOWAsByteDimCenturyAsByteDimDecimalPointAsByteDimTempMSBAsByteLetTempMSB=0'Dim TempLSB As Byte'Let TempLSB = 0DimMinusAsBitLetMinus=0LetCountedMv=0'Whenever the time and date are saved, the date is reset to the compile date'As the date is never seen, we don't care about the date!#DefineCompileDay5'Friday#DefineCompileDate21'21st#defineCompileMnth5'May#DefineCompileYear21'2021'Whenever the time and date are saved, the date is reset to the compile date'As the date is never seen, we don't care about the date!#DefineDelTime2000' 2mS per stepDimStepSequenceAsByteStart_Up_SubStart_Of_Program:DoGetTimeIfDnSw=0ThenShowValuesSub(Min,Dp_Mn)Wait1000mSEndIfIfUpSw=0ThenGetTemperature'If the temperature is below zero, this will not be indicated!ShowValuesSub(TempMSB,0)'If the temperature is below zero, this will not be indicated!Wait1000mSEndIfIfOkSw=0ThenWait500mSIfOkSw=0ThenGetTimeLetLastMin=MinLetLastHour=HourSet_TimeIfLastMin<>MinThenLetSec=0'Zero the secondsSaveTimeDateElseIfLastHour<>HourThenLetLastHour=Hour'Only save the hourGetTimeLetHour=LastHourSaveTimeDateEndIfEndIfEndIfEndIfValidateHourIfPowerLoss=TrueThenIfDecimalPoint=2ThenLetDecimalPoint=1ElseLetDecimalPoint=2EndIfElseLetDecimalPoint=0EndIfShowValuesSub(Hour,DecimalPoint)' 1 minute * 52 = 52' every 15 seconds move 13' 3 * 13 = 39' then at the new minute move 13 = 52 per minute' 53 * 60 minutes = 3120' angle of hands need 3120 steps to move from zero to sixtyLetTarget=Min*52IfSec>14ThenLetTarget=Target+13EndIfIfSec>29ThenLetTarget=Target+13EndIfIfSec>44ThenLetTarget=Target+13EndIfIfCountedMv<TargetThenDoMove_ClockWise(1)LetCountedMv=CountedMv+1LoopUntilCountedMv>=TargetEndIfIfCountedMv>TargetThen'May have adjusted time?DoMoveAClockWise(1)LetCountedMv=CountedMv-1LoopUntilCountedMv<=TargetEndIfIfMin>58ThenIfSec>53Then'It takes about 8 seconds to return' by the time we're home, the new hour should startLetTarget=0DoMoveAClockWise(1)LoopUntilStSw=0LetCountedMv=0EndIfEndIfIfEnSw=0Then'At end stop?DoMoveAClockWise(1)LoopUntilStSw=0LetCountedMv=0EndIf'It may be that after returning to zero, the pointer needs moving a few steps to align better with'zero minutes?'Hopefully this can be accounted for by adjusting the position of the "loop" on the pointer, but'it may need some software "correction"?LoopSubMove_ClockWise(InStepCntAsWord)RepeatStepCntSelectCaseStepSequenceCase1Step1Case2Step2Case3Step3Case4Step4Case5Step5Case6Step6Case7Step7Case8Step8CaseElseLetStepSequence=1EndSelectLetStepSequence=StepSequence+1IfStepSequence>8ThenLetStepSequence=1EndIfEndRepeatEndSubSubMoveAClockWise(InAStepCntAsWord)RepeatAStepCntSelectCaseStepSequenceCase1Step8Case2Step7Case3Step6Case4Step5Case5Step4Case6Step3Case7Step2Case8Step1CaseElseLetStepSequence=1EndSelectLetStepSequence=StepSequence+1IfStepSequence>8ThenLetStepSequence=1EndIfEndRepeatEndSub'############################################################################################################'The below two are not used hereSubSpin_Clockwise(InSpinCountAsWord)AllOffRepeatSpinCountStep1Step2Step3Step4Step5Step6Step7Step8EndRepeatLetStepSequence=1EndSubSubSpinAClockwise(InASpinCountAsWord)AllOffRepeatASpinCountStep8Step7Step6Step5Step4Step3Step2Step1EndRepeatLetStepSequence=1EndSub'The above two are not used here'#############################################################################################################SubAllOffLetMtrA=0LetMtrB=0LetMtrC=0LetMtrD=0EndSubSubStep1LetMtrD=1WaitDelTimeuSAllOffEndSubSubStep2LetMtrD=1LetMtrC=1WaitDelTimeuSAllOffEndSubSubStep3LetMtrC=1WaitDelTimeuSAllOffEndSubSubStep4LetMtrC=1LetMtrB=1WaitDelTimeuSAllOffEndSubSubStep5LetMtrB=1WaitDelTimeuSAllOffEndSubSubStep6LetMtrB=1LetMtrA=1WaitDelTimeuSAllOffEndSubSubStep7LetMtrA=1WaitDelTimeuSAllOffEndSubSubStep8LetMtrD=1LetMtrA=1WaitDelTimeuSAllOffEndSubSubShowValuesSub(InD_ValueAsWord,InDP_OnAsByte)LetDt=D_ValueIfDt>99ThenDoLetDt=Dt/10LoopUntilDt<100EndIfLetD1=255'Space - There is only a two digit display!LetD2=255'Space - There is only a two digit display!IfDt>9Then'10sLetD3=Dt/10LetDt=Dt-(10*D3)LetD3=D3+1'Lookup starts at 0ElseLetD3=1'ZeroEndIfLetD4=Dt+1'1sIfD3<255ThenReadTableNumerals,D3,DtLetD3=DtEndIfIfD4<255ThenReadTableNumerals,D4,DtLetD4=DtEndIfIfDp_On=Dp_HrThenLetD3=D3-128EndIfIfDp_On=Dp_MnThenLetD4=D4-128EndIfLetD_Lat=0'Start output data latchShiftData(D1)'1000sShiftData(D2)'100sShiftData(D3)'10sShiftData(D4)'1sLetD_Lat=1'End output data latchEndSubSubClearDisplayForTemp=1to4SendSpaceNextTempEndSubSubSendSpaceLetD_Lat=0'Start output data latchLetD_Data=1ForClocks=1to8LetD_Clk=0'Shift register clockedWait1uSLetD_Clk=1NextClocksLetD_Lat=1'End output data latchEndSubSubShiftData(DataOutAsByte)ForClocks=1to8LetD_Clk=0'Shift register clockedLetD_Data=DataOut.7LetD_Clk=1RotateDataOutLeftSimpleNextClocksEndSubSubErrorSub(InE_TypeAsByte)DoShowMessage(E_Type)Wait500mSShowMessage(Blank)Wait500mSLoopEndSub'A 136'B 128 b 131'C 198 c 167'D 192 d 161'E 134'F 142'G 194'H 137 h 139'I 207 i 239'J 241'K 137 k 139'L 199'M 200 248 n,n 171 187'N 200 n 171'O 192 o 163'P 140'q 152'R 206 r 175'S 146't 135'U 193 u 227'V 193 v 227'W 193 241 w 227 243'X 137'Y 145'Z 164'Deduct 128 from a value to show a decimal point''0 192'1 249'2 164'3 176'4 153'5 146'6 130'7 248'8 128'9 152'Deduct 128 from a value to show a decimal pointSubShowMessage(InMessageAsByte)IfMessage=E_HandsThenLetD_Lat=0'Start output data latchShiftData(255)'SpaceShiftData(255)'SpaceShiftData(134)'EShiftData(137)'HLetD_Lat=1'End output data latchEndIfIfMessage=E_DS3231ThenLetD_Lat=0'Start output data latchShiftData(255)'SpaceShiftData(255)'SpaceShiftData(134)'EShiftData(198)'CLetD_Lat=1'End output data latchEndIfIfMessage=E_Other1ThenLetD_Lat=0'Start output data latchShiftData(255)'SpaceShiftData(255)'SpaceShiftData(134)'EShiftData(249)'1LetD_Lat=1'End output data latchEndIfIfMessage=E_Other2ThenLetD_Lat=0'Start output data latchShiftData(255)'SpaceShiftData(255)'SpaceShiftData(134)'EShiftData(164)'2LetD_Lat=1'End output data latchEndIfIfMessage=BlankThenLetD_Lat=0'Start output data latchShiftData(255)'SpaceShiftData(255)'SpaceShiftData(255)'SpaceShiftData(255)'SpaceLetD_Lat=1'End output data latchEndIfEndSubSubShowVersionShowValuesSub(CompileDate,0)Wait1000mSShowValuesSub(ComPileMnth,0)Wait1000mSShowValuesSub(CompileYear,0)Wait1000mSEndSubSubStart_Up_SubAllOffClearDisplay'Wipe the LED DisplayShowVersion'It may be that after returning to zero, the pointer needs moving a few steps to align better with'zero minutes?'Hopefully this can be accounted for by adjusting the position of the "loop" on the pointer, but'it may need some software "correction"?DoDoMoveAClockWise(1)LetCountedMv=CountedMv+1ShowValuesSub(CountedMv,0)IfCountedMv>3500ThenErrorSub(E_Hands)EndIfLoopUntilStSw=0LetCountedMv=0ShowValuesSub(CountedMv,0)Wait1000mSDoMove_ClockWise(1)LetCountedMv=CountedMv+1ShowValuesSub(CountedMv,0)IfCountedMv>3500ThenErrorSub(E_Hands)EndIfLoopUntilEnSw=0ShowValuesSub(CountedMv,0)Wait1000mSLoopUntilCountedMv>2999LetCountedMv=0DoMoveAClockWise(1)LetCountedMv=CountedMv+1ShowValuesSub(CountedMv,0)IfCountedMv>3500ThenErrorSub(E_Hands)EndIfLoopUntilStSw=0LetStepSequence=1LetCountedMv=0ShowValuesSub(CountedMv,0)'It may be that after returning to zero, the pointer needs moving a few steps to align better with'zero minutes?'Hopefully this can be accounted for by adjusting the position of the "loop" on the pointer, but'it may need some software "correction"?Initialise_I2CStart_DS3231GetTime'Show the time stored in DS3231ValidateHourShowValuesSub(Hour,Dp_Hr)Wait1000mSShowValuesSub(Min,Dp_Mn)Wait1000mSEndSubTableNumeralsasByte192'0249'1164'2176'3153'4146'5130'6248'7128'8144'9EndTableTableMonthDays;#ofdaysinMonths3129;leapyearsonly31303130313130313031EndTableSubStart_DS3231' aging offset' Zero compensation added hereDS3231_WriteRegister(0x10,0b0000000)GetDateIfCentury_Flag=1ThenDS3231_HandleCentury(Century_Flag,Century)EndIfDS3231_SetHourMode(24)'24-Hour modeDS3231_EnableOscillator(True)'and, ensure the clock is runningDS3231_Set32kHz(True)'and, enable the 32kHz Output (EN32kHz).DS3231_EnableSQWDS3231_SetSQW0'and, turn ON output as we will use as the alarm port!DS3231_DisableSQWDS3231_DisableAlarm1DS3231_DisableAlarm2'initialise a tracking variablepowerloss=FalseEndSubSubCheck_DS3231_StatusIfDS3231_OscillatorStopFlagStatus=TrueThen' has a power loss occurred? and the oscillator has stopped?Letpowerloss=TrueDS3231_ClearOscillatorStopFlagEndIfEndSubSubInitialise_I2C#IfDefI2C_DATAI2CStart' is DS3231 present?I2CSend(DS_AddrWrite)I2CStopLetD_Lat=0'Start output data latchShiftData(255)'SpaceShiftData(255)'SpaceShiftData(207)'IShiftData(198)'CLetD_Lat=1'End output data latchWait250mSIfI2CSendState=FalseThen' is DS3231 present?ErrorSub(E_DS3231)EndIf#EndIfEndSubSubGetTimeDS3231_ReadTime(Hour,min,sec,am_pm)IfHour>23ThenLetHour=0EndIfIfMin>59ThenLetMin=0EndIfIfSec>59ThenLetSec=0EndIfEndSubSubGetDateDS3231_ReadDate(DOW,Date,Month,Year,Century_Flag)'get initial dateIfCentury_Flag=1ThenDS3231_HandleCentury(Century_Flag,Century)EndIfIfDOW>7ThenLetDOW=1EndIfIfDOW<1ThenLetDOW=1EndIfIfDate>31ThenLetDate=1EndIfIfDate<1ThenLetDate=1EndIfIfYear>99ThenLetDOW=21EndIfIfYear<1ThenLetYear=21EndIfEndSubSubSet_TimeValidateHourDoShowValuesSub(Hour,Dp_Hr)Wait100mSLoopUntilOkSw=1Wait500mSDoShowValuesSub(Hour,Dp_Hr)IfUpSw=0ThenLetHour=Hour+1IfHour>12ThenLetHour=1EndIfEndIfIfDnSw=0ThenLetHour=Hour-1IfHour<1ThenLetHour=12EndIfEndIfWait250mSLoopUntilOkSw=0DoShowValuesSub(Min,Dp_Mn)Wait100mSLoopUntilOkSw=1Wait500mSDoShowValuesSub(Min,Dp_Mn)IfUpSw=0ThenLetMin=Min+1IfMin>59ThenLetMin=0EndIfEndIfIfDnSw=0ThenLetMin=Min-1IfMin>59ThenLetMin=59EndIfEndIfWait250mSLoopUntilOkSw=0DoWait100mSLoopUntilOkSw=1EndSubSubSaveTimeDate'Whenever the time and date are saved, the date is reset to the compile date'As the date is never seen, we don't care about the date!LetDOW=CompileDayLetDate=CompileDateLetMonth=CompileMnthLetYear=CompileYear'Whenever the time and date are saved, the date is reset to the compile date'As the date is never seen, we don't care about the date!DS3231_SetHourMode(24)DS3231_SetClock(Hour,Min,Sec,DOW,Date,Month,Year)powerloss=False' reset tracker variableDS3231_ClearOscillatorStopFlagEndSubSubValidateHourIfHour>12Then'Not interested in 24Hr clockLetHour=Hour-12EndIfIfHour=0ThenLetHour=12EndIfEndSubSubGetTemperatureLetTempMSB=DS3231_ReadRegister(0x11)' Let TempLSB = DS3231_ReadRegister(0x12)IfTempMSB>127Then'Minus valueLetMinus=1LetTempMSB=TempMSB-128ElseLetMinus=0EndIf' Select Case TempLSB' Case 0' Let TempLSB = 0' Case 64' Let TempLSB = 25' Case 128' Let TempLSB = 50' Case 192' Let TempLSB = 75' Case Else' Let TempLSB = 0' End SelectEndSub
That is impressive..well I like it.
I think a rc servo could turn 270 degrees and do similar...for a minute timer.
rc servos are just send pulseout to control position and a timer interrupt for the clock.
I'm a tight hobbyist and always look for the cheapest solution...yeah..sad but c'est moi.
My ambition is a small glcd that looks like 4 valve numeric displays. nixie tubes?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I looked at the 270 degree servos. They would have been ideal, but found the application notes rather ambiguous to say the least. The tiny geared stepper motor was much more predictable, and very inexpensive. I think three cost me £3, shipped from China.
I have a fake "Nixie" which uses LCDs to simulate the "Nixie" tubes. It is very good. I also have a real "Nixie" clock, it looks more realistic than the fake one (as it should) but if you'd never seen a real one, you would be happy with the fake.
If of interest I have a frequency counter that uses nixie tubes but the top of valve jobs for display.
Nostalgia is they were a pain to drive... but looked cool before leds were invented.
rc servos ie 1 wire,gnd,supply are easy with gcb.
I use them on my bots for moving the distance sensor and taken them apart to make them
rotate continuously.
You know the position from the pulseout sent.
although not documented in gcb, if you attach a wire to the rc servo potentiometer wiper and connect to a-d pin then you can measure the servo position even when not powered.
I could teach my thing to move fom a manuallu set pattern...maybe.
I couldn't get my head to work out how to move the servos to single (or partial) degree accuracy. I also found that some of them were 180 degree servos, extended in some way which might, or might not, have the capacity to move the full 270 degree range. They were my first choice as I would have liked the speed.
My second choice was some DC motors, geared with position sensors. They looked better, but were larger and more expensive.
The geared stepper motors did at least have the capability of moving the full range I needed. They do sometimes not move the full steps expected, which is why I fitted the "limit switches". With these "limit switches" on the face, should the hand get nudged out of position or fail to move the full number of steps, it will be corrected either when the hand gets to sixty minutes early, or when the new hour starts and the hand returns to the zero position.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using eight steps (micro stepping?) for the motors. This coupled with the gearing, means I need close to 3,200 steps for my 270 degrees between zero and sixty minutes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The second video shows (almost) an entire hour, 2pm - 3pm in time lapse. Shooting it in time lapse means it doesn't take a whole hour, it does take sixteen minutes though. Still, if you've got nothing better to do...
Yes! Another clock! This one has a mechanical minute hand with a retrograde action. The hand moves from "zero" to the "sixty" minute position, once the minutes reach sixty, the hand rotates anticlockwise, back to zero and the hour indicated on the LED display progresses to the new hour.
The video shows the clock being powered up and moving to the current time. When first plugged in, the LED display shows the software build date ( 21 - 05 - 21 ), the minute hand rotates anticlockwise to zero minutes, the hand then rotates to the sixty minute position (this is to check that the limit switches are working) during this proceedure, the LED display shows a count of the steps needed to move the hand from one position to the other - if this is less than that required, an error would be displayed. The minute hand then returns back to zero. The clock module is initialised (the LED momentarily shows "IC") and assuming the time can be loaded, the current time (hours then minutes) is shown on the LED. The minute hand then moves to point to the current time, the LED shows the hours and timekeeping commences.
Inspired by the range of Reservoir Watches.
Code updated with "Error" changed to "ErrorSub" following Anobium's suggestion. When the PCBs arrived I found that the steps required needed a change or two to allow a full rotation, not unexpected really given the prototype was made with a sheet of cardboard with holes punched to mount the motor. This code has those minor tweaks made.
YouTube Video
Last edit: mkstevo 2021-05-29
Great project! Well done. I love the video!
Recommendation in the source. Rename
ERROR()
toERRORHANLDER()
. I later version of the compilerERROR
is a reserved word.And, I just compiled your program using PIC-AS compiler. Works - I am very happy. :-) Means the PIC-AS compiler with MPLAB-IDE works.
Thanks for that. I'll get that changed.
That is impressive..well I like it.
I think a rc servo could turn 270 degrees and do similar...for a minute timer.
rc servos are just send pulseout to control position and a timer interrupt for the clock.
I'm a tight hobbyist and always look for the cheapest solution...yeah..sad but c'est moi.
My ambition is a small glcd that looks like 4 valve numeric displays. nixie tubes?
I looked at the 270 degree servos. They would have been ideal, but found the application notes rather ambiguous to say the least. The tiny geared stepper motor was much more predictable, and very inexpensive. I think three cost me £3, shipped from China.
I have a fake "Nixie" which uses LCDs to simulate the "Nixie" tubes. It is very good. I also have a real "Nixie" clock, it looks more realistic than the fake one (as it should) but if you'd never seen a real one, you would be happy with the fake.
Fake vs. real...
If of interest I have a frequency counter that uses nixie tubes but the top of valve jobs for display.
Nostalgia is they were a pain to drive... but looked cool before leds were invented.
They needed a high-ish voltage to strike the glow, but I don't think they were a particular pain to drive? And they do look good.
rc servos ie 1 wire,gnd,supply are easy with gcb.
I use them on my bots for moving the distance sensor and taken them apart to make them
rotate continuously.
You know the position from the pulseout sent.
although not documented in gcb, if you attach a wire to the rc servo potentiometer wiper and connect to a-d pin then you can measure the servo position even when not powered.
I could teach my thing to move fom a manuallu set pattern...maybe.
I couldn't get my head to work out how to move the servos to single (or partial) degree accuracy. I also found that some of them were 180 degree servos, extended in some way which might, or might not, have the capacity to move the full 270 degree range. They were my first choice as I would have liked the speed.
My second choice was some DC motors, geared with position sensors. They looked better, but were larger and more expensive.
The geared stepper motors did at least have the capability of moving the full range I needed. They do sometimes not move the full steps expected, which is why I fitted the "limit switches". With these "limit switches" on the face, should the hand get nudged out of position or fail to move the full number of steps, it will be corrected either when the hand gets to sixty minutes early, or when the new hour starts and the hand returns to the zero position.
They both look real,
edit...the nixie tubes photos
There's different ways of pulsing stepper motors. the more phases the smaller the movement.
I used full wave to get max speed from the geared https://www.ebay.co.uk/itm/201999043536?chn=ps&norover=1&mkevt=1&mkrid=710-134428-41853-0&mkcid=2&itemid=201999043536&targetid=1140163974409&device=c&mktype=pla&googleloc=9045370&poi=1007436&campaignid=12689628172&mkgroupid=118339815297&rlsatarget=pla-1140163974409&abcId=9300529&merchantid=118951391&gclid=CjwKCAjw-qeFBhAsEiwA2G7Nl1i3cnSCSloGyLnG8lLTGWV4VmFbCWnhl2lHzoDbf4B5VhLoFbiLaRoCoQwQAvD_BwE
you don't need peed but resolution.
Last edit: stan cartwright 2021-05-23
I am using eight steps (micro stepping?) for the motors. This coupled with the gearing, means I need close to 3,200 steps for my 270 degrees between zero and sixty minutes.
I've added two further videos for those who don't have much to do...
The first video shows the clock transitioning from 1.59 pm to 2.00 pm, it only lasts 30 seconds so won't take long to watch.
Short version
The second video shows (almost) an entire hour, 2pm - 3pm in time lapse. Shooting it in time lapse means it doesn't take a whole hour, it does take sixteen minutes though. Still, if you've got nothing better to do...
One hour compressed into sixteen minutes