This project offers a straightforward solution for securely logging into a system or website using a hardware key. By pressing a physical button connected to an ATtiny85 microcontroller, users can automate the login process, thereby reducing the risk of password exposure.
The aim of this project is to provide a more secure alternative to manually typing long or complex passwords, particularly in environments where there may be observers or surveillance. With the hardware key, users can log in quickly and securely without the risk of their password being intercepted or observed.
- Enhanced Security: Prevents password interception by keystroke loggers or shoulder surfing.
- Convenience: Simplifies the login process, especially for systems with lengthy or complex passwords.
- Privacy: Maintains the confidentiality of passwords in public or shared environments.
- Portability: Easily carried and used on multiple systems or devices.
The hardware key utilizes an ATtiny85 microcontroller with the V-USB library to implement USB Human Interface Device (HID) keyboard functionality. This allows the ATtiny85 to act as a keyboard when connected to a computer via USB. When the button connected to the ATtiny85 is pressed, it sends predefined keystrokes to the computer, automating the login process.
C_implementation
- single_file_project
- multi_file_project
CPP_implementation
- single_file_project
- multi_file_project
3d_printed_case
- hardware_key_case.stl
PCB_Designs
- Through-Hole_DIP
- SMD
- SMD_SOIC
- SMD_QFN
You can modify the permissions of /dev/ttyACM0
to facilitate communication with your serial device. For detailed instructions, click here.
To compile the C implementation, follow these steps:
- Open a terminal.
- Navigate to the
C_implementation
folder. - Read the instructions or refer to using make for the C implementation.
To compile the C++ implementation, follow these steps:
- Open a terminal.
- Navigate to the
CPP_implementation
folder. - Read the instructions for the C++ implementation.
- Connect the hardware key to the computer.
- Press the button on the hardware key.
- The hardware key sends the predefined keystrokes for logging in.
- The user is logged in securely without typing the password manually.
The hardware key is available in multiple PCB package versions to accommodate different assembly preferences:
- Through-Hole (DIP): Easy to assemble manually, suitable for prototyping.
- SMD (SOIC): For more compact and automated assembly.
- SMD (QFN): For advanced designs requiring a small footprint.
-
QFN PCB designed for a touch pad without using the TTP223 IC. (Uses a basic capacitive touch sensing method by measuring changes in capacitance with the microcontroller’s ADC.)
-
QFN PCB designed for a touch pad using the TTP223 IC for enhanced reliability.
- Uses a simple high/low output for touch detection, similar to a tactile switch, providing a straightforward 0 or 1 output.
- The PCB is designed with 4 layers to optimize signal integrity and reliability.
You can view the design files and images for each PCB version in the PCB_Designs
folder.
Reference | Value | Datasheet | Footprint | Qty | DNP |
---|---|---|---|---|---|
C1, C2 | 22pF | ~ | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mm | 2 | |
C3 | 0.1uF | ~ | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mm | 1 | |
D1 | LED GREEN | ~ | LED_THT:LED_D3.0mm | 1 | |
D2 | LED RED | ~ | LED_THT:LED_D3.0mm | 1 | |
J1 | USB-AM-S-X-X-TH | USB-AM-S-X-X-TH:SAMTEC_USB-AM-S-X-X-TH | 1 | ||
R1, R3 | 10k | ~ | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_Horizontal | 2 | |
R2 | 330 | ~ | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_Horizontal | 1 | |
R4 | 1k5 | ~ | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P5.08mm_Horizontal | 1 | |
S1 | B3F-1000 | ~ | B3F-1000:SW_B3F-1000 | 1 | |
U1 | ATtiny85-20P | Datasheet | Package_DIP:DIP-8_W7.62mm | 1 | |
Y1 | 12MHz | ~ | Crystal:Crystal_HC49-4H_Vertical | 1 |
3D model of the hardware login key’s PCB using the Through-Hole (DIP) package in KiCad
3D model of the hardware login key’s PCB using the Through-Hole (DIP) package in Fusion 360
Reference | Value | Datasheet | Footprint | Qty | DNP |
---|---|---|---|---|---|
C1, C2 | 22pF | ~ | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | 2 | |
D1 | LED RED | ~ | LED_SMD:LED_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
D2 | LED GREEN | ~ | LED_SMD:LED_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
J1 | USB-AM-S-X-X-TH | USB-AM-S-X-X-TH:USB_PCB | 1 | ||
R1, R3 | 10k | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 2 | |
R2 | 330 | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
R4 | 1k5 | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
S2 | PTS525SM15SMTR2LFS | PTS525SM15SMTR2LFS:SW_PTS525SM15SMTR2LFS | 1 | ||
U1 | ATtiny85-20S | Datasheet | Package_SO:SOIC-8W_5.3x5.3mm_P1.27mm | 1 | |
Y1 | 12MHz | ~ | Crystal:Crystal_SMD_0603-2Pin_6.0x3.5mm_HandSoldering | 1 |
3D model of the hardware login key’s PCB using the SMD (SOIC) package in KiCad.
Reference | Value | Datasheet | Footprint | Qty | DNP |
---|---|---|---|---|---|
C1, C2 | 22pF | ~ | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | 2 | |
D1 | LED RED | ~ | LED_SMD:LED_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
D2 | LED GREEN | ~ | LED_SMD:LED_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
J1 | USB-AM-S-X-X-TH | USB-AM-S-X-X-TH:USB_PCB | 1 | ||
R1, R3 | 10k | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 2 | |
R2 | 330 | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
R4 | 1k5 | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
S2 | PTS525SM15SMTR2LFS | PTS525SM15SMTR2LFS:SW_PTS525SM15SMTR2LFS | 1 | ||
U1 | ATtiny85-20M | Datasheet | Package_DFN_QFN:QFN-20-1EP_4x4mm_P0.5mm_EP2.5x2.5mm_ThermalVias | 1 | |
Y1 | 12MHz | ~ | Crystal:Crystal_SMD_0603-2Pin_6.0x3.5mm_HandSoldering | 1 |
3D model of the hardware login key’s PCB using the QFN package in KiCad.
Reference | Value | Datasheet | Footprint | Qty | DNP |
---|---|---|---|---|---|
C1, C2 | 22pF | ~ | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | 2 | |
C3 | 0.1uF | ~ | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | 1 | |
C4 | 10uF | ~ | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | 1 | |
D1 | LED RED | ~ | Library:LED_Kingbright_APA1606_1.6x0.6mm_Horizontal_NEW | 1 | |
D2 | LED GREEN | ~ | Library:LED_Kingbright_APA1606_1.6x0.6mm_Horizontal_NEW | 1 | |
J1 | USB-AM-S-X-X-TH | USB-AM-S-X-X-TH:USB_PCB | 1 | ||
R1, R3 | 10k | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 2 | |
R2 | 330 | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
R4 | 1k5 | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
TP1, TP2 | TestPoint | ~ | TestPoint:TestPoint_Pad_D3.0mm | 2 | |
U1 | ATtiny85-20M | Datasheet | Package_DFN_QFN:QFN-20-1EP_4x4mm_P0.5mm_EP2.5x2.5mm_ThermalVias | 1 | |
Y1 | 12MHz | ~ | Crystal:Crystal_SMD_0603-2Pin_6.0x3.5mm_HandSoldering | 1 |
3D model of the hardware login key’s PCB using the QFN package in KiCad.
Without the TTP223 IC. (Uses basic capacitive touch sensing with the microcontroller’s ADC and custom code for detection.)
Reference | Value | Datasheet | Footprint | Qty | DNP |
---|---|---|---|---|---|
C1,C2 | 22pF | ~ | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | 2 | |
C3 | 0.1uF | ~ | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | 1 | |
C4 | 1uF | ~ | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | 1 | |
C5 | 30pF | ~ | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | 1 | |
D1 | LED RED | ~ | Library:LED_Kingbright_APA1606_1.6x0.6mm_Horizontal_NEW | 1 | |
D2 | LED GREEN | ~ | Library:LED_Kingbright_APA1606_1.6x0.6mm_Horizontal_NEW | 1 | |
J1 | USB-AM-S-X-X-TH | USB-AM-S-X-X-TH:USB_PCB | 1 | ||
R1 | 10k | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
R2 | 330 | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
R4 | 1k5 | ~ | Resistor_SMD:R_0201_0603Metric_Pad0.64x0.40mm_HandSolder | 1 | |
TP1,TP2 | TestPoint | ~ | TestPoint:TestPoint_Pad_D3.0mm | 2 | |
U1 | ATtiny85-20M | Datasheet | Package_DFN_QFN:QFN-20-1EP_4x4mm_P0.5mm_EP2.5x2.5mm_ThermalVias | 1 | |
U2 | TTP223-BA6 | Datasheet | TTP223-BA6:SOT23-6 | 1 | |
Y1 | 12MHz | ~ | Crystal:Crystal_SMD_0603-2Pin_6.0x3.5mm_HandSoldering | 1 |
3D model of the hardware login key’s PCB using the QFN package in KiCad.
With the TTP223 IC. (Uses simple high/low output for touch detection, similar to a tactile switch, with default code for straightforward 0 or 1 output.)
- Ensure the physical security of the hardware key to prevent unauthorized access.
- Keep the key firmware up-to-date to mitigate potential security vulnerabilities.
- Do not use the hardware key on untrusted or compromised systems.
- Use strong encryption and authentication methods in addition to the hardware key for robust security.
A 3D printed case is available for the hardware key. To use it, follow these steps:
- Open the
3d_printed_case
folder. - Load the
hardware_key_case.stl
file into your 3D printer software. - Print the case using your 3D printer.
- Once printed, assemble the hardware key inside the case for added protection and aesthetics.
This project is licensed under the GPLv3 License - see the LICENSE file for details.
Enjoy your secure hardware login key 🔐! Thank you for visiting Hardware-Login-Key! ✨