# Neo Trinkey Auto Screen Locker

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/107/855/medium800/hacks_banner.jpg?1642448597)

Are you concerned about protecting your laptop from being physically snagged right out of your hands? Like so fast you can't even engage a screen lock? If so, then a USB "kill cord" is an option that provides a way to have some action, like locking the screen, occur when a USB device is removed.

A USB "kill cord" is just any USB device that can be plugged into your laptop and then physically attached to your person. Then, if your laptop gets snagged, the device will get yanked out, which then automatically activates some security mechanism.

In this guide we show how to use an [Adafruit Neo Trinkey](https://www.adafruit.com/product/4870) to create a USB kill cord. This is then used with the open source [BusKill App Project](https://docs.buskill.in/buskill-app/en/stable/) to provide a way to automatically lock your screen when the Neo Trinkey gets removed.

## Hardware

The Neo Trinkey is really the only item needed for this guide. The Circuit Playground Lanyard is shown as it makes for a nice, well, lanyard. It's also full of cute, which is a bonus :)

### Adafruit Neo Trinkey - SAMD21 USB Key with 4 NeoPixels

[Adafruit Neo Trinkey - SAMD21 USB Key with 4 NeoPixels](https://www.adafruit.com/product/4870)
It's half USB Key, half Adafruit Trinket_..._it's **Neo Trinkey** , the circuit board with a Trinket M0 heart and&nbsp; four RGB NeoPixels for customizable glow. We were inspired by some USB key flashlight boards that would turn any battery pack into an LED torch. So...

In Stock
[Buy Now](https://www.adafruit.com/product/4870)
[Related Guides to the Product](https://learn.adafruit.com/products/4870/guides)
![Close-up of NeoTrinkey PCB inserted into a laptop. The LEDs emit rainbow colors.](https://cdn-shop.adafruit.com/640x480/4870-03.jpg)

### Adafruit Circuit Playground Lanyard

[Adafruit Circuit Playground Lanyard](https://www.adafruit.com/product/3987)
We've got our Circuit Playground friends on&nbsp;[lunchboxes](https://www.adafruit.com/product/3437),&nbsp;[posters](https://www.adafruit.com/?q=posters),&nbsp;[puzzle](https://www.adafruit.com/product/3817),&nbsp;<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/3987)
[Related Guides to the Product](https://learn.adafruit.com/products/3987/guides)
![Pink lanyard with Adafruit characters and metal hooks at ends](https://cdn-shop.adafruit.com/640x480/3987-00.jpg)

# Neo Trinkey Auto Screen Locker

## Assemble Kill Cord

![](https://cdn-learn.adafruit.com/assets/assets/000/107/873/medium800/hacks_banner.jpg?1642528329)

The Neo Trinkey works well as a base for a USB Kill Cord. It is small and unobtrusive. It can easily run the minimal code needed (which might also be none). It readily pops out of the USB port when pulled. And it has a convenient cut out for attaching a lanyard.

Assembling the Kill Cord is really just a matter of attaching a length of cord to the Neo Trinkey on one end and then on the other to the user (belt loop for example).

The clasp on the [Adafruit Lanyard](https://www.adafruit.com/product/3987) is a little too big to fit directly through the Neo Trinkey cut out. But a small key ring can be used to bridge the two together.

![hacks_lanyard.jpg](https://cdn-learn.adafruit.com/assets/assets/000/107/869/medium640/hacks_lanyard.jpg?1642457914)

If you want to get really fancy, there is even a 3D printable case. For that, see this [Neo Trinkey Case Guide](https://learn.adafruit.com/neo-trinkey-case).

![hacks_hero-trinkey_case.jpg](https://cdn-learn.adafruit.com/assets/assets/000/107/871/medium640/hacks_hero-trinkey_case.jpg?1642526042)

Any similar idea should work as well. For example, a loop of string could be girth hitched to the Neo Trinkey cut out, etc.

## Neo Trinkey Software

There generally isn't anything special needed in terms of software on the Neo Trinkey. The basic triggering mechanism is the removal of _ **any** _ USB device. But just so we have something known to work with, here is a simple Arduino sketch that runs a rainbow color swirl on the Neo Trinkey's NeoPixels.

Here is a pre-compiled UF2 version of the sketch. This UF2 can be downloaded and dragged to the **TRINKEYBOOT** folder after double pressing the reset button without needing to install the Arduino IDE:

[NEOTRINKEY_RAINBOW_SWIRL.UF2](https://cdn-learn.adafruit.com/assets/assets/000/107/872/original/NEOTRINKEY_RAINBOW_SWIRL.UF2?1642526473)
Here is the code listing for the sketch if you want to recompile or make any changes using the Arduino IDE:

```cpp
#include &lt;Adafruit_NeoPixel.h&gt;

Adafruit_NeoPixel strip(NUM_NEOPIXEL, PIN_NEOPIXEL);

void setup() {
  strip.begin();
  strip.show();
  strip.setBrightness(50);
}

void loop() {
  rainbow(10);
}

void rainbow(int wait) {
  for(long firstPixelHue = 0; firstPixelHue &lt; 5*65536; firstPixelHue += 256) {
    for(int i=0; i&lt;strip.numPixels(); i++) {
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show();
    delay(wait);
  }
}
```

# Neo Trinkey Auto Screen Locker

## The BusKill App

![](https://cdn-learn.adafruit.com/assets/assets/000/107/879/medium800/hacks_use_banner.jpg?1642530230)

The **BusKill App** is super easy to use. It works on Windows, Mac, and Linux. It will automatically turn on screen lock when **any** USB device is removed. The trade off here is simplicity. There is only one action taken (screenlock) and it can not be customized for specific USB devices (triggers on any). But if those limitations seem OK, then the **BusKill App** is easy to get going.

Here is the main page for the project:

[BusKill Main Page](https://www.buskill.in/)
The code is open source and the GitHub repo is here:

[BusKill App GitHub Repo](https://github.com/BusKill/buskill-app)
## Installation

Installation and usage of the BusKill App software is covered here:

[BusKill App Software User Guide](https://docs.buskill.in/buskill-app/en/stable/software_usr/)
Follow those instruction to install the BusKill App on to your system.

## Usage

Once the BusKill App software is installed, usage is very simple.

Launch the **BusKill App** to bring up the little app window with the arm/disarm button.

![hacks_use1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/107/875/medium640/hacks_use1.jpg?1642529408)

Plug in the **Neo Trinkey** to a USB port.

![hacks_use2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/107/876/medium640/hacks_use2.jpg?1642529454)

Click the **ARM button** to enable the screen lock. The button will turn **RED**.

![hacks_use3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/107/877/medium640/hacks_use3.jpg?1642529502)

Now when the Neo Trinkey is **removed** from the USB port, the screen lock should be activated.

![hacks_use4.jpg](https://cdn-learn.adafruit.com/assets/assets/000/107/878/medium640/hacks_use4.jpg?1642529578)

Note that the screen lock is nothing special - it is just whatever OS specific screen lock you have in place. So it's up to you to configure the screen lock to have password protection, etc.


## Featured Products

### Adafruit Neo Trinkey - SAMD21 USB Key with 4 NeoPixels

[Adafruit Neo Trinkey - SAMD21 USB Key with 4 NeoPixels](https://www.adafruit.com/product/4870)
It's half USB Key, half Adafruit Trinket_..._it's **Neo Trinkey** , the circuit board with a Trinket M0 heart and&nbsp; four RGB NeoPixels for customizable glow. We were inspired by some USB key flashlight boards that would turn any battery pack into an LED torch. So...

In Stock
[Buy Now](https://www.adafruit.com/product/4870)
[Related Guides to the Product](https://learn.adafruit.com/products/4870/guides)

## Related Guides

- [Adafruit Neo Trinkey](https://learn.adafruit.com/adafruit-neo-trinkey.md)
- [Neo Trinkey Zoom Shortcuts](https://learn.adafruit.com/neo-trinkey-zoom-shortcuts.md)
- [Neo Trinkey Case](https://learn.adafruit.com/neo-trinkey-case.md)
- [Neo Trinkey CircuitPython Rubber Ducky](https://learn.adafruit.com/neo-trinkey-circuitpython-rubber-ducky.md)
- [Computer Perfection Synthesizer](https://learn.adafruit.com/computer-perfection-synthesizer.md)
- [Adafruit BNO055 + BMP280 BFF](https://learn.adafruit.com/adafruit-bno055-bmp280-bff.md)
- [Ambient Video Lighting with HyperHDR](https://learn.adafruit.com/ambient-video-lighting-with-hyperhdr.md)
- [SerenityOS - The dream of the '90s is alive!](https://learn.adafruit.com/serenityos-build-and-run-keep-the-90s-dream-alive.md)
- [Adafruit I2C to 8 Channel Solenoid Driver](https://learn.adafruit.com/adafruit-i2c-to-8-channel-solenoid-driver.md)
- [Hacking the Kinect](https://learn.adafruit.com/hacking-the-kinect.md)
- [BlueLive: Livestream Studio switcher controller](https://learn.adafruit.com/bluelive.md)
- [NeoPIO: Drive lots of LEDs with Raspberry Pi Pico](https://learn.adafruit.com/neopio-drive-lots-of-leds-with-raspberry-pi-pico.md)
- [Floppy Drive Case for 5.25 and 3.5 drives](https://learn.adafruit.com/floppy-case.md)
- [USB MIDI Host2Host](https://learn.adafruit.com/usb-midi-host2host.md)
- [Getting Started with Braille Output for CircuitPython REPL](https://learn.adafruit.com/getting-started-braille-output-circuitpython-repl.md)
