Based on the Kemet SS-430L Pyroelectric Sensor
The Computer Presence Detector addresses security breaches and greenhouse emissions with a non-intrusive device that sits discretely behind the computer's keyboard.
Walking away from your computer while it is unlocked is a major security breach in many organisations that work with confidential information and the simple keystroke Windows Logo + L on a PC or Command + Control + Q on a Mac is all you have to do before walking away. Despite being so easy, it is often forgotten leaving the computer accessible to anyone waiting for an opportunity to perform an action they are either not authorized to do or do not want to be traced under their login. A secondary aspect of leaving computers unattended is the power wasted from the connected devices such as monitors, printers, and speakers being left on for hours or days, resulting in a significant impact on greenhouse emissions and electricity costs.
Operating with no human interaction, the Computer Presence Detector (CPD) is connected in-line with the keyboard and mouse to constantly monitor for the presence of a person sitting within 1.5 metres of the keyboard. Should no presence be detected, a light will blink for 10 seconds indicating the computer is about to be locked if no movement is detected. Due to the device’s selective sensitivity to the human infrared fingerprint, it will detect even the slightest of movement such as typing or handwriting within the 1.5 metre range. Both the range and non-detection time can be adjusted to suit the individual application. After the non-detection time has elapsed, a command will be sent to the computer to lock the screens, requiring the user’s password to regain access. When the user is away from the computer for longer periods, at a programmable time the CPD will send a trigger to an externally controlled power board, turning off all peripheral devices reducing power consumption, while leaving the computer on in a locked state so as not to lose any of the operators work.
The CPD has been designed to sit neatly behind the keyboard and includes a front USB port for easy connection of a memory stick or other low power USB device. Mouse and keyboard cables can be neatly wrapped in the integrated cable management to reduce desktop clutter.
InstallationAt the rear of the device are 2X USB-A ports for the connection of the keyboard and mouse. Prior to connecting the plugs, wrap the excess cable under the CPD using the cable management slots as shown in Figure 2.
Connect the micro USB port to the PC and if the front port is to be as used as a phone charger, the optional 5-volt dc power supply.
If the peripheral power control is implemented, a 3.5mm stereo phono jack is provided as a universal output to activate your controlled power board. The connection gives a normally open and normally closed switch contact that can be connected to a smart home transmitter or other low voltage control input.
The range of coverage can be adjusted by screwing out the sensor lens and inserting the desired range lens.
When your computer is on, the CPD will constantly scan to see if a person is detected within the chosen range. If a person is not detected, the front LED will flash to indicate that the computer is about to lock if no movement is detected.
After the non-detection time has elapsed, the CPD will send a lock command to the computer, preventing anyone fromusing it without first entering the user password.
HardwareThe electronics in the CPD comprises four major sections.
- Kemet proximity sensor
- Microprocessor control
- USB 4 port hub
- Power
The Kemet proximity sensor is a stand-alone module (SS-430L) that has a very high sensitivity to the infrared (IR) wavelength emitted by the human body and rejects other sources of infrared. In addition to its selective sensitivity, it is also able to detect through different opaque materials, making it suitable for applications where you do not want the sensor to be visible, and it is not affected by other sources of IR such as sunlight.
Initial experimenting with the sensor was performed using an analogue multimeter to show the pulses when movement was detected and pieces of 0.1mm thick clear plastic were progressively added until the desired range was achieved. I experimented with several plastics, including the PLA the case was printed with and found the window from a coffee pod box as shown in Figure 3 gave the best results. A suitable range of 1 metre was achieved with 5 sheets layered together. In a finished product, an interchangeable insert would be made to allow easy range adjustments.
Additional testing was performed to determine if the amplified signal from the sensor would be suitable for connection to an ADC, which would allow the range to be based on the amplitude of the signal. Probing around the circuit, it was found that the analogue signal from the sensor was inputted to a microcontroller, which then outputted the digital signal. Figure 4 shows the pin probed, and while this could be connected to an ACD it was not implemented in this project.
The digital output of the Kemet SS-430 is connected to a digital input of the PIC18F14K50 microprocessor which does all timing and control based on when a detection pulse is not received in a given time. This processor was chosen as it supports native USB, has a low pin count and has multiple timers.
LED output on RC4 drives a WS2812 programmable LED for the status indication as shown in Figure 7 and the relay output is driven from RC5 as shown in Figure 6.
Because switching main powered devices can require special safety approvals, a dry relay contact was used which can be connected to a wireless power controller such as the Sonoff or a hard-wired relay of suitable rating.
The USB output on pins 18 and 19 sends and received HID commands, allowing the emulation of keyboard strokes to send lock commands to the computer and sense when the keyboard has been pressed to unlock. These pins are routed as a differential pair to the USB hub.
USB 5 Port HubThe connectivity of the CPD to the outside world is via a USB interface in the form of a 4 port hub plus 1 uplink on a single chip. The ports are configured as being 2 for keyboard and mouse on the rear, 1 for USB key or low power phone charger on the front and one internally connected to the microprocessor to emulate keyboard presses. Then the uplink connects all 4 ports back to the computer. The PCB layout for this component was the most challenging aspect of the design as the USB2514 IC only comes in one footprint with a terminal pitch of 0.5mm BSC and if you follow the USB 2.0 specification, has very particular requirements for the routing of the USB differential pairs. Each pair needs to remain the same length and parallel the entire route. Additionally, they need to have a nominal 90Ω impedance, which equates to a track width of 27mil and 5mil spacing between the differential pair. The clearance to other tracks needs to be 25mil and a continuous ground plane under the differential pair. Trying to work as closely as possible with these design rules, and placing 9 decoupling capacitors, crystals and resistors as close as possible required the use of 0402 footprint (1005) capacitors and resistors. To put the size in perspective, a typical retractable lead pencil is 0.5mm diameter, which is the same width as each component. Break off a few 1mm lengths and place them perfectly with 0.5mm spacing and that is what 1005 is like to work with.
In addition to managing all of the USB communication, the USB2514 can control thepower delivery to each port. I have used the MIC2005A current limiting IC to sense if the current exceeds 500mA (U5, 6 & 7 in Figure 9). The EN pin of the MIC2005Ais controlled by the active high output of the USB2514, enabling 5volts on the OUT. If the current exceeds 500mA, the active-low FLT pin triggers the OSCx input on the USB2514, which pulls PRTPWRx low disabling the power output on that port until the USB fault is corrected.
Full schematics and PCB files can be found at https://circuitmaker.com/Projects/Details/Tim-Norton/Computer-Presence-Detector.
Enclosure
The enclosure has been designed to sit directly behind the computer keyboard with the sensor facing the operator as shown in Figure 10. Because the sensor has a very wide angle of coverage and high sensitivity to human IR energy, exact placement is not critical.
To reduce desk clutter, the CPD has space beneath it to allow excess USB cables from the keyboard and mouse to be concealed by wrapping them around the base, leaving only the length required visible as shown in Figure 11. Facing the operator is a status indicator, spare USB port for a memory stick or other low power device and the sensor window.
PCB
The PCB is a two-layer board, with all components on the top layer and mostly ground plane on the bottom. Passive components including capacitors, resistors, and inductors are all sourced from Kemet, with 1005 (0402) footprint being used around the USB hub IC U4 and the rest of the board is 2012 (0805) footprint. Most of the semiconductors are from Microchip and have been arranged into areas of power, control, and USB as shown in Figure 12.
The mounting of both the control and the Kemet SS-430L sensor can be seen in Figure 13.
The software is written in C for the PIC18F14K50 microcontroller and runs in two main loops as shown in Figure 16.
The main code is driven by interrupts for the detection of the sensor pulses, the timer which ticks at 1 second intervals and the USB send/receive.
Loop 1 constantly checks for movement via the interrupt and increments the time count in the variable countSeconds on each tick.
If movement is detected, the time count is reset to 0. If no movement is detected for the time period as defined in PRE_WARN_TIME, the LED will flash to warn of a pending screen lock and the time count is set to 0. If no motion is detected before the time as defined in NO_MOTION_TIME a lock screen keyboard combination is sent via the USB to the computer and flow will be handed to loop 2.
Loop 2 again sets variable countSeconds to 0 ready to count up to POWER_DOWN_TIME. When this has elapsed, the relay to drive the external power control device is turned on. constantly checks for a keypress. Timer 2 will start to time for the peripheral period and if no key has been pressed, and timer 2 has elapsed, the peripherals will be powered off. The loop will continue to wait for a keypress and then the peripherals are powered on and control is returned to loop1.
The full code can be found at https://github.com/nortont/Computer-Presence-Detector
Comments