pcomp13

0

final project

concept

​I found the traces of the double pendulums very beautiful and I want to let people see it, but different from my midterm project, I decided to use an accelerometer and a gyro to get the data and send it to a computer, then draw it on screen. The screen will show the trace right behind the actual pendulum, and people can play with the pendulum to see different paths.

0

trial and error

plan A: accelerometer

First, I tied to get z-axis acceleration of the end point of the pendulum, and use serial to pass data from arduino to processing.

0

0

0

(It took me 2 hours soldering, then I found female to male wires is perfect solution. And thus gained great desolder skill too.)

0

It works, and the accelerometer is pretty acurate. However, the main problem is about the wires. It’s hard to attach wires to a rotating double pendulum with out slow it down.

0

To solve the problem, I bought slip rings.

0

But another problem is how to attach linkages to it. On the one side it’s easy cause it has holes, but the other side is not easy. And the slip ring is not went smoothly (Ben said it need more weights then). More importantly, it looks ugly on pendulum. It makes pendulum lose its cleaness and simpleness, lose the feeling of geomotry.

And another thing is it’s impossible to deduce the actual position of the end of pendulum only use accelerometer, cause all I know it’s acceleration and angle. And the actual value of its acceleration need to be converted to match the “pseudo physics system” in processing.

plan B: webcam and openCV

Then I decided to try use camera to detect color, and draw its trace. It’s clean because nothing should be attached to the pendulum. The good part of plan B is I do not need to worry about the wires and acceleration converting in processing. And testing code is way faster then testing actual physical stuffs like wires. But it’s definitely not as fast and acurate as actual sensors.

I tested if it’s fast enough to draw trace. And it looks like this:

0

(credits to Daniel Siffman’s color piking code)

At first I thought it’s java being too slow, I rewrite the code into c++, but it seems slower for some reason.

Then I found good light condition is vital. And I should choose tracking color wisely(ideal is rgb(0,255,0)). Red is really easy to make it detect human skin.

After adjusting light, the white dot is not jittering.

0

(testing all kinds of greens.)

Then it appears far better then before.

Then I adjust the stroke and background a little bit.

0

Then another problem is if I let webcam face pendulum, then the user is facing the back of it.

I got 2 solutions.

  • First is using the camera of a kinect. After testing, it actually look not as good as webcam.

0

It’s getting too much data, or maybe I should add a depth threshold.

  • Then another solution is not to change the camera direction, but change screen. Aka, attach a screen to mac, and put it behind the pendulum, then put webcam infront of pendulum. Problem solved.

And I made a new version of pendulum. Change its shape. And adjust things.

0

0

0

0