Project tutorial

How to Make a Customizable Punchable Keyboard Button © GPL3+

Angry at the office? Use this customizable keyboard button that you can punch.

  • 2,750 views
  • 7 comments
  • 8 respects

Components and supplies

A000053 iso both1
Arduino Micro & Genuino Micro
You can use any ATmega32U4 based microcontroller such as Arduino Leonardo , which makes the microcontroller recognisable as a mouse or keyboard.
×1
Piezo Element
Piezo electric disks can be found in the speakers in some musical gift cards.
×1
Mfr 25frf52 1m sml
Resistor 1M ohm
To limit the voltage and current produced by the piezo and to protect the analog input.
×1
11026 02
Jumper wires (generic)
×1

Necessary tools and machines

spongy material
cloth (any colour)
To cover sponges and electronics inside.you can use a needle and thread to make a enclosure for sponges.

Apps and online services

About this project

While you are at work or bored with playing games, don't you often have the impulsion to hit your keyboard?

Hit this punchable customizable key! Let off your unhappiness!

In this project I have made customizable punchable keyboard button made up of piezo element, ATmega32U4 based board, a high value resistor (1 Mega ohm) and some sponges.

To type, users simply hit or kick the key they want.

Hardware Required:

  • Arduino Pro Micro

The Micro is based on the ATmega32U4 microcontroller featuring a built-in USB which makes the Micro recognisable as a mouse or keyboard.

You can use any microcontrolled which is using ATmega32U4 Chip.

  • Piezo electric disc

A piezo is an electronic device that generates a voltage when it's physically deformed by a vibration, sound or mechanical strain.

Piezoelectric disc can be found in the speakers in some musical gift card. If you have one you no need to buy a piezo element from shop, use screw driver and/or knife to pry the speaker case apart.Then remove the metal plate and lift the circuit board(they may be wedged in tight) so you can get at the piezoelectric disc underneath.

  • 1 Mega Ohm resistor

This high value resistor limits the voltage and current produced by the piezo and to protect the analog input.

  • Sponges

When force is applied on sponge it deforms and when force is released it gains it's original shape. The piezo element will be placing in between sponges and when ever some one hit on it, the generated voltage will be sending through analog pin of arduino micro.

Circuit Diagram:

Working:

Piezos are polarized, meaning that voltage passes through them(or out of them) in a specific direction. Connect the black wire (the lower voltage)to ground and the red wire (the higher voltage) to analog pin 0. additionally, connect a 1 mega ohm resistor in parallel to the piezo element to limit the voltage and current produced by the piezo and to protect the analog input.

If the piezo's(act as knock sensor) output is stronger than a certain threshold, your board will perform keyboard operation based on program.

Make an Enclosure to Cover Sponges:

Get a cloth and make a enclosure for sponges using needle and thread. I told to my mom to prepare one and she made a enclosure to cover the circuit and sponges.

Insert Piezo Element into the Sponge:

Code:

#include <Keyboard.h>
const int knockSensor = A0; // the piezo is connected to analog pin 0
const int threshold = 100;  // threshold value 
// these variables will change:
int sensorReading = 0;      // variable to store the value read from the sensor pin
void setup() 
{
  Keyboard.begin();
}
void loop() 
{
 // read the sensor and store it in the variable sensorReading:
sensorReading = analogRead(knockSensor);
 // if the sensor reading is greater than the threshold:
if (sensorReading >= threshold) 
{
// to customize key function change ASCII values below  , refer  https://www.arduino.cc/en/Reference/ASCIIchart
   Keyboard.write(32);      //ASCII value of Space bar is 32 ,
   delay(150);
   Keyboard.releaseAll();
 }
}
  • Connect as per the circuit and upload the code
  • Simply hook it into your computer's USB port and this can perform different keyboard functions based on program.

Don't forget to modify the the code if you want to perform a different keyboard action.

Change onlythefollowing line of code for modification

Keyboard.write("ASCII Value");

Why is this cool? Think about the possibilities for use:

  • Gaming Shortcuts or Controls
  • Open a commonly used application
  • Go to a commonly used website
  • Windows shortcuts like save a document or shrink all windows
  • Enter your email address or commonly string
  • Enter your complex password
  • Panic button at work

Thank you so much for reading if you need any more information feel free to ask in comments, and I'll do my best answer you.

Happy making!

Code

customizable_punchable_keyboard_button.inoArduino
#include <Keyboard.h>

const int knockSensor = A0; // the piezo is connected to analog pin 0
const int threshold = 100;  // threshold value 


// these variables will change:
int sensorReading = 0;      // variable to store the value read from the sensor pin


void setup() 
{
  
   Keyboard.begin();
}

void loop() 
{
  // read the sensor and store it in the variable sensorReading:
  

sensorReading = analogRead(knockSensor);

  // if the sensor reading is greater than the threshold:
 
 if (sensorReading >= threshold) 
{
   
// to customize key function change ASCII values below  , refer  https://www.arduino.cc/en/Reference/ASCIIchart

    Keyboard.write(32);      //ASCII value of Space bar is 32 ,
    delay(150);
    Keyboard.releaseAll();
    
  }

}

Schematics

Fritzing file
circuit_diagram_dCHo19d2OK.fzz

Comments

Similar projects you might like

A Pocket-Sized Touch Keyboard

Project tutorial by Amal Mathew

  • 3,587 views
  • 3 comments
  • 15 respects

Wireless Keyboard from TV Remote

Project tutorial by Amal Mathew

  • 2,860 views
  • 2 comments
  • 14 respects

Arduino - Use Reset Button Like a Push Button

by RoHa

  • 1,899 views
  • 0 comments
  • 12 respects

Keyboard Melodies

Project tutorial by Ava Baker -21 and Natalie Clark -20

  • 1,843 views
  • 2 comments
  • 8 respects

Electronic Piano Keyboard With Preset Songs

Project tutorial by Lindsay Fox

  • 77,979 views
  • 60 comments
  • 150 respects

Ternary Chord Keyboard

Project tutorial by Mr_Glenn

  • 3,346 views
  • 4 comments
  • 9 respects
Add projectSign up / Login