Motion Activated PC Monitor

This page describes a method for turning on a computer monitor when motion is detected.  At our local fire station there is a monitor in the truck bay that displays some real-time status information from a web page.  Since it's  a volunteer fire department, most of the time there is no one there to view the information.  However, when an emergency call is received, it's important that the information be visible without the need for firefighters to waste time turning on a monitor.  Leaving the monitor on all the time leads to LCD burn-in, which is also undesirable.  By having the monitor turn on when motion is detected, the information is immediately visible and the monitor usage and power consumption are reduced.

To achieve the goal of a motion-activated monitor, an inexpensive PIR motion detector, a USB mouse, a 10k resistor, and a 2N3904 transistor were used.  The PIR motion detector is wired into the mouse to get power from the USB port and to trigger the mouse to "click" one if its buttons when motion is detected.  This mouse "click" is sensed by the PC connected to the mouse, which then turns on the screen.

A further refinement would be to use a microcontroller to emulate a USB keyboard to send a keypress of an unused key (such as scroll lock) so that accidental mouse clicks aren't a concern.  However, the "automated" mouse clicks can be easily disabled by flipping a switch and this method is a purely hardware solution, requiring no special software or microcontroller programming.

Update 5-11-13 - I finally got sick of the automated mouse clicks and set up a microcontroller-based system as described above.  Jump to the bottom of the page for details and code.

PIR Motion Sensor

The PIR motion sensor I used was a cheap motion-activated LED light I found on ebay that's similar or identical to this one.  It uses a BISS0001 PIR sensor IC to do the heavy lifting and is powered by four AAA batteries, which provide a 6 volt power supply.  A quick review of the data sheet reveals that pin 2 of this IC is the sensing output, and that it goes "high" when motion is detected.  The duration that the signal stays high and the delay between motion sensing events are controlled by external resistors and capacitors.  The LED light I bought had a switch on it that allowed me to select delays of 90, 60, or 20 seconds.  Since each motion detection event would cause a button press of the mouse, and since the button would stay pressed until the delay was over, I wanted a very short delay.  I measured the resistances connected to the switch in the unit I had, compared them with the time durations on the switch, and used the delay formula in the BISS0001 datasheet to estimate the value of the capacitor, which I found to be .01uF.  From there I used the delay formula to find that a 2 kohm resistor would give me about a 1/2 second delay, which seemed reasonable.  I put this resistor in the switch position for 90 seconds, so my unit now has delays of 60, 20, and .5 seconds.

The "high" output of the BISS0001 pin 2 is used to drive a 2N3904 transistor through a 10kohm resistor.  This transistor is then used as a switch across the terminals of the existing mouse button switch to close the switch and "click" the mouse when pin 2 goes high.

USB Mouse

The USB mouse I used is a cheap Logitech unit I found at a local store, but pretty much any mouse will work.  Some voltage measurements of the wires coming into the mouse helped determine where to get 5 volts to power the PIR sensor, and some additional voltage measurements of the switch contacts confirmed that the switches are in a "switch to ground" configuration.  This means that one terminal of the switch is pulled up to a supply voltage (3.3 volts in this case) through a pull up resistor, and the other terminal is connected to circuit ground.  When the switch is closed (button is clicked) the 3.3V terminal is pulled down to circuit ground, or zero volts.  By placing a 2N3904 transistor across the switch, the output of the PIR motion detector can also be used to pull the switch terminal "low" to simulate a button press.  I wired the transistor to the middle mouse button, but any mouse button would work.  See the circuit diagram below.


To use the motion sensor, the sensor is turned on by using the switch on the back of the unit.  When motion is detected, the mouse thinks that its middle button has been clicked, which causes the computer to wake up the monitor.  To use the mouse as a "normal" mouse without motion detection, simply turn off the motion sensor using its power switch. 

Build Pictures

Top view of mouse modifications:
Bottom view of mouse modifications:

LED Motion Sensing Light Modifications:

Finished Product:

A Microcontroller Version

Hacking a mouse if fun, but having it click whenever it detects motion can get annoying when you're actually trying to use the computer.  To get around this I updated the system and wired the motion detector into a Teensy microcontroller board.  The Teensy can be set up to emulate a USB keyboard really easily, so that's what I did.  I wrote a few lines of code that look for the motion detector signal (on pin B0 of the Teensy 2.0), and then toggle the Scroll Lock key to turn on the monitor.  Simple, cheap, and much less annoying than a modified mouse.  Here is my Teensyduino code for this setup.  The Teensy is even small enough to fit into the unused battery compartment of the motion detector, making for a very clean setup.