{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Motion Sensing with a PC

Motion Sensing with a PC - Turn Your PC Into a Motion...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
http://www.devx.com Printed from http://www.devx.com/dotnet/Article/32278 Turn Your PC Into a Motion Sensing Security Device with .NET Thanks to new types of hardware that can easily be programmed using .NET, you can create a motion sensing application that can be deployed for security—or just for fun. by Wei-Meng Lee n my inaugural article on how to integrate your .NET applications with external devices, I showed how to display system information using an LCD display. In this article, I will dive into the world of sensors. Sensors are interesting devices because they are the "eyes and ears" of your computer and can provide detailed information about the surroundings, such as temperature, lighting detection, proximity measurement, and so on. For this article, I will be using two types of sensors: a passive infrared (PIR) sensor and an ultrasonic sensor. The PIR Sensor from Parallax (see Figure 1 ) is a low-cost sensor ($7.95) that is able to detect motion by using the principle of infrared radiation. It can detect motion up to a range of 20 feet. Its connection is a simple three-pin connector—GND, 5VDC, and a signal line. When motion is detected, the signal line will register a 1, and will fall to 0 when the motion stops. It is ideal for detecting movements. The second sensor, the PING))) Ultrasonic Sensor (see Figure 2 ), is much more interesting and it is able to provide precise measurement of distance ranging from 2 cm to 3 meters. It works by emitting a short ultrasonic burst and then measures the time it takes the burst to bounce back when it hits an object. By timing this process, it is able to calculate the exact distance between the sensor and the object. The PING))) sensor costs $24.95. Like the PIR sensor, the PING))) sensor has a three-pin connector—'GND, 5VDC, and a signal line. The signal line will return the distance measured in pulses (more about pulses later in the article). Connecting to the PC Unlike the LCD module that I discussed in my last article, the two sensors in this article cannot be directly connected to the RS-232 serial port of the PC. PC serial ports works on RS-232 voltages and serial communication, while the PIR and PING))) sensors run at 5V (TTL) and uses Pulse-Trigger and Pulse-Width to trigger. Hence, you need a microcontroller to connect to these two sensors; the microcontroller can return the results back to the PC via a serial connection. For this purpose, I used the BASIC Stamp 2 (BS2) Module , also from Parallax. The BS2 is a microcontroller that runs at 20MHz and can execute approximately 4000 instructions per second. The BS2 costs $49. You also need a board to house the BS2 module. I used Parallax's USB Board of Education (BoE) Figure 1 . The Parallax PIR sensor is shown. Figure 2 . The PING))) ultransonic sensor is shown.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}