Shebin Jose Jacob
Published © GPL3+

Automated Simple Pendulum

Using a IR proximity sensor and microcontroller to find the local values of 'g' and will plot a real time damping curve.

BeginnerFull instructions provided-360 minutes6,300
Automated Simple Pendulum

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
IR Proximity Sensor
Digilent IR Proximity Sensor
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
ElectroPeak Wood
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)

Story

Read more

Custom parts and enclosures

CAD files

Schematics

Connections and Schematics

Used for understanding the connections..

Code

Code for the automated Simple pendulum

Arduino
//Developed by Shebin Jose Jacob
unsigned long pretime;
unsigned long currtime;
int pin = 2;
float timePeriod;
boolean flag = true;
float g,g1=0,t;
int i=0;
void setup(){
  Serial.begin(9600);
  pinMode(pin, INPUT);
  pretime = micros();
  Serial.println("calibrating");
}
void loop(){
  if (digitalRead(pin) == 0)
  {
    if (flag == true)
    {
    currtime = micros();
    timePeriod = currtime-pretime;
    pretime = currtime;
    flag = !flag;
    t=timePeriod/1000000;
    g=(1.36/(t*t)); // In our case (4π²l=1.36), change it for yours
    g1=(g1+g)/2.0;
    if (i%2==0){
      if (g<12 && g>7){
      Serial.println(g);
      g1,g=0;
      }
    }
      i+=1;
    }
    else{
      flag = !flag;
      delay(100);
    }
  }
 
 /*Uncomment, upload and open serial plotter to see damping curve
  for (i=0;i<360;i++)
  { 
    Serial.println(10*t*sin(DEG_TO_RAD*i));
  }
}
*/

Credits

Shebin Jose Jacob

Shebin Jose Jacob

34 projects • 100 followers
CEO, Co-Founder | Coders Cafe

Comments