Sunday, December 3, 2017

LED Hat: A Theta Tau Christmas Intro

I'm a bit late in making a post about this, but a dude's gotta do what he gotta do.

I recently purchased a "Santa dad hat" online since I've been recently been wearing dad hats with varying styles such as a Mario, Luigi, and Wario dad hats. So, being a Christmas season lover, I decided to google "Santa dad hat" and found exactly what I had envisioned. After a week my baby came in and it was everything I asked for; truly Christmas came early (it came in November, before American Thanksgiving had even passed). 
Pictured above: The Santa Dad Hat

After sometime, like a mad genius, I decided that this was not enough. I had to be extra. I wanted to somehow attach LED's so I can have the Greek letters "Theta Tau", my fraternity, on the front. It was impulsive, and I only have <3 weeks left to complete it, but God as my witness it shall be done.

Some design considerations
  • Regular, single coloured LED's or something akin to Adafruit's Neopixels?
    • How would the wiring be done in either case
    • If using neopixels, how big should I make the matrix
  • Use what micro controller?
  • Control it wirelessly?
  • Where would the micro controller be physically?
  • Power source?
Second design consideration: What Micro Controller
I had gone through a lot of thinking over the first and third points. For the second point, I knew that if I used Adafruit's Feather line of micro controllers, I could easily swap out a basic board, the 32u4 Adalogger, for one with bluetooth capability, the 32u4 Bluefruit LE (both of which I already own), with some simple addition of code.

First design consideration: LED Type
If I used, say, a bunch of regular looking LED's that were yellow either by the type of material made, or by some different coloured plastic housing, I could easily, but tediously, poke the leads of the LED's into the hat, in the pattern I wanted, and solder the leads in parallel. That way, I could program some different functions of blinking, fading in and out, etc. with it. The issue is that it would only be a niche image, and if I wanted to do something similar, but with some other image, I would have to desolder the existing design, and solder the new one; very tedious and time consuming. 

If I used neopixels, I could use any design I want, anytime, for basically eternity. I could also make it display more patterns such as a side to side scrolling image.The issue I was mainly concerned with was the coding. It has been a while since I've even touched some Arduino type micro controller, let alone a Raspberry Pi for the laptop project. Also, attaching the strips to the hat might be an issue since I may want to remove the strips in the future and salvage the hat. The size of the matrix would have to depend on the surface area of the hat that is viewable from the front.

Third design consideration: Wireless Capability
If I choose not to use wireless, I would need to somehow create an opening in the hat to allow access for switches somewhere. I'd rather keep the holes I make in this hat to a minimum. If I used bluetooth, I'd need to figure out what code I need to use, which is more complicated than say, using some makeshift breadboard setup and basically sticking it to the side of the hat.

Fourth design consideration: Micro Controller Location
Also something that was almost decided immediately, the hat has a lot of room above where my head is (space is towards the cone). I can simply stick it inside somewhere in there and/or rest it on my head. I'm not going for comfort, but function, ultimately.

Fifth design consideration: Power Source
More of a formality of documentation in writing this down. I know I want to be portable, so the decision to go with either a li-po battery or my portable charger was basically instant rather than carrying around a wall adapter and using that. Also, the battery would also sit inside the hat somehow. I'll test out how both feel in the hat later on, but right now, a portable power source is what I'll ultimately be using.

I decided on using bluetooth, and the neopixels. Though the more complicated combination, I figure the functionality will be infinitely more useful and cool looking.

Keeping this record of what I'm doing takes a lot more time than I thought it would since I've been way more into actually building the darn thing. I don't want to do thing project and then write a final report since I guarantee that me later won't have the thoughts as the me who is currently making the thing. Also, this way I can make record of any failures in real-time. To  compensate (kinda), I've been keeping a notebook of brief and will try to show some of the relevant pages so you can see my thought process. 

Alright, let's get 'er done.

P.S. An idea for use after Christmas: some sort of Harry Potter sorting hat. It'll choose a random hat whenever I send an input and display one of the 4 Hogwarts houses. That'll get me some street cred.

Thursday, November 30, 2017

Makeshift Laptop: The Prequel

I just received what I had thought to be all the parts I needed for this small laptop I wanted to make using the Raspberry Pi, but the screen I got is not compatible with the 40 pin tft to hdmi converter from Adafruit (TFP401) as one component on the board was burning hot to the touch. I have now ordered a 7" tft screen from Adafruit, which is sure to work with the chip, and I can begin construction of the laptop.

Quick list of parts I originally planned on using:

  1. Raspberry Pi 3 Model B (for its built in wi-fi and bluetooth)
  2. Adafruit TFP401 converter
  3. Rii Mini X1 bluetooth keyboard and mouse (all on same board)
  4. Anker Astro E1 5200 maH portable charger (power source)
  5. 10.1" Laptop Screen Part # LED-1024-600-G-40-10.1-8
While I wait on the new screen to come in, I am setting up a new micro SD card for the laptop and doing the necessary changes to some files so that I can connect the Pi to my school's "eduroam" wi-fi network.

Credit to user "Sruc" on this thread who posted the solution to connecting to eduroam.

Bit of an aside, but I remember encountering this problem sometime during the latter half of freshman year and searching for this solution in the past. However, I've been not so diligent in trying to keep up making some sort of project every semester that most of my Raspberry Pi skills are quite rusty. Maybe I'll open up my notebook from my engineering programming class from that time for a refresher.


Tuesday, November 28, 2017

November 2017 Update: The return that will hopefully work

Whew 4 months sure pass by quickly. As an update, my Summer was very unproductive, but I did manage to get myself a soldering kit which was pretty cool. I kept myself busy by going to the dollar store, finding cheap electronics and try to dissect the circuits inside them. There was this simple PCB I found in a $2 lawn lamp. It had a solar panel to charge a small battery of some sort. It also had a on/off switch if you wanted to enable the functionality of the lamp; turn off the LED during daytime and charge the battery, and then turn on the LED at nighttime. 

Long story short, I couldn't figure out the circuit diagram for it because there was a black epoxy covering what I suspect to be some sort of transistor (a component I had not been taught about before).

I also found a cheap light that would turn on if it detected motion. I only took it apart once and quickly scanned its components. If I recall correctly, the circuit used some sort of photo resistor to detect motion. 

Apart from these small electronics, did not really do too much. Now, I'm almost done the first semester of my Junior year and have a great deal of projects I want to do, or at the very least attempt.

A tentative list of such projects in no particular order:
  • Albert's Gift (fix 3D printed enclosure)
  • Arcade Box (Redo laser cut wooden enclosure into something that works)
  • Makeshift Raspberry Pi (I ordered a laptop screen and various parts to make a cardboard laptop out of and hopefully I can laser cut/3D print a good enclosure)
  • Amazon Echo Stuff / IoT
  • The various Adaboxes to do
Hopefully I can knock at least 3 of these before the school year ends next May. I got big dreams, but only by actually doing something can they come to fruition. Let's also hope I stick to this work ethic.

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.

Intro

Hi.
I'm Kevin Zhang.
A guy with more ambition than backbone.
I'm a student at the University of San Diego majoring in Electrical Engineering and getting a minor in Mathematics. This blog is an attempt to document any and all projects I work on. I started this blog sometime in Spring 2017, but got lazy afterwards. I am horrible at keeping this totally up-to-date as writing these things takes a ton of time. Because of this, let me preface this blog by saying that everything is written informally. I'd rather be able to spit out more content/projects than pick and choose my words like this is a proper write up.

Email Contact: kzhang@sandiego.edu