Bottle Cap Keyboard
![cover.jpg](/proxy/?url=https://content.instructables.com/FA9/YSG6/JUCY93ZS/FA9YSG6JUCY93ZS.jpg&filename=cover.jpg)
![IMG_20190410_165632.jpg](/proxy/?url=https://content.instructables.com/FLT/UYPQ/JUCY93SG/FLTUYPQJUCY93SG.jpg&filename=IMG_20190410_165632.jpg)
This is a pretty simple and fun project with Arduino Pro Micro.
You will create a simple version of the president's key(board).
It will do an action in your computer (Mac or Pc) by emulating keyboard shortcuts or commands.
In my case, I use it with CMD+Q (quit application in mac) shortcut key for easy off from working.
You Will Need...
![002.jpg](/proxy/?url=https://content.instructables.com/FQD/TFM3/JUCY93ZT/FQDTFM3JUCY93ZT.jpg&filename=002.jpg)
- Arduino Pro Micro (not pro mini)
- 1 Mechanical switch. (Clicky Blue Switch recommended)
- Printed parts. (Model files is included in attached zip file)
- TOP, BOTTOM, KEYCAP
- 1 Pin-head cable. (female)
- USB cable micro 5 pin. (Commonly used)
Downloads
Assembly
![IMG_20190411_151526.jpg](/proxy/?url=https://content.instructables.com/FF2/GIE0/JUCY9422/FF2GIE0JUCY9422.jpg&filename=IMG_20190411_151526.jpg)
![pinhead_slot.jpg](/proxy/?url=https://content.instructables.com/FFV/TT1G/JUCY96FU/FFVTT1GJUCY96FU.jpg&filename=pinhead_slot.jpg)
![IMG_20190411_152635.jpg](/proxy/?url=https://content.instructables.com/FNW/PA5R/JUCY942G/FNWPA5RJUCY942G.jpg&filename=IMG_20190411_152635.jpg)
![IMG_20190411_153310.jpg](/proxy/?url=https://content.instructables.com/F0G/D63T/JUCY93UA/F0GD63TJUCY93UA.jpg&filename=IMG_20190411_153310.jpg)
![IMG_20190411_153723.jpg](/proxy/?url=https://content.instructables.com/F6U/8KSW/JUCY93W4/F6U8KSWJUCY93W4.jpg&filename=IMG_20190411_153723.jpg)
I recommend to watch the instruction video (ENG SUB). (wiring is bit tricky)
- Soldering the Pins on Reverse. (Header Pins on topside)
- Place an Arduino Pro Micro on bottom case. (There are slots for pin headers)
- Cut a header pin cable in half and solder directly to the switch.
- Close the top case on the bottom case.
- Connect header pins from outside. ( 8(A8) and GND port)
- Insert the switch.
- Insert a bottle key cap part.
- Done
Arduino Sketch
![sc.png](/proxy/?url=https://content.instructables.com/F2H/OBYI/JUCY977D/F2HOBYIJUCY977D.png&filename=sc.png)
Header pin is connected to port 8(A8) = switch_pin is 8.
We use internal pull-up resistor 'cause the switch directly connected.
I used CMD+q (mac) for using the key as exit application short cut. (Use KEY_LEFT_ALT + KEY_F4 for PC)
Change Keyboard.press( ?? ) part to program your own shotcuts.
#include <HID.h> #include <Keyboard.h> // connected PIN8 const int switch_pin = 8; int button_state = 0; int previous_button_state = HIGH; long last_debounce_time = 0; const long debounce_delay = 50; void setup() { // We use internal pullup registor 'cause the switch directly connected. pinMode(switch_pin,INPUT_PULLUP); digitalWrite(switch_pin, HIGH); Keyboard.begin(); } void loop() { button_state = digitalRead(switch_pin); if ((button_state != previous_button_state) && (button_state == HIGH)) { if ((millis() - last_debounce_time) > debounce_delay) { // Exit Program (CMD+Q in mac) & Have a nice day! // Use KEY_LEFT_ALT + KEY_F4 for PC Keyboard.press(KEY_LEFT_GUI); Keyboard.press('q'); delay(100); Keyboard.releaseAll(); // This is important after every Keyboard.press it will continue to be pressed last_debounce_time = millis(); } } previous_button_state = button_state; }
Done
![IMG_20190411_154023.jpg](/proxy/?url=https://content.instructables.com/FFD/3185/JUCY942H/FFD3185JUCY942H.jpg&filename=IMG_20190411_154023.jpg)
![IMG_20190411_154032.jpg](/proxy/?url=https://content.instructables.com/F6F/BI17/JUCY942N/F6FBI17JUCY942N.jpg&filename=IMG_20190411_154032.jpg)
![보틀캡 키보드 만들기 / 기계식 키보드](/proxy/?url=https://content.instructables.com/FM4/Q2HW/JUCY93PM/FM4Q2HWJUCY93PM.jpg&filename=보틀캡 키보드 만들기 / 기계식 키보드)
Most soft drink PET bottle lids conform PCO-1881 standard and usable for this project.
I hope you'll have fun.