Introduction: Mini Emoticon Keyboard
Do you use emoticons?
Do you ever wish you could have a button to quickly and easily type an emoticon?
Well, look no further because I'll show you how to make a mini emoticon keyboard with a keyboard switch tester, an adafruit trinket board, and a 3d printed case.
Step 1: What Is It Exactly?
This is a mini keyboard based off the adafruit trinket that lets you easily type silly faces. The trinket can also be modified to type other words, phrases, or symbols; move the mouse; or act as a MIDI input.
However, for this project I only wanted to make a little keyboard to help me quickly type these faces, and that's what I'll show you how to make.
Step 2: Switch Tester
This project was born because I had an extra switch tester laying around. What is a switch tester you say? Well, a switch tester helps you test switches (well, duh...). More specifically, it helps you choose what switch type to use in your keyboard. You can buy mechanical keyboards which use high quality switches for a better typing experience, and I purchased this switch tester to decide which switch to get before shelling out the big bucks on a fancy new keyboard.
So now I had this device with six switches laying around. So I decided to make something cool with it! And I also wanted to quickly type emoticons and some of the switches in the tester are super cool (very clicky).
If you have a spare switch tester laying around somewhere, I recommend doing this project! If you don't, you could still use an ordinary push button switch, order cherry mx switches, or find some other way of triggering the trinket.
Step 3: Cutting the Frame
For this project, I only wanted two buttons so I needed to cut off the rest. I first removed the switches from the metal frame, then marked where the cut would be. I then got my friend to cut it at that location, because why not make your friends do your work for you, right?
Step 4: Clean Up the Edges
The dremel cutting wheel was used to smooth the edges.
Sharpie was then used to color match the now shiny silver ends with the black anodization on the rest of the frame.
Step 5: Electronics!
For this project I will be using an Adafruit Trinket, a cool little board I only just learned about. (link: https://www.adafruit.com/products/1501)
It's a very affordable ($6.95 at the time of this posting) board, similar the official Arduino boards, that allows you to easily program a microcontroller (in this case the ATTiny85) with the Arduino IDE. You only need a mini-USB* cable, which most people have lying around anyway. Because of the low size and small cost of this board, it's great for embedding in projects for very rapid prototyping (it was perfect for this project!)
It has 5 I/O pins, and three available if you're communicating over USB. It also has 8k of RAM, analog inputs and outputs, and USB bootloader. We'll be using the bootloader to load code onto the device.
*These now ship with a micro-USB connector; I had one that had been purchased earlier so it was mini-USB.
Step 6: Electrical Assembly
Now it's time to solder!
Each switch has two metal pins that stick out, and these become electrically connected to each other when the switch is depressed. In order for the Trinket to understand that this happens, it needs to change the state of the pin. So one pin of each switch is connected to ground, and the other connected to an input pin on the Trinket. In our program, we tell the trinket to normally keep that pin high, so that if the switch is pressed it brings it low and it can sense it, triggering it to send data to our computer.
How it works:
switch pressed -> switch pins connected -> Trinket pin brought to ground -> Trinket sends signals to computer
What you need to solder:
- One black wire that connects one pin of switch 1 to one pin of switch 2 to GND on the Trinket.
- Each of the remaining pins on the switches go to pins 0 and 2 on the Trinket.
And that's it! No more connections to make (besides plugging in the USB cable). It's as simple as that!
Step 7: Designing the Case
I decided to make a nice case for it, because why not! First, I covered the Trinket board in some spare heatshrink I had lying around to electrically insulate it from the ground and switch wires (you could also wrap it in electrical tape).
Next, I measured the metal frame with some calipers and modeled it in a 3D CAD program, in this case Solidworks (though you could use any other suitable program for this project). I created my case so that it would slide in from the top, and added a hole for the USB connector and sent it to my friend's 3D printer (thanks Ashley!).
Step 8: Print It!
Use your 3d printer, find a friend has one, or find a nearby makerspace to 3d print the case.
Step 9: Programming the Trinket
Programming the Trinket is fairly simple, though it could be confusing if you're new to Arduino and/or have limited experience with computers.
Adafruit has written a very nice tutorial here: https://learn.adafruit.com/introducing-trinket/
But I'll also go over some of the important steps below.
1. Read the adafruit tutorial (it's well made and thorough)
2. Install the trinket HID library from this link: https://github.com/adafruit/Adafruit-Trinket-USB
(this lets you use your trinket as a mouse, keyboard, or midi device. You could make almost anything out of this board, very easily and cheaply!)
You'll need to drag the folder TrinketKeyboard into your libraries folder, which is most likely "Documents/Arduino/Libraries" (Mac) or "My Documents\Arduino\Libraries" (Windows). Quit the Arduino program and open it again.
You should also be able to add a library from a .zip file by going to
Sketch->Include Library->Add .ZIP Library
3. Download the arduino sketch from the following link: https://github.com/tedmyers/emoticon_keyboard
4. Upload the code to the Trinket with the following steps:
- Select Tools->Programmer->USBTinyISP in the Arduino IDE
- Press the reset button or unplug/replug the trinket USB cable
- Flash the code by pressing Upload within the next 10 seconds (a red LED will be pulsing during this window of time)
- Your code should be uploaded!
Step 10: Computer Setup (Mac Only)
Follow the steps above for a mac. You have to set your keyboard settings to use unicode hex input, which lets you type special characters with alt-codes.
The Windows OS has this native, so this step isn't necessary for windows. However, I wrote this specifically for my OSX based computer, so if you use linux or windows you'll probably have to change the code a bit in order to type the emoticons you want.
I used the following website: http://r12a.github.io/apps/conversion/ to help find the correct codes to use for each special characters.
Step 11: Customization! Make Your Keyboard Do Anything You Want
Feel free to modify the code to type anything you want.
I had novelty keycaps for the "lenny" and the "are you serious" face so I made it type those faces when pressed. (I got them through a massdrop here: https://www.massdrop.com/buy/novelty-shine-keycap...)
You can have it print anything you want. Just have it call the functionTrinketKeyboard.print("your text here")
instead of print_serious() or print_lenny() in the main loop and you're set! Your imagination is the limit here!
That's it, now you have a working mini emoticon keyboard, that lets you type faces with the touch of a button. Make sure to view the example video in the first step if you want to see how it's like in use, and visit my website at tedfmyers.com or look at my instructables profile for more of my projects.
We have a be nice policy.
Please be positive and constructive.
could I make this for my Android, What is the key limit, and could I use the Arduino Uno or leonardo