The thinking cap

Introducing: My prototype thinking cap! It’s a hat that scrolls a message in changing colors. You can change the message with your smartphone since the hat contains a  bluetooth radio. You can even change the colors and stuff. It runs on 8 AA batteries. I actually wore this at around for a day on campus!

I used the LPD8806 based RGB led strips I purchased earlier, cut into 5 equal length strips stacked one on top of the other to give me a vertical resolution of 5 pixels. I incorporated a basic character set that is 5 pixels high and up to 7 pixels wide to scroll the text across the hat. The text is very hard to make out unless you are at least 5 feet away, unfortunately. The farther you are, the easier it is to read the hat.

Materials and technical stuff:

  • Teensy 2.0 microcontroller
  • 2 x 744052 dual 4 channel multiplexors
  • 1 x 7400 series inverter
  • Sparkfun bluetooth mate gold
  • 8 x AA batteries
  • Diode (6A capable, to drop the voltage on the batteries)
  • Plenty of wires

The Teensy only contains a single SPI interface, which was used to control the led strips. I needed a way to multiplex the SPI between the strips since I didn’t feel like connecting the end of each strip to the beginning of the next strip, so I decided to use the multiplexors. I chose the 744052 since they were dual 4 channels, meaning they behaved like a double pole, single throw switch. This was necessary to switch the SPI data and clock lines between each strip. A problem arose however, because I had 5 strips but the multiplexors were for 4 channels, so I added an inverter and another multiplexor and came up with a cheap scheme to let me multiplex between the 5 using only 3 bits.

Enable Sel X Sel Y Enable Sel X Sel Y
0 0 0 1 0 0
0 0 1 0 0 0
0 1 0
0 1 1
1 Don’t Care Don’t care
B4 B3 B2 Mux 1 output # Mux 2 output # Strip #
0 0 0 1 -  1
0 0 1 2 - 2
0 1 0 3 - 3
0 1 1 4 - 4
1 0 0 - 1 5

The third bit of my output was used to control the enable (which is active low) of the first mux, and I tied the complement of it to the enable of the second mux. This ensured that for values 0 to 3 (000b to 011b) that the first mux was enabled and the second disabled, and when I output 100b, this disabled the first mux and enabled the first input of the second mux. The input select lines on the second mux were both tied to ground, as I only used it to select the 5th strip.

This allowed me to easily index my strips and switch between them when controlling the scrolling text. The text itself was achieved using a framebuffer and a bunch of shifts. The bluetooth radio used was the sparkfun bluetooth mate gold, which allowed me to easily change the text message using the serial port profile and a serial console app on my phone.

Video of hat in action:

cooking hardware

In the winter of 2007 I purchased a Dell XPS M1530 laptop, after customization it was almost $2k. This laptop has replaced my desktop and is my main source of computing these last five years, and I have to say that this little beast has served me well. I was problem free until this summer, when I started getting random blue screens of death. I noticed that the BSOD often occured when watching H264 encoded video or when performing any other CPU intensive task. This didn’t bother me much, but lately the problem has gotten worse in a different way.

Lately when I boot up my laptop there is a 50% chance of it not booting. The lights turn on, the fan turns on, the display is blank, nothing happens. Initially I thought it was a display issue but reasoned that it couldn’t be since I didn’t see my HD and CPU activity lights blinking. I tried various things to get it to boot, but nothing worked. By some dumb chance of luck I had turned my laptop on, and put it in my backpack before turning it off. While in my backpack the fan continued to run and the laptop got very hot, eventually draining my battery. When I realized this, I plugged my charger in and powered the laptop on, to witness it booting up, leaving me very confused. This has been going on for the past two weeks. If my laptop fails to boot, I let it heat up and drain the battery and it always boots up next time around. The problem with this approach is that it takes almost 45 minutes to do and is very inconvenient.

After snooping around the web I learned that the real problem is that my GPU is defective, or rather the little solder balls that connect my GPU to the motherboard are probably to blame. It would seem that over time the heating and cooling of the GPU causes the solder joints to flex and unflex, eventually leading to microscopic cracks which compromise the connection. Heat seems to allay this problem somewhat. Upon learning this, I looked on youtube and found videos of people opening up the laptop, removing the heatsink, and using a butane torch to heat the outer area of the GPU. The apparent affect of this is that the solder joints will reflow and connect well.

I don’t have a butane torch, so I tried the next best thing – a heat gun. I followed the instructions on the youtube videos closely and cooked my GPU with full heat for about 10 minutes, let it cool and put everything back together again. I am happy to announce that since then my laptop has booted up 10/10 times so far. Yay for cooking hardware!

Halloween costume ideas

Only a month before halloween is upon us.

For the past few years I have wanted to make a halloween costume, something unique and filled with electronics of course. Time, knowledge and monetary constraints have stopped me, however that all changes this year. I have foolishly decided to forgo worrying about financial constraint for the time being, using good ol’ American plastic to pay for the supplies. What to build?

Earlier in the summer I ordered a heartfelt t-shirt kit from Produce Consume Robot which worked wonderfully. I sat around thinking about how I could possibly extend that functionality, and that is where the idea for the costume was realized. Why not model more of the circulatory system? I already have a component for the heart and my pulse, perhaps I could extend this to the major arteries in the body using chains of LEDS.

Looking around at my favorite sites, I discovered these LED strips.

RGB LED Strip, individually addressable

The strips contain RGB LED’s which can be altered individually because of the the way they are chained together. They contain 32 RGB LED’s per meter. I figured more is better so I found similar products on e-bay which contained 52 LED’s per meter, so I went ahead and ordered a 5 meter reel.

