Windows 7: Building your own sensors

Windows 7 has a built in sensor and location platform, the key feature of this is any sensor devices connected to it become operating system level resources which any number of applications can utilise the data from. Up until now, sensor devices (like GPS) were ‘owned’ by the first application to grab them, and prevented any other application from accessing the device while running. That has all changed in Windows 7, but we are still waiting for sensor manufactures to update their drivers to fit with the new world of Windows 7.

So while they ponder, lets get on and do some cool stuff ourselves!

The MS Press book ‘Introducing Windows 7 for developers’ has a great couple of chapters on the new sensor and location platform – chpr 9 and 10. These make excellent reading to help you understand just how everything works. Luckily for us, just before Christmas, Donn Morse posted a create article and sample on Coding4fun – so we can utilise Donn’s excellent work to make our custom sensors.

In the article, Donn uses the veritable Parallax Basic Stamp 2 as the intermediary between sensors and the Windows 7 machine. The Basic Stamp is well suited to utilising the range of cheap I2C based sensor devices that have been the main stay of homebrew and professional robotics development for decades.

The sample project includes Windows application, Windows 7 sensor driver and Basic Stamp firmware for linking up a motion detector, but also supports a compass sensor, a 2 axis accelerometer, and a ultra-sonic distance sensor. These devices are all inexpensively available from my good friends at Devantech – who also have USB to I2C interface modules including wireless versions. Using these interface modules obviously cuts out the need for a Basic Stamp 2 but requires the Sensor driver to do all the direct sensor work. I shall explore these options over the next few weeks and let you know how I get on!

I know many of you will think the Basic Stamp 2 is somewhat old hat and have been enjoying the more modern delights of the Arduino devices. As the Arduino development boards use USB rather than RS232 to communicate with the PC. Donn comments in his post that he is working with Brian Jepson to create a driver that works with the Arduino – so we can eagerly await this update.

Donn’s Windows application uses the Windows7.SensorAndLocation DLL from the Windows 7 Code Pack which is also available as a free download and includes the source.

Donn explains the detail of the implementation in his article included with the sample download. Based on the Sensor and Location SDK Skeleton driver example, Donn upgrades this hardware emulating driver to use real hardware based on RS232 communications.

The whole project is an interesting read if only to educate yourself more on the capabilities of Windows 7 – but for all of us tinkerers it facilitates another fun project and adds a bucket load of ideas to the task list. I really recommend it to you!