Charles Petzold



Windows Phone 7.5, the Motion Sensor, and Astronomy

October 11, 2012
New York, N.Y.

If you're a Windows Phone programmer, I hope you still read MSDN Magazine because I've been writing a monthly column mostly about Windows Phone programming. Over the past several issues I've been exploring the Motion sensor introduced with Windows Phone 7.5, culminating with a program that lets you hold up the phone to the night sky to identify the planets and constellations you see there:

If you've ever wondered how such a program works, all the source code is downloadable with the article.

This astronomy program was the culmination of several months of columns about programs that obtain and use the phone's orientation in 3D space. I started this exploration in the June issue with Getting Oriented with the Windows Phone Compass, in which I explored the interaction between the phone's Accelerometer (which lets you know which way is down) and the Compass, which lets you know which way is north.

After that column, I gravitated to the Motion sensor, which combines information from the accelerometer and compass and provides a 3D rotation matrix that describes the phone's orientation in 3D space. In Windows Phone Motion and 3D Views, I present an XNA program that lets you turn the phone to view various sides of a 3D object, and in Viewing a Virtual World from Your Windows Phone I show how to view large bitmaps as if you're scanning them through the phone's screen.

After those preliminaries, it was time to focus on my real objective: a program that lets you view the night sky. The necessary preliminaries are Exploring Spherical Coordinates on Windows Phone and the astronomy program itself is in Viewing the Night Sky on Your Windows Phone.