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.

Parallax Passive-Infrared (PIR) Sensor

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 This link leaves the Microsoft.com site.. The following table describes each sensor in the kit.

SensorDescription
Ultrasonic Distance Measures the distance from the sensor to a given object
Passive InfraredDetects motion in front of the sensor
Two-Axis AccelerometerMeasures acceleration along two axes
CompassMeasures 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.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft