SALES INQUIRIES: 1 (888) 767-9864

Measuring the time interval cycle for the pendulum on large grandfather clocks using Arduino :: Student Project

How fast does a clock tic toc?

That’s what John Brigham wanted to figure out, so he used an Arduino and a very basic photo-interrupter circuit to measure it.

Read more below about what inspired him to measure time intervals of grandfather clocks in the first place, and learn about how his Arduino project works.

Large wood jig wioth grandfather clock and Arduino with wires attached to wall.

What was the motivation for measuring the time interval cycle for the pendulum on large grandfather clocks?

My hobby is mechanical clocks; like the type that have a pendulum.

Adjustment on the nut at the bottom will slow down or speed up the clock.  But the specifics are complicated to the point that after years, I still have no good system.

Let’s use Arduino! The detector is a photo interrupter module. The one I have us designed for measurement of rpm with a small disk.

This gives me encouragement that it will respond very quickly.  A narrow vane, attached to the pendulum goes through the interrupter module creating one boolean HIGH/LOW signal per tic toc.

The interrupter module comes with a sketch that will turn on an LED during the interruption, making for a nice QC check during development.

Then simply add the micros() function to catch the time for the LOW.  The previous value has to be passed to another variable. All variable have to be (long int) It is very doable and leads to interesting results.

Arduino board with wires and bread board stuck to wall, with wood jigs next to a grandfather clock

I have not really worked out the data side, but this works: Pass the data out through the serial monitor.

I have been using no line breaks. Click and drag and then CNTRL C for copy and then in NotePad, edit … Paste.

Then open in EXCEL. Use the import wizard and then graph using the graph wizard. (EXCEL is amazing)

My basic kit did not have the photo interrupter module, so I had to order it separate. Try it!

How does your project work?

The project sends the interval data out to the serial monitor

What was your biggest struggle as you worked through this project? I was convinced that the signal was in the middle.

I could not figure out why my photo-interrupter modules were not working.

I was moving toward making them from scratch with an IR detector and IR emitter when I realized my error. The leads are ground, 5V, signal.

 

Did the project end up as you expected?

The relationship between the swing of the pendulum and the actual time was difficult to adjust.  Now, I should, with some organization and thought, be able to get it right in a much shorter time.

Overall, the project was easy. The physical apparatus for catching the pendulum with photo-interrupter module was a big time sink.

The software was easy and the circuit is easy. Really!

grandfather clock mechanism in jig for arduino testing

Looking back on this project, what can you say you have learned about programming and/or electronics through the creation process?

I learned a lot in both categories.  Programming and electronics is an excellent creative expression!

Was the training at Programming Electronics Academy able to help you build your skill?

helped me a lot.

What type of Arduino board, Arduino clone, or Arduino compatible board does your project use?

I used a Mega 2650 from Elegoo, but an Uno would work fine.

What components did you use in your project?

Resistors, LEDs, Photo interrupter

How do you power your Arduino project?

Via USB from my computer

Arduino Code:

#define led_out 9
#define sensor_in 4

boolean val;//  this defines the variale for the input
boolean oldval;  //old state of the variable

long int mytime = 0 ;
long int oldtime = 0;
long int diftime = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode (led_out, OUTPUT);
  pinMode (sensor_in, INPUT);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  oldval = val;
  val = (digitalRead (sensor_in));

  if ((val == HIGH) && (oldval == LOW))  {
    digitalWrite (led_out, HIGH);
  }
  else if ((val == LOW) && (oldval == HIGH))  {
    digitalWrite (led_out, LOW);
    
      mytime = micros();
      diftime = mytime - oldtime;      
      
      Serial.print (" ");
      Serial.print (diftime );
   
    oldtime = mytime;
  }
}

 

John Brigham is a retired chemistry and biology teacher.  He took his first programming course in 1973 with Fortran. Now he is learning Python and C++.  He just started with Arduino in January of 2018 (though some decades ago he had a certification in electronics).  You should check out his awesome YouTube channel here – where he has tons of videos on molecular biology, chemistry and other very cool stuff.

Leave a Comment