Wednesday, June 29, 2022

The use case for a blinking infrared LED

Many years ago at a company where I worked, we had two sets of computer systems:  The ones that we used every day for engineering purposes, and the "corporate" computers that were used for things like "official" email and interfacing with accounting.

Figure 1:
The IR (clear) LED and the red blinking LED.
The red LED was uncovered for this picture.  The IR
LED is positioned to stick up, inside the mouse's lens
assembly when it's placed atop the pad.
Click on the image for a larger version.
One day, the edict came from on-high that the corporate computers would log themselves off the network after a ridiculously short amount of time (it may have been as little as 5 minutes) if no mouse or keyboard activity was used.

This was particularly bothersome to the local accountant person who would have to turn away from the corporate computer for a few minutes at a time to do something else (paperwork, answer a phone, etc.) only to find that it had logged off and out of whatever application was running.  To make matters worse, it took several minutes to log back in as the authentication was painfully slow:  This was way back in the late 1990s/early 2000s, you know!


It should go without saying that absurd and draconian "security" measures like those described above are usually self-defeating:  It adds unnecessary frustration to those using the system, causing "creative" means to be derived to circumvent it which can completely defeat the intent of the measures.  It had already been the practice of the person using this computer to log off when stepping out of the office (and locking the door!) but we heard of other "interesting" ways that others came up with to circumvent this within the company. 
Fortunately, it was only a few months later that the computer security folks came up with a much more sensible plan and the device described here was no longer "needed".
After several weeks of being frustrated by this - and being denied the request to lengthen the auto-logoff to something more reasonable like 10-30 minutes, I was asked if there was something that I could do.  The first thing that I thought of was some motorized do-hickey that would move the mouse just a little bit to make it "look" like the computer was in use - but something else occurred to me:  Interfere with the optical mouse in some way externally.  This method had the advantage that no device was plugged into the computer (e.g. an external "mouse jiggler" USB device) - an advantage in that there is no possibility of such a device, itself, causing a security risk.

Modern optical mouses (mice?) literally take a picture of the desktop - many times a second - and divine the movement by tracking very small features under them.  Fortunately most surfaces have small-scale features that make this possible - but if you were ever wondering why an optical mouse doesn't work well on a piece of clean glass - now you know!

Figure 2:
The optical mouse atop the IR LED.  The IR LED fits
up inside the lens cavity.  The entire circuit was inserted
and built into a piece of scrap mouse pad.
Click on the image for a larger version.
So, how would one make the think the mouse is moving - without actually moving it?  It occurred to me that a flashing, red LED would accomplish this by, perhaps, "blinding" the sensor - at least partially.  A quick test by sticking the blinking LED up into the lens assembly showed that as it blinked, the cursor would move one "Mickey" (the unit of mouse movement - look it up!) up and to the right on this particular mouse, satisfying the computer that the mouse was actually being moved.  It didn't seem to matter that the mouse cursor would inevitably end up in the top-right corner of the screen - it seemed to stop the time-out nonetheless.

This worked well - but what if a blinking LED bothers you?  The answer is a blinking infrared LED.

Where does one get a blinking Infrared LED?

Of course, no-one makes such a thing (why would they?) - but the work-around is simple:  Place an ordinary infrared LED in series with a visible blinking one and place the latter LED out of sight.

Infrared LEDs - which may be harvested from defunct/surplus infrared remotes - come in two flavors:  Those that operate at 850 nanometers, and those that operate at 940 nanometers.  The 850 nanometer versions are just visible to the human eye (in a dark room) and work best in this situation as they are well within the response curve of the sensor in the mouse but can't really be seen in normal room lighting:  In fact, some optical mouses (mice?) use Infrared LEDs to be more "stealthy".  I didn't try a 940 nanometer LED, but I know from experience that if something operates on a visible (red) wavelength, it will likely work just fine with an 850 nanometer LED.

The circuit to do this was very simple, and is as follows:

Figure 3:
Diagram of the circuit - pretty simple, actually!
As noted, the voltage can be anywhere between 9 and 15 volts DC - 12 volts nominal.
Click on the image for a larger version.

The power supply used was a random "wall wart":  The one that I'd grabbed was marked 9 volts at 100 milliamps and it put out about 13 volts DC under no load, but any DC voltage between 9 and 15 volts ought to be fine:  5 volts from a USB charger is simply too low!

The way this works is that with the two LEDs in series, the current in the two LEDs MUST be identical (Kirkhoff's law and all of that...) which means that when the blinking LED was on, more current also went through the other LED, making it brighter.  When the blinking LED was off, the other LED doesn't go completely off, but it gets noticeably dimmer - which was enough to make the mouse detect "movement".  The 470 ohm resistor limits the current to a safe value and the 100 uF capacitor provides a bit of bypassing that helps assure that the blinking LED will function properly:  It may work without it - but not all blinking LEDs do.  Because they are in series, it doesn't matter the order in which the LEDs are placed - just that they are in series and connected correctly in terms of polarity.

If you are unsure that the infrared LED is blinking, check it with your cell-phone camera as it will respond adequately to Infrared, particularly up-close, and with 850 nanometer LEDs.

This trick also works with other LEDs:  If you have a cheap, red blinking LED but not one of the color that you might want to blink (say a white or blue LED) this could be substituted for the "IR LED".  Again, the "other" (non-blinking) LED may not extinguish completely during the "off"portion and if this bothers you, a resistor could be placed across it to "bridge" some of the current around it (e.g. the non-blinking LED) and drop the voltage below its illumination threshold:  The value would have to be experimentally determined.

There you go:  A use-case for a blinking infrared LED!

* * *

This page stolen from