Showing posts with label Albert's Gift. Show all posts
Showing posts with label Albert's Gift. Show all posts

Thursday, June 15, 2017

Albert's Gift: Part 2

Damn I suck at keeping up with new hobbies. I've been busy being lazy keeping up to date on this blog, but I'm on summer vacation right now with no job and continuing to be a lazy guy. However, I have been slowly but surely working on Albert's gift. I believe the last post talked about the 3D enclosure for the circuitry. I tried printing out the enclosure straight from the files the Adafruit tutorial gave, but something wonky happened and the walls of the enclosure was too small for the top and bottom pieces to fit on. Not being well versed in 3D printing and its software, I attempted to simply scale the wall piece a little bit to allow for enough room, but the end result is some thinly printed plastic that is now a bit too loose.


Shown above is the side of the enclosure that allows the arduino to be plugged with either a micro-USB cable or a 5V DC supply. I didn't have enough time to fix the design and print a better side, but it holds well enough. It just looks like a termite mound.

After the 3D printing step was done, I had to solder on a few wires to the Adafruit Trellis board so it can connect with the arduino inside. But before I go on, I want to talk about a problem I encountered yesterday when I was working on the code.

I originally was using an arduino R3 as the microprocessor. As I was attempting to write code to simulate one of the buttons typing in a capital "A", I learned that the R3 was not able to use the "Keyboard" library due to its installed microcontroller. Believing that I could surely pull it off anyways through some sort of manual update of the firmware that would disregard this restriction, I did a quick Google search and found that it was possible, but I would have to solder on a 10K ohm resistor to a couple of pins on the bottom of the R3. I figured that since I don't have a soldering kit and the 10K ohm resistor attached to the bottom would make the R3 too big for the enclosure, I simply went out and bought an arduino Leonardo. The microprocessor on this arduino was actually able to naturally use the "Keyboard" library and allow for what I wanted.

Back to the soldering of the Trellis board, below you can see a quick picture I just took of the circuitry between the Trellis board and the arduino Leonardo.

Furthermore, I soldered on 16 LEDs to each of the 16 button locations so when one is pressed, it would light up until released.

With the hardware complete, I now move on to the coding of this project. So far, I have been able to simulate a capital "A" when pressing whatever button I code it to be (I made it the button labeled "1" on the Trellis board). Preparing myself for coding all buttons to simulate a keystroke of the keyboard, I am attempting to make a switch statement. The code is written so that it goes through each button (1-16 on the Trellis, but indexed 0-15 in the code) in ascending order, checking which button has just been pressed. Whatever button it's checking is saved into the aptly labeled "i" integer which will be the expression used in the switch statement. I will have 16 cases for each number in the closed set   [0, 15] and program them to simulate a single letter of the alphabet from A to P, which should be the first 16 letters.

I will test with only the first 2 buttons to see if this switch statement will work as intended, and later code in the LED functionality. 

Fingers crossed.

Tuesday, March 21, 2017

Albert's Gift: The Beginning

I got a friend named Albert. He's been my best friend since middle school. Without going into details, his family has been hit with a bit of a financial situation. We talked about it in private and stuff, and immediately, I tried going through as many money making schemes to fund raise for him. I've never felt more helpless before.

So here's what I decided to do. I'm gonna make him something. Something completely unnecessary, but something that I hope will mean something to him. We're both men of few words, so hopefully this will communicate something I can't say.

We're both really into an MMO called Final Fantasy XIV (14). In MMO's, players usually need a plethora of keybinds for their skills. There's only so many keys a left hand can reach, and so many combinations (ie 4 or shift+4 or ctrl+4 for 3 different keybinds) it can make. So what game peripheral companies have made are ergonomic "keypads" that fit naturally to the left hand, and basically have ~16 keys, fully programmable to be any kind of keystroke(s). These usually run $60 USD which is like $10 billion CDN. So I'm gonna make Albert a small keypad.

The keypad will be a 4x4 grid and made from the Adafruit Trellis; a PCB I've ordered that's specifically meant for this kind of use. It'll be used with an Arduino Uno inside a 3D printed enclosure and act as a 16 key, keypad.

The buttons aren't any sort of mechanical switch; it's membrane. Membrane sucks dick. Buuuuttt it reduces cost and it'll make my initial make of this thing easier. I have all the materials save for the 3D enclosure from which the plans are taken from a "learn" article on Adafruit's website.

The issues I foresee is reprogramming the buttons to whatever Albert's specific keybinds are. I'm planning on getting this done before I next go back home to Canada, so I can be with him and set it up at his house (and also have a full bromo talk with him or some shit). Also, I don't know how the code works yet lol. I've taken a look at the trellis tutorial, but I'm still not sure what is going on.

The first step is getting the 3D parts I guess. In the meantime I'll attempt to work out the code that is supposed to work with the Arduino IDE, but it's been a while since I last coded for "real". I'm also busy trying to figure out all my transfer stuff which is all a pain, but Albert is worth it.

Really hope he doesn't see anything here until I finish this. More to come soon, maybe. Hopefully a week at most.