Measuring gravity with a pendulum [code attached]

Hi gang,

This thread got me thinking about ways to measure gravity, and I intend to try that way with a ball falling 2-3 metres.

But since for a simple pendulum, T = 2pi sqr(l/g) it's also easy to find g given the length and measuring the period.

My first thought, and probably how one might try if using a stop-watch, is to clock the bob at the extremities. Problem with that is, as the pendulum dies, the arc reduces so that's a bit tricky. You never really know how far it's going to swing.

So seems the better approach is to clock it as it passes the bottom of the arc, the mid-point, seeing as we know where that is and it doesn't depend on the size of the arc.

It would need two sensors to clock the direction, since a period is when it comes in from the same side consecutively. Or I guess just one would do since then we'll have half a period and that's cool too.

So, my method would be simply to have an IR gate (IR LED and photodiode) at the bottom of the arc. Measure length of string to bob. Drop pendulum from where-ever out to one side, break the beam each time through, and calc g on the fly. Prob need to state machine the breaking of the beam so I don't get multiple clocks while the bobs still in the beam, and then reset that in time for it to get back on the next swing.

Bit of a ramble there, but I'd like to hear comments.

Nice weekend projects....

Well as G is not going to change you only need to measure it once.

Note the maths associated with gravity and pendilum periods only apply for small amplitude swings otherwise errors creap in.

Finally the maths also assume that all the mass is situated at the end of the string, which in a real situation is not true.

Finally the maths also assume that all the mass is situated at the end of the string

No, the maths requires that the mass is situated at the end of a rigid rod of negligible mass.

But as always I'll be doing this for fun, so if I get g a bit off I won't get my knickers in a knot.

You don't need to take the time at the exact bottom of the arc. Anywhere will do as long as the pendulum passes the spot on every swing.

Be careful if using a sensor that is affected by the width of the part of the pendulum that triggers the sensor. Ignore every second reading ? (probably does not matter which set are ignored as long as you are consistent)

...R

Ps Wikipedia knows the answer - 9.80665 :slight_smile:

I love the story about the Ordnance survey mapping India. Apparently they started from the south and were measuring using chains and verifying with a theodolite. The measurements disagreed when they got near the Himalayas (which they did not know existed) and they eventually figured it was due to the gravitational effect of the plateau on the plumb-bob used to adjust the theodolite. I am truly amazed that they had that level of accuracy way back then.

Captain Cook's mapping of the southern lands and the Antartic also truely amazing.
Another great from the UK eh Robin? :wink:

bluejets:
Another great from the UK eh Robin? :wink:

Careful, now. I'm Irish :slight_smile:

...R

next step is to design a "kicker" that can reintroduce energy into the pendulim and figure the
air drag losses based on how much energy you need to reintroduce to maintain the swing

a calculation could determine the rate of energy loss

Robin2:
Careful, now. I'm Irish :slight_smile:

...R

How very appropriate that you're a Shannon member!

Mike, the gravity of earth changes all over the surface of globe (even at sea level).

Maybe you're confusing 'g' with 'G'? ... the gravitational constant (which is empirical itself, but doesn't change as much as 'g').

nice earth ball

Greensprings:
figure the air drag losses

It's ok, I'll be doing this in vacuo. Doesn't every home have a chamber for doing such experiments?

AWOL:
How very appropriate that you're a Shannon member!

I had not thought of that - Claude was American.

Interestingly, though I am not a literary person, I find it easier to bring to mind the names of Irish literary figures. But there have been useful scientific contributors - including Hamilton and Kelvin. I must make a list for myself

...R

JimboZA:
It's ok, I'll be doing this in vacuo. Doesn't every home have a chamber for doing such experiments?

Frequently vacuous does that count ? :slight_smile:

...R

Maybe you're confusing 'g' with 'G'?

Well look what I actually put and meant to put.

The OP's intention is to measure g with a pendulum.

I don't see G being directly relevant to the conversation. I understand its relevant physically, but introducing that idea so early in the discussion seems odd.

Ok so it took me almost a year to get round to this project; became a radio ham meantime. Here's the code if anyone wants to try something similar.

Thanks to jurs in this thread for the code which allows user to dial a number with the buttons on a DFR0009 LCD.

// find "g" with a pendulum
// jimboza feb 2016

// T = 2pi sqrt(l/g)

// photogate on pin 2

// setup() asks for pendulum length, then holds for pendulum
//     to break the beam to start loop()

// Thanks to jurs on arduino forum
//     for how to dial in a value to the LCD
//     http://forum.arduino.cc/index.php?topic=241559.0

// uses LCD panel ala DFR0009.
// left / right keys to choose digit in the pendulum length
// up / down keys to dial a digit
// select key to enter

// ************************************
// change next line to default length
char value[] = "0750"; //mm
// **************************************

