Group Abstract Group Abstract

Message Boards Message Boards

An experiment in Moment of Inertia with Raspberry Pi / Arduino

GROUPS:
Wanted to share with my kids the classical experiment on a rolling object down an incline plane using legos, arduino and Mathematica for the Raspberry Pi.

Using a window valance and some lego technic pieces we proceeded to build the inclined plane platform.



Using legos was great to allow to attach both leds and photorresistors to the inclined plane. It also allowed us to set up build a platform from where to attach a servo motor and a protractor to measure the angle of inclination.


We'll detect when the ball reaches a certain point of the platform by the the disminution of the LED light received at the photoresistors.


The adafruit web site is a very good site to explain the details on how to connect the photoresistors and leds to the Arduino.
http://learn.adafruit.com/adafruit-arduino-lesson-2-leds/leds
http://learn.adafruit.com/photocells/using-a-photocell

As the readings of the photocells require of analog inputs, we decided to use a spare arduino we had at our disposal, and to have more fun, use XBEE modules to connect the arduino to the raspberry pi.


The following is the code at the Arduino.
 
 #include <Servo.h>
 int servoPin = 9;
 int LightSensor[4]={A1,A2,A3,A4};
 int current[4]={0,0,0,0};
 double timers[4]={0,0,0,0};
 int previous[4]={0,0,0,0};
 
 Servo servo; 
int i=0;
double factor=0.7;
double timer = 0;
int inByte =0;

void setup()
{
  Serial.begin(19200);
  servo.attach(servoPin);
  servo.write(0);
  delay(2000);
  for (i=0;i<4;i++){
    previous[i]=analogRead(LightSensor[i]);
  }
}
void loop()
{
if(Serial.available()>0){

  inByte=Serial.read();

if (inByte==65) {
    servo.write(90);
    timer=millis();
    trackBall();
    for (i=0;i<4;i++){
      Serial.println(timers[i]);
    }
    servo.write(0);
  }
}
}

void trackBall(){
int m =0;
  while (m<4){
    current[m]=analogRead(LightSensor[m]);
    if (current[m]<factor*previous[m]){
      timers[m]=millis()-timer;
      m++;
  }
  }
}

Mathematica code and results to follow
 serial = DeviceOpen["Serial", {"/dev/ttyUSB0", "BaudRate" -> 19200}]
 lengths = {0., 0.175, 0.43,
 
    0.69} ;(*Distance between light sensors in meters*)
 data = {};(*List to capture the time between sensors*)
 ping := Module[{}, DeviceWriteBuffer[serial, {"A"}]; Pause[3];
 
   ToExpression[StringSplit[FromCharacterCode[DeviceReadBuffer[serial]]]]/1000]
 (*Function pings sends an "A" to the arduino to release the ball and \

collect timing*)
Button["Collect Data", data = Append[data, ping]]
Dynamic[tdata = Transpose@data;

dataPoints =

  Flatten[Table[{tdata[[i, j]], lengths[[i]]}, {i,

     Length[lengths]}, {j, Length[data]}], 1];

lm = Fit[dataPoints, {1, x, x^2}, x];

Plot[lm, {x, -0.3, 1.2},

  Epilog -> {Red, PointSize[Large], Point[dataPoints]},

  AspectRatio -> 1, PlotLabel -> lm]]
Using a hollow ball, we can work out the gravity value


Using a golf ball


A couple of videos of the experiment in action
https://www.youtube.com/watch?v=4eRZ48N3vM8
https://www.youtube.com/watch?v=eLVPpEcyw_0
https://www.youtube.com/watch?v=53WaEcRWY_0
POSTED BY: Diego Zviovich
Answer
8 months ago
This is wonderful! As a physicist I can fully appreciate fun of building such a setup. I looked through your notes and will try to help people to see a bit of physics behind the numbers. The acceleration of center of mass (CM) of a rolling body ( no-slipping ) is given by


where I is moment of inertia. For the moments of inertia in your experiment we have

  Hollow sphere               Solid ball
        

So now it is clear where from are the numbers 5/3 and 7/5 in your notebook. I also see that the error for golf (solid) ball is larger. I suspect due to the dimples mainly and as was suggested to me by a friend - non-uniform mass distribution. But also it is more slippery than large tenis ball - so no-slip requirement for the main formula may be a bit violated.

Excellent project!
POSTED BY: Vitaliy Kaurov
Answer
8 months ago
Vitaly , Thanks for documenting the last section of the posting. Should have taken a little bit more time to do so!
The following video from Smoleny1 has a detailed explanation on the calculations for rolling objects down an inclined plane.
http://www.youtube.com/watch?v=gj9H1Ti4yc0
POSTED BY: Diego Zviovich
Answer
8 months ago
Hi Diego,
I'm a student in a high school in rome, I'm trying to reproduce the experiment, but I never used arduino before... can you help me? I have a problem for the electric connection, have you got some schematics? thank you very much!
Francesco 
POSTED BY: francesco emanuele
Answer
7 months ago
Hi Francesco, hope this helps.
POSTED BY: Diego Zviovich
Answer
7 months ago