Accelerometers

Well I finally broke down and got an iPhone.  Up to this point I always said that smart phones are just oversized calculator watches.  Then, I remembered that I used to wear a calculator watch.  I guess that I am in the right demographic to want one of these things.  Anyway... I'm pretty impressed by it, and have been going a little crazy lately searching for and downloading apps (just the free ones).  I went and downloaded the x-code coding environment from Apple, so that I could play around with building my own apps.  I got the HelloWorld app to run, but that's it so far.  I'm still trying to wrap my head around the Objective C programming language.

This got me thinking about what would be a cool app to create.  I came up with an idea.  I don't know if I'll ever have time to build it, but I wanted too get feedback from Swaylock’s folks on the utility and the ethical issues around it.  Note: If I ever do build it, I'll make it a free app.  I don't have any monetary aspirations for this idea.

Here's my idea:

The app would use the three accelerometers on the iPhone to plot the motion of the phone as you moved it over a surface.  For example you could place the phone on the nose of a surfboard, hit a button on the screen to start recording, and then move the phone down the length of the stringer.  You just made a copy of the rocker curve.  Another menu would allow you to trace the outline of the profile of the board.  You could, potentially, move the phone randomly over the entire surface -- top and bottom -- as it sits on a rack.  The program could then draw polygons through all the points, and create an exact replica of the board.  Note:  I'm haven't gone over all the capabilities of the iPhone accelerometers.  This kind of thing may not be possible yet.

I am bringing this topic up because more and more devices are coming equipped with accelerometers.  I imagine that this sort of 3D scanning will become come place over the next few years.  I can see that this brings with it some ethical arguments.  This method would probably be far more accurate than the methods of copying that were posted a while back on the Lost Rocket thread.  I can just see someone walking into a surf shot, looking around to see if anyone is watching, and then breaking out their hand held accelerometer device to do a quick scan of a board.  Their software would then convert it into a file format that a shaping machine could read.

Cool, the only problem with that is, for the most part they’ll be getting a copy of a shop board. No dis to the shapers who mow for the shops intended. But, I doubt you could buy the blank, have it machined, then send it out for sanding and glassing for less than the cost of the shop board to begin with. That is assuming they’re scanning it because they can’t shape it themselves, they probably can’t finish it themselves either.

I think photometric 3d scanning (already exists and runs under Linux) would be more likely. All you need is two cameras on either end of the device, maybe one on an extendable arm to get better separation. Then you’d only have to step back and take a picture of the top, and a picture of the bottom, enter in a scaling factor and you have it.

In either case, someone who knows the machine will always need to post process the data to get it ready for cutting, otherwise you risk the machine boring a big ass hole right where an invisible bad data point is.

hmmm, sounds pretty good.

If iphones could scan/measure rocker , then I’d consider one

otherwise,… Dont Need.

There are lots of friends boards I could measure casually but I dont casually carry around all

my measuring tools including a rocker stick…but with a device like this, I could get by

with the iphone and a measuring tape and be in business for compare and contrast studies

in my board shaping.

 

…and Marco btw, I use shape3d, have my blanks milled and pay for professional glassing

and my boards come in at or around $275 w/o any volume discounts in SoCal. So I am not sure of

what price breakpoint you were talking about.

 

 

 

$275 is pretty good. I’ve seen shop short boards new in the $375/$450 range. Last I heard a glass job with color and gloss for a long board at Moonlight was going for more than that. But, I haven’t made any serious inquiries cause I glass my own. (The 2 a year or so that I do.)

 

 

I don't think I will get sophisticated enough to build an app that could scan a board for machine shaping.  I was only suggesting that it was a possibility.

For the app I had in mind I was thinking about having a couple of PDF files as output: a spin template for the profile, and a rocker template.

How are you going to measure the speed you move across the board?

By integration of the acceleration? (be sure to include the beginconditions)

 

I think it’s very advanced mathematics, you’re dealing with! Beacause you’ll have to seperate the acceleration due to gravitation and the acceleration due to moving your phone.

 

If you succeed, I’m very interested in your calculation method!

succes!

