*
The clock was made by William Yeadon of Stourbridge in around 1750. In a handsome fruitwood case it is one of his early works. 
 
If you don't have a downstairs maid, a thirty hour clock takes a lot of work! 
 
Now with a conputer controller upgrade the clock keeps perfect time, doesn't need winding and has a sweet chime. 
 
The changes preserve the original clock parts.  
 
A Raspberry Pi is used to control a stepper motor, a position sensor, an LED and a solenoid chime actuator. 
 
The software uses Free Pascal and has a novel browser control interface. 
 

 
Antique Clock Computer Automation
*
*
detent.png
The original configuration controls a detent arm using a pawl attached to the hour wheel. When the minute hand is at the top of the hour, the chime counter wheel is briefly released and rotates anti-clockwise driven by the chain weight. Slowed by a governor paddle, the length of the chime counter wheel 'section' determines the number of times the bell is struck before the detent arm is re-engaged by the next 'cutout' stopping the wheel rotation
 
In the computer cotroller configuration the detent arm is re-positioned near an IR beam detector and the counter wheel mechanisim isolated. The beam interruption is used to detect when the minute hand is at the top of the hour. The stepper motor counters can be reset for the new hour to avoid systematic errors and the appropriate computer controlled hourly chime initiated.
*
*
An aluminium framework is clamped to the existing carcass. The pendulum, chain, weights and escapment are removed and preserved. All changes can be reversed with no damage by a future restorer,  
 
Motive power and hand movement is now controlled by a stepper motor 
 
28BYJ-48 
 
The stepper motor assembly must be micro-adjustable. If you can't find exactly the right teeth per inch for the driving cog, in low torque applications like this one, use a close match but angle, distance and offset the drive to avoid "face to face" jams. i.e. to avoid top of opposing teeth meeting perfectly
 
The chime clapper is replaced by a ball bearing "fired" by a computer controlled solenoid via a relay.
*
28BYJ-48 stepper motor
*
 
//
Wiring assignment  

// TPIN uses GPIO numbering NOT HEADER PIN 
  
//
Stepper controller
gpioLine[1]:=tpin.create(
17); // (GPIO 17) Header pin 11
gpioLine[2]:=tpin.create(
18); // 12
gpioLine[3]:=tpin.create(
27); // 13
gpioLine[4]:=tpin.create(
22); // 15
direction:=clockwise;
for line:=1 to 4 do gpioLine[line].switchDelay:=1;
step:=0;
beamSensor:=tpin.createSensor(
16); // IR beam interruption sensor attached  
 
beamStatus:=beamSensor.sense;

chime:=tpin.create(
23); // relay that operates the solenoid bell ringer
chiming:=true;

led:=tpin.create(
26); // LED
*
Software 
  
sudo ./CLOCK
 
CLOCK.PP source. This program must be running. It uses four phase sequencing of the signals to the stepper control board to advance the minute hand every 6 secoconds. The beam sensor is checked.  
 
Detecting a "detent" arm fly back intitates top of the hour processing.- if the minute hand has overrun the computer time the system waits until for the top of the hour . If the computer time hour transition occurs before the detent flyback the minute hand is rapidly advanced to the top. .In this way, the cog teeth count and the steps per second need not be very accurate. Resetting the clock just involves placing the minute hand at roughly the right position (but at least ten minutes before the hour to avoid the detent preparation zone)
 
Chimes are at "social hours" only. 
 
To avoid complicating this program special textual commands are recovered from a simple "in memory" buffer. 
 
sudo ./RFP 
  
RFP.PP source. This optional program provide a trivial HTTP server. RFP launches threads to service TCP/IP HTTP GET requests on PORT 80. LINUX architecture permits several programs to share a designated piece of memory. In this case, memory is shared with CLOCK. Any HTTP POST request is written to the shared memory buffer to be treated as a "command" by CLOCK.PP   
 
e.g. CHIME command  initiates an out of sequence chime including quarters 

See INDEX.HTML FORM definitions

 SOURCES.ZIP
 
Contact pete@stamp.host  
rev2 - June 2023