float length; //mm

#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

enum {btnNONE, btnSELECT, btnLEFT, btnUP, btnDOWN, btnRIGHT, NUM_KEYS };
const byte ButtonsPin = A0;

byte gatePin = 2;
boolean gatePinVal;
boolean lastGatePinVal;
boolean lengthEntered = false;

byte gateBreakCounter = 0;
int startTime;
float period;
int fullSwings = 0;


float gravity;
float k =   39.48  ; //4 pi^2


int cursorPos;
boolean lcdNeedsUpdate = true;

void setup()
{


  lcd.begin(16, 2);              // start the library
  lcd.setCursor(0, 0);

  //kluge for the lcd backlight problem
  //pinMode(10, OUTPUT); //off
  pinMode(10, INPUT); //on

  lcd.print ("Pendulum mm?");
  lcd.blink();
  while (!lengthEntered)
  {
    enterLength();
  }

  lcd.clear();
  lcd.print("Release the");
  lcd.setCursor(0, 1);
  lcd.print("    pendulum....");
  pinMode(gatePin, INPUT);
  gatePinVal = digitalRead(gatePin);

  while (!gatePinVal)
  {
    gatePinVal = digitalRead(gatePin);
  }
  startTime = millis();

  lcd.clear();
  lastGatePinVal = gatePinVal;

}


void loop()
{

  // read the gate input pin:
  gatePinVal = digitalRead(gatePin);

  // compare the gate's state to its previous state
  if (gatePinVal != lastGatePinVal) {
    // if the state has changed, beam just broke or just cleared
    if (gatePinVal == HIGH) {
      // if the current state is HIGH then beam just broke
      gateBreakCounter++;
      if (gateBreakCounter % 2 == 0) //even number is full swings
      {
        fullSwings++;
        period = ((millis() - (float)startTime) / fullSwings) / 1000.0;
        gravity = k * length / 1000 / (period * period);
        lcd.setCursor(0, 0);
        lcd.print("Cycles:  ");
        lcd.print(fullSwings);

        lcd.setCursor(0, 1);
        lcd.print("Gravity: ");
        lcd.print(gravity);
      }
    }

  }
  // save the current state as the last state,
  //for next time through the loop
  lastGatePinVal = gatePinVal;

}//loop

int read_LCD_buttons()
{
  int returnValue;
  // read ADC value of pressed button
  int adc_key_in =  analogRead (ButtonsPin);
  int adc_key_in1 =  analogRead (ButtonsPin);
  // read again and check for stable ADC reading (software debouncing for analog input)
  if (abs(adc_key_in1 - adc_key_in) > 1) return btnNONE; // if ADC reading is not stable, return btnNONE
  if (adc_key_in < 50) returnValue = btnRIGHT;
  else if (adc_key_in < 195) returnValue = btnUP;
  else if (adc_key_in < 410) returnValue = btnDOWN;
  else if (adc_key_in < 650) returnValue = btnLEFT;
  else if (adc_key_in < 999) returnValue = btnSELECT;
  else returnValue = btnNONE;
  // simple "blocking" code: "Busy waiting" until button is released by user
  while (adc_key_in < 999) adc_key_in = analogRead(ButtonsPin);
  return returnValue;
}


void enterLength()
{
  char key = read_LCD_buttons();
  if (key != btnNONE) lcdNeedsUpdate = true;
  switch (key)
  {
    case btnRIGHT:
      if (cursorPos < 4) cursorPos++;
      break;
    case btnLEFT:
      if (cursorPos > 0) cursorPos--;
      break;
    case btnUP:
      if (value[cursorPos] < '9') value[cursorPos]++;
      break;
    case btnDOWN:
      if (value[cursorPos] > '0') value[cursorPos]--;
      break;
    case btnSELECT:
      length = atol(value);
      lengthEntered = true;
      break;
  }
  if (lcdNeedsUpdate)
  {
    lcd.setCursor(0, 1);
    lcd.print(value);
    lcd.setCursor(cursorPos, 1);
    lcdNeedsUpdate = false;
  }
}

With Arduino you should be able to time short falls close enough to get a good value for G.

Or how about measuring the current you have to feed a coil to levitate a known mass magnet?

Yeah, nice Earth ball....but gives a pretty extreme "impression" the variation in g.

The difference between sea level and the top of Everest is about 0.28% die to height (distance to mass centre)...

The variation on that "gravity map" is due to the density of parts of Earth having variation....but the diagram well over signifies the actual effect.

Where 1 milliGal = 1e-3cm/s2 in acceleration.

So with a range of -50 to +50 mGal... 0.1cm/s2 out of the "average" is the variation due to the density changes.

0.1cm/s2 around 9.81m/s2 = about +-0.01%

I am working on a pendulum project. I know this post is old, but would like to see the code you came up with.