# Friday, 12 December 2003
« Finalization and the JIT | Main | Asynchronous Exceptions »
ThinkPad

(This entry is totally unrelated to IKVM.NET)

Last week I got my new ThinkPad T41p and it has a cool feature, a built-in accelerometer. It is used to park the harddisk when the system detects shocks or falls down ("IBM Hard Drive Active Protection System").

I reverse engineered one of the IOCTLs that can be used to read the accelerometer data and built a simple C# application that displays an artificial horizon. It includes a simple reusable class that encapsulates the communication with the device driver (the standard IBM device driver).

Source can be found here.

Not very useful, but fun stuff anyway. In Longhorn this could be used to keep the desktop level :-)

Friday, 12 December 2003 14:10:43 (W. Europe Standard Time, UTC+01:00)  #    Comments [13]
Friday, 12 December 2003 14:31:36 (W. Europe Standard Time, UTC+01:00)
Any chance of a picture of it in action? You're crazy, btw... =o)
Friday, 12 December 2003 15:19:54 (W. Europe Standard Time, UTC+01:00)
Hey Jeroen, you should modify your app so that it integrates under the acceleration curve. This way you could get time-to-velocity and time-to-distance measurements from your device and use it to measure 0-60 and 0-1/4 mile acceleration times using your laptop! This might give me a reason to get a T41p (that and the 128MB graphics card :)
Friday, 12 December 2003 15:35:02 (W. Europe Standard Time, UTC+01:00)
In a previous life I used to work on software to do just that, for the oil industry (tracking where you are while drilling a hole). See http://www.bakerhughes.com/inteq/evaluation/mwd/navitrak2.htm for an example of such a tool.
But I'm not sure I feel comfortable using my ThinkPad for this ;-)
Friday, 12 December 2003 18:35:37 (W. Europe Standard Time, UTC+01:00)
Have you considered the lucrative "rolling marbles around a maze" videogame segment?
Monday, 15 December 2003 20:17:38 (W. Europe Standard Time, UTC+01:00)
With a sufficiently accurate 3d model of your environment, could this be used to make the display of the laptop transparent? ;)

(You'd also need an indication of the angle between keyboard and screen to do this, I guess - does the laptop have that?)

Are you going to actually implement the "make your desktop level" hack for Longhorn? I'd love to see a photo or video of that in action ;)
Stuart
Tuesday, 16 December 2003 16:06:43 (W. Europe Standard Time, UTC+01:00)
I don't think there is a sensor to determine the angle between keyboard and display. That would be cool though.

I might implement the Longhorn desktop levelling, but it'll be a while, because you really need the desktop compositing engine and I don't think that's in the current release.
Tuesday, 16 December 2003 21:42:44 (W. Europe Standard Time, UTC+01:00)
Another application: half-fill the screen with simulated water, and have it slosh around realistically as you move the laptop. Or any number of different variations on the "the screen's a box with something in it that behaves realistically" theme: Balls that just stay still until you shake the laptop and they start bouncing around; the standard "aquarium" screensaver but with the fish getting startled when their world gets bounced all over the place, other animals, the marbles-in-a-maze thing suggested earlier, use your computer as an egg-timer by standing it up like a christmas card and then turning it upside down...

The number of useless but fascinating things you can do with this hardware is endless... :)
Stuart
Tuesday, 13 January 2004 23:56:33 (W. Europe Standard Time, UTC+01:00)
Hmmm - I've got it...

Etch-a-sketch - nothing special with the regular UI - however when you shake your machine - boom, a nice smearing erasure....
Jason Kaczor
Thursday, 22 January 2004 11:41:42 (W. Europe Standard Time, UTC+01:00)
Can you post an executable for those of us who can't compile C# code?
Robert Andrews
Thursday, 22 January 2004 12:32:06 (W. Europe Standard Time, UTC+01:00)
The executable (requires .NET Framework 1.1) is downloadable here:
http://www.frijters.net/horizon.zip
Friday, 09 March 2007 00:55:53 (W. Europe Standard Time, UTC+01:00)
Do you know why it isn´t working with Windows Vista?
Tuesday, 27 March 2007 23:08:50 (W. Europe Daylight Time, UTC+02:00)
Thanks for posting this, it helped me out.

I wrote up an explanation and brief guide to accessing the sensor data on a Thinkpad from within a .NET application (the source is in C#). I provide calibration data, example code, a command-line executable for viewing / capturing the sensor data, and a small GUI application that graphically displays the x- and y-tilt values in real-time.

You can find the tutorial, etc. at:

http://www.stanford.edu/~bsuter/thinkpad-accelerometer/

Thursday, 21 June 2007 20:50:31 (W. Europe Daylight Time, UTC+02:00)
Here's my accelerometer app...

http://8r13n.wordpress.com/2007/06/05/it%e2%80%99s-bedtime/
Name
E-mail
Home page

I apologize for the lameness of this, but the comment spam was driving me nuts. In order to be able to post a comment, you need to answer a simple question. Hopefully this question is easy enough not to annoy serious commenters, but hard enough to keep the spammers away.

Anti-Spam Question: What method on java.lang.System returns an object's original hashcode (i.e. the one that would be returned by java.lang.Object.hashCode() if it wasn't overridden)? (case is significant)

Answer:  
Comment (HTML not allowed)  

Live Comment Preview