My intention is to cut up the 5m strip into smaller strips which will be overlain on a shirt and pant to mimic the major arteries that go to each foot and up each arm. Pulses of light will travel down the LED strip, and will allow for color changing and special effects. The lights can be triggered by combining with my heart rate shirt, or to external stimuli such as reacting to sound/music around me. Additionally, I thought about adding modes with static color effects and animations, and maybe even persistence of vision effects. All of this should be battery powered, and there should be a very simple interface or remote control to change between the various modes on the fly.

For reacting to sound, I plan to use an MSGEQ7 graphic equalizer IC. This IC accepts audio input and performs some type of frequency analysis. The output is divided into 7 frequency bands, so it is entirely possible to create effects which react to low, middle and high pitched notes.

For the remote interface, a simple button panel will do, but if I have the time then maybe I could create simple android application and use bluetooth to control the lights wirelessly from my phone.

Here is a horrible picture of what I plan to do:

More to come!

new skeletal model viewer

I finally got around to making our skeletal model viewer look slightly more skeletal. I’ve broken down the basic anatomy of a body into 6 symmetric pieces and 1 asymmetric piece.

The 6 symmetric pieces are

  1. lower leg
  2. upper left
  3. hip
  4. upper arm
  5. lower arm

There are 2 copies of each of them, to give a total of 12 bones, plus the 13th bone which is the back. I decided to model the bone segments using two cones which are connected at their bases and have the same base radius. There is a distribution of 25%/75% of the length of the limb between the upper cone and the lower cone. The upper cone is the one that connects to a parent bone end.

New sensor harness

Well, it was about time. For my Engineering Design II class, my project is a  Sensor-Aware Personal Trainer. The basic idea is I use a few inertial measurement units (IMU’s) attached to various limbs of a human body and track the orientation of said limbs. By tracking the orientation of two connected limbs, I can find the angle of one relative to the other. In order to do this correctly, a harness had to be created in order to attach the sensor to the limb in question.

Previous attempts at putting the sensor hardware in a plastic enclosure with a Velcro hook backing and attaching to a Velcro strap around the limb failed me. Why did it fail, you ask? Simply put, the Velcro-Velcro bond is not very secure, it tends to move around quite a bit while moving your limbs. I think this is a problem of surface area, the sensor is only in contact with a small area of Velcro.

The solution hit me like a wall of bricks today, while I was curiously looking around for parts. I stumbled upon what looked like a tiny file cabinet in the design lab on campus. As it so happens, the file cabinet is actually a business card holder. There were plastic pieces which looked like file folders except they were most likely used as dividers. I took a few of these and suddenly realized a new way to get the sensors onto the limb with maximum contact area, and off to work I went.


Look and behold!


I got it in my head to make a digital synthesizer using a leftover microcontroller (Freescale JM128 Coldfire V1) from a class I had taken previously. So off I went. I wanted something that I could use a MIDI keyboard with. While snooping around a local store, I stumbled upon this:

Akai SynthStation 25

It’s a 25 key keyboard which is supposed to work with your iPhone. Additionally, it works as a USB MIDI keyboard! The microcontroller I was using had support for USB device and host mode, though getting it working was a real pain. Freescale supplies a small USB stack for the microcontroller, and after a week of toiling I finally got it working correctly. One of the problems I had run into was that the D+ and D- pins of the USB had to have pulldown resistors in order to work correctly, something that took me a few days to figure out.


I used tusbsnoop with the keyboard connected to my computer to get the vendor and product ID as well as the device class and endpoint information for the USB protocol. I had to put this information into a struct for the USB stack to use it correctly to connect as follows:

static USB_HOST_DRIVER_INFO DriverInfoTable[] =
 {0x09,0xE8}, /** Vendor ID for Akai*/
 {0x00,0x7A}, /** Product ID per synthstation USB kb */
 USB_CLASS_AUDIO , /** Class code */
 USB_SUBCLASS_AUD_MIDI_STRM, /** Sub-Class code */
 0x00, /** Protocol */
 0, /** Reserved */
 SynthStationUsbEvent /** Application call back function */

Anyway, with that all set, I connected everything up. Amusingly, the space in the SynthStation where you put your iDevice into was just about right to slip a small breadboard into, which made my life much easier.

Makin’ noise

Alright, so I got the thing reading the keypresses, but now I have to make some noise. I decided to use a technique called digital direct synthesis (DDS) to generate my waveforms. I used this wonderful guide to help me out, thanks electricdruid! I hardcoded a sine wavetable, and generated the tables for sawtooth, triangle and square waves. All this was great but, how do I get sound out of this thing?

To get sound out of the microcontroller would require using a digital to analog converter (DAC), which is the reverse of an analog to digital converter (ADC) which is found on many microcontrollers as a built in peripheral. I found a guide online on how to use a single PWM pin to create a low fidelity 1-bit DAC, and tried it. I was not too happy with the sound!

Eventually I decided to buy a DAC and settled on the Microchip MCP4921, which is a 12 bit DAC using SPI. I created a basic RC low pass filter to clean up the output and wired everything up nicely.

How is the sound generated? The basic idea is that I had an interrupt on a 22kHz timer that would look into the wavetables to generate a sample, and then this sample was fed to the DAC using SPI. I chose to use 256x1byte entries to store 1 period of each wavetype.

Here’s what it looked like now:

The micro, the DAC, a 24 character LCD for later use, and the RC filter attached


I went ahead and added a character LCD for later use. You can see a small 1/8″ audio jack that I hackishly put in to test the sound synthesis.

More to come later!