Gravity is a force not an acceleration (unless you drop the phone(don’t do that)).

It should certainly be possible, however I’m not sure about the accuracy. Worth a shot.

I don’t know the API of the IPhone, but I think just starting off with writing the current position onscreen would be a good starting point. Feel free to PM me if you need any help.

We’ve been looking at different versions of this at work, though very impressive it did not have the accuracy that we needed for our applications so I doubt it would be accurate enough for a surfboard.

I don’t think it’s possible.
You cannot measure absolute position and speed with an accelerometer.
An accelerometer measures the acceleration as you begin to move the phone but then
if you are moving the phone at a constant speed along the board the acceleration is=0
and therefore, at that time, an accelerometer tells you nothing.

 

 

 

True, you cannot measure absolute position and speed like that. However, you can measure relative speed and position.

Secondly, you need to think in more than one dimensions. The IPhone has three sensors right?

I’d be extremely surprised if anyone could move an IPhone at constant speed in three dimensions. This will depend highly on the sensitivity of the sensors in the IPhone though. But with the pricetag they should have some good sensors…

 

Hey Haavard,
Your formulas are quite correct, and i was thinking in three dimensions, which makes it worse.
You only need to be moving at a constant speed for a very short time in any one of x,y,z and the calcs hit the skids (acceleration=0).
Also the errors will be cumulative, as each measurement will be based on an offset from the previously calculated position.
Wii remotes have accelerometers in them but need the infra-red bar as well to be able to calculate the position of the remote.
It cannot accurately sense the position using it’s inbuilt accelerometers alone.
(When i’m bowling, it doesn’t seem to be able to do it accurately even with the bar, but thats another matter :wink:
i really think you would be wasting your time trying this which is why i chimed in, but the only way to really prove it is for swied or yourself to write it,
I’d love to be proved wrong as it would be a cool little app.

BTW. Great job your doing with Boardcad, and thanks for sharing it.

[quote="$1"]

Gravity is a force not an acceleration (unless you drop the phone(don't do that)).

It should certainly be possible, however I'm not sure about the accuracy. Worth a shot.

I don't know the API of the IPhone, but I think just starting off with writing the current position onscreen would be a good starting point. Feel free to PM me if you need any help.

[/quote]

Actually, gravity is measured as an acceleration.  It is about 9.8 meters/second/second (at the surface of the Earth).  The classical equation for force is F = ma, which is measured in kg meters/second/second.  As Hans mentioned, you do need to subtract out the acceleration of gravity.  I'm not sure if I will need to do the calculations using spherical coordinators, or if I can just assume that the world is flat.  I'll try it both ways, and see if it is important.  My guess is that the flat Earth approximation will be fine.

I know it can be done from a theoretical perspective.  The question is, does the iPhone have a short enough sampling period to allow for accurate results?  I imagine that I will need to have and accuracy of +/- 1/16 of and inch.

Before I get this thing going I am going to have to learn Objective C, and Cocoa.  I know C, but this is a little different.  It may take some time before I get anything to work.

Greeny, you may be correct about the cumulative errors messing up the accuracy.  I guess the only way to find out is to get out the pen and paper, and work out the calculations.  I think that smart bombs use accelerometers in conjunction with GPS readings to zero in on their targets.  The new iPhones also have GPS meters.  Unfortunately, the non military version of GPS has noise added to reduce accuracy.

As far as the initial conditions go, I was planning on having the user place the iPhone on the nose to start.  They would then push a button on the screen, which would set that point in space to be the origin.  As you moved away from that point it would take the readings.  When you get to the end of the board you would push the button to stop it.

You’ll have to substract the acceleration due to gravitation if you want to cumulate the speed by integration of the acceleration. (That’s what I was trying to say)

That’s not needed when using GPS, I hope GPS is accurate enough.

 

Maybe you can lay a strip with markings (every inch for example). And then use the camera to measure the speed, or capture the angle at every mark? That strip can be easy to carry around, you can roll it up.

Would this be possible?

I still reckon it’ll never fly :slight_smile:
That said, good luck to you.
Here’s a link that might help you start.

http://en.wikipedia.org/wiki/Inertial_navigation_system

 

Edit: Apologies to you and Haavard, as having read that link it shows i was talking out of my a$$ in my earlier post about constant
velocity as of course if you start measuring at rest and you measure all acceleration you can calculate the velocity at any time.
However i still think the iphone is not up to it and cumulative errors will sink you.

http://en.wikipedia.org/wiki/Gravity

http://en.wikipedia.org/wiki/Accelerometer

“As a consequence, quite counter-intuitively, an accelerometer at rest on the Earth’s surface will actually indicate 1 g upwards along the vertical axis.”

Dammit, now I want an IPhone…

 

It’s really not likely iPhone GPS will be accurate enough… the error will be very significant. And by the way, we’re not talking inches or centimeters, more like yards and meters, if that. GPS will also give you altitude, but the error on that value (for the iPhone) is probably worse than longitude and lattitude.

But let’s say you did generate a bunch of (time, GPS) data. The GPS being resolvable into three orthogonal coordinates.  From those datum points, say (time-1, GPS-1), (time-2, GPS-2), (time-3, GPS-3), … , (time-n, GPS-n), which for convience say where sampled at constant time intervals, you could easily generate a an average velocity vector for that time interval. That is you’d get a speed for each of the three directions, which you could associate with the middle value of the the time for each interval. From that data you could then easily do the same with the generated data (time-12, velocity-12), (time-23, velocity-23), … where time-12 is the middle time value for the interval time-1 to time-2, and calculate the average acceleration for time interval using the velocities, in a similar manner.

For example, here’s one approach

time-1, GPS-1_lattitude,  GPS-1_longitude, GPS-1_altitude

time-2, GPS-2_lattitude,  GPS-2_longitude, GPS-2_altitude

time-3, GPS-3_lattitude,  GPS-3_longitude, GPS-3_altitude

Then for the lattitude position,

time-1, GPS-1_lattitude

time-2, GPS-2_lattitude

time-3, GPS-3_lattitude

We get,

velocity-12_lattitude = (GPS-2_lattitude - GPS-1_lattitude) / (time-2 - time-1) 

velocity-23_lattitude = (GPS-3_lattitude - GPS-2_lattitude) / (time-2 - time-1)

associating each velocity point with the mid point value of time in the interval, e.g. time-12 the mid point between time-1 and time-2.

Then using these points,

acceleration-13_lattitude = (velocity-23_lattitude - velocity-12_lattitude)/ (time-23 - time-12)

acceleration-34_lattitude = (velocity-34_lattitude - velocity-23_lattitude)/ (time-34 - time-23)

,

Again associating each acceleration point with the mid point value of time in the interval, which will happen to be time-2 for acceleration-13_lattitude; time-3 for acceleration-34_lattitude, etc.

Then just do the same for longitude and altitude.

Simple stuff, and writing the obj C would also be simple. (By the way, obj C uses the similar syntax to C, but you’ll waste its power if you don’t use its OOP features, which are easily learned… kids master them all the time now… )  Programming is all pretty literal, that’s what throws people off.

Anyway, incorporating the error would only involve a few more steps…which you might not want to do… it will only depress you. (Technology has yet to catch up with your creativity.)

As for gravity? None of this will say anything about gravity, this is just kinematics.

… and on snatching templates, designs, etc. … iPhone GPS would turn any board into a really really really off “close tolerance blank”… if you were lucky.

kc

Yeah based on all the arguments and acceleration = 0 at times of constant speed,

I dont think the iphone could measure rocker with the accelerometers in 3-d/2-d, whatever.

GPS assist wouldnt be of use either.

I appreciate everyones scepticism.  I'm still optimistic that it will work.  Even if there is some noise in the data, it can probably be reduced by using various smoothing algorythms.  I wish I didn't have real work to do right now, or I would start researching now.  I'll try to spend some time on this tonight after the kids go to sleep.

If anyone knows of a quick and dirty way to get raw iphone accelerometer data into a spreadsheet it would save me a bunch of time.  Is there an app for that?