Bottle Cap Keyboard

by fmtuve in Circuits > Gadgets

2670 Views, 15 Favorites, 0 Comments

Bottle Cap Keyboard

cover.jpg
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
  • 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)

Assembly

IMG_20190411_151526.jpg
pinhead_slot.jpg
IMG_20190411_152635.jpg
IMG_20190411_153310.jpg
IMG_20190411_153723.jpg

I recommend to watch the instruction video (ENG SUB). (wiring is bit tricky)

  1. Soldering the Pins on Reverse. (Header Pins on topside)
  2. Place an Arduino Pro Micro on bottom case. (There are slots for pin headers)
  3. Cut a header pin cable in half and solder directly to the switch.
  4. Close the top case on the bottom case.
  5. Connect header pins from outside. ( 8(A8) and GND port)
  6. Insert the switch.
  7. Insert a bottle key cap part.
  8. Done

Arduino Sketch

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
IMG_20190411_154032.jpg
보틀캡 키보드 만들기 / 기계식 키보드

Most soft drink PET bottle lids conform PCO-1881 standard and usable for this project.

I hope you'll have fun.