Monitoring a Motion Sensor with Windows 7
Microsoft has created sample firmware, a sample sensor driver, and a Visual Studio .NET application that demonstrate the use of sensors in Windows 7. The sample application works with a passive infrared (PIR) sensor to record a date and timestamp each time that the sensor detects motion.
The sample driver supports four sensors that you can purchase from Parallax, Inc., on their Web site. The sensors are part of their Introduction to Sensors Kit . The following table describes each sensor in the kit.
|Ultrasonic Distance||Measures the distance from the sensor to a given object|
|Passive Infrared||Detects motion in front of the sensor|
|Two-Axis Accelerometer||Measures acceleration along two axes|
|Compass||Measures magnetic heading|
When you combine these sensors with a programmable microcontroller such as the Parallax BASIC Stamp 2, you can use them to monitor and transmit data back to a PC. And, by using the sample driver and the new Sensor API for Windows 7, you can collect and display sensor data with less than 200 lines of code.
The sample driver handles the asynchronous transmission of data between a PC and the sensor board. In addition, this driver detects whenever the sensor is disconnected or powered down. The driver supports the Windows Sensor API so that applications can register to receive event notifications when data on the sensor changes and to control the rate at which this data is sent.
Although the sample application supports only the passive infrared sensor, you could easily use this application as a basis to create your own application to monitor data from the three other sensors that the driver supports.
To download the sample firmware, driver, and application (as well as an accompanying white paper), go to Using Windows 7 to Monitor a Motion Sensor in the MSDN Code Gallery.