Here you will find a few videos and code of some current and past projects I am working on. Also, my resume is available here.

Plasma Speaker - and other high voltage experiments  

This is probably my favorite project. Although, the sound quality isn't all that great, high voltage is a ton of fun to play with.  All you need to do is tear out a flyback transformer from an old-school crt computer monitor, build a simple oscillator circuit, grab a power transistor and a power supply (I use a 19V laptop charger) and you get some pretty nice sparks flying. Although I haven't actually measured it, judging from the dielectric breakdown voltage of air, I'm guessing you can get around 30 to 50 kilovolts. So we're not in tesla coil territory, but fun none-the-less. WARNING - I'm not responsible if you electrocute yourself with this circuit, but I think it's fairly safe (maybe, sort of), 

Most of the parts can be bought at Radio Shack. You won't be able to find the IRFP250 power mosfet there (get it from Digikey), but you could substitute a 2N3055 or the smaller TIP120 or TIP3055. Since those are BJT's instead of mosfets you might have to adjust R9 which would feed the base current to the transistor. It's best to add a heat sink to whatever transistor you choose. The pots you get at Radio Shack are ok in a pinch, but they wear out quickly and tend to not stay on the breadboard very well, so get a few of these from digikey instead, they work great. 

High Voltage Theory - Simplfied
I soldered alligator clips on the high voltage wires of my flyback. This makes it easy to experiment with different electrodes. Try to get a nice clean arc, or try to get a beautiful spread out purple corona. With every electrode you try, be sure to try it on both the positive and negative terminals, as it can make a huge difference. Electrons tend to fly on/off the electrodes at sharp points. This makes sense since voltage is somewhat analogous to pressure, and the conducting electrons can be viewed as a sort of gas moving through the crystal lattice of the metal. The transformer pulls electrons off of the positive terminal and pushes them onto the negative terminal, increasing the pressure of this electron 'gas' on the negative terminal and decreasing it on the positive terminal (this also explains why the negative terminal gets much hotter, higher pressure with more electrons means more electron/lattice collisions, thus increasing temperature). As more and more electrons get pushed onto the negative terminal the pressure grows, at some point the repulsive force between electrons becomes greater than the attractive force between the electrons and the positive charged nuclei of the lattice and an electron will fly off the negative terminal. An electron at the tip of a sharp point feels more repulsive pressure from it's neighboring electrons than would an electron on a rounded end. It's somewhat similar to how the sharp point of a needle can puncture something due the greatest psi happening at a point. That's the classical picture anyways and is useful for experimenting, but of course a complete quantum picture would be different. 

Operation of the speaker
Sound is a pressure wave. When a speaker cone pushes out, it compresses the air creating a high pressure area, and when it pulls back, it creates a low pressure zone. The plasma speaker does the exact same thing. By varying the amount of current through the arc, you change its temperature. A large current equals a hotter arc which heats the air around it and the hotter air expands. A smaller current creates a lower temperature and the air condenses. The process pushes air back and forth, just like a regular speaker. This circuit uses a technique called Pulse Width Modulation (PWM) to do that. 

The flyback is operated by sending a square wave to the power fet Q2. When it's on, current flows through the flyback's primary, building up a magnetic field inside. When Q2 is turned off, the magnetic field abruptly collapses, and since induced voltage is proportional to the time rate of change of the magnetic field, it's this abrupt collapse that generates the large voltage. The frequency that Q2 switches should be higher than the range of human hearing, about 20kHz, otherwise you'll hear a high pitched squeal. Once the transistor is turning off an on, you then need to adjust the duty cycle. This means that even though the transistor is switching on and off 20 thousands times a second, you will varying the ratio time spent on to the time spent off. If the transistor is on for 3/4 of a cycle and off for 1/4 of the cycle, there will be a larger current in the flyback's primary than if the transistor is only on for 1/4 of the cycle and off the rest of the time.

The comparator IC1A makes a basic relaxation oscilator. The frequency is primarily set by capacitor C1, smaller the value faster the circuit. Pots R1 and R2, are also involved in setting the frequency, R1 controls how fast C1 charges (R5 is involved too, since the LM339 is an open drain output) and R2 controls how fast it discharges (R5 is not used during discharge). Using pots for those resistors allows you to experiment with the shape of the waveform across C1. The voltage across C1 is then fed to another comparator, IC1B, which does the pulse width modulation. R3 is used to control the duty cycle of the flyback whether or not you have an audio signal coming in. It acts as a sort of base duty cycle, because when you feed in an audio signal, it modulates the duty cycle from there. The audio signal is fed into IC2A, which is a basic differential opamp. Its output is capacitively coupled to R3's connection to IC2B. R15 controls the gain of the amplifier.

To get the best sound, play with all the knobs to get it tuned just right, but this circuit seems to be a good starting point.

Here's a few other things you can do with a high voltage source.

This is a Jacob's Ladder. There's not much to it, but fun to build though. It uses the same circuit as above, but without the amplifier circuit connected. Control the voltage and current by turning R3. 

You can make a fluorescent light bulb light up without actually connecting it to anything. Rapidly alternating the electric field surrounding the bulb from very high and back to zero is enough to polarize the gas in the bulb, to the extent where some electrons around a gas atom are pulled far enough away from the nucleus that they go to a higher energy level. When the electric field goes back to zero, the electrons return to their original energy level emitting a photon. It is necessary to have an arc between the positive and negative terminals. What happens is that as the voltage builds up between the terminals of the flyback secondary, the gas atoms polarize due to the strong electric field. Once the voltage surpasses the necessary voltage to breakdown the air, the arc forms and rapidly the electric field goes back to zero, causing the electrons to return to their original energy level by emitting light.

Go to Radio Shack and get yourself a $5 xeon bulb. I have no idea what the proper voltage and current for this bulb is, but play with the knobs on the pots a bit and you can have a lot of fun playing with it. Grab some rare earth magnets and make the stream of light corkscrew around. Flip the magnet over and the corkscrew goes the other way. This happens because charged particles moving in a magnetic field experience the Lorentz force.

The Über small, Über cheap Tesla coil

This is my first attempt at a Tesla coil. The design goals were to get a working coil, and to make it with spending as little money as possible. I have a whopping $12 wrapped up in it. Most Tesla coils use either a neon sign transformer or some other type of high voltage conventional transformer. I didn't have any of those laying around so I decided to use my flyback transformer as a high voltage source (with the driver shown above). It uses the standard Tesla coil circuit with the spark gap across the transformer leads. You'll find a hundred schematics of it with a google search so I won't post my own. First, I made my own capacitors out of some tin foil and a $5 piece of vinyl from a craft store.
They measure about 17nF each and I wired 3 in series for a total capacitance of ~6nF. Next grab a few dollars of copper ground wire (~10 feet), some pie tins, a couple nails for a spark gap, a paper towel tube, and tear the magnet-wire coil out of a broken shake flashlight. Wrap the copper ground wire in a spiral (either vertical or flat) and wrap the magnet-wire around the paper towel tube and assemble the final coil like so
Then hook up the fly back and make some sparks

Is it an impressive Tesla coil? Not at all. Was it fun to build and play with? Absolutely! I personally find the purple corona to be very beautiful and I get more corona and bigger sparks with the flyback driving the Tesla coil than with the flyback alone. The maximum spark length I achieved was 6cm. Why so little? The main reason is probably because the flyback and its driver just don't put out enough power. Also, I'm sure there's quite a lot of losses in the caps I made, as the vinyl I used probably isn't the best dielectric, and high quality homemade caps are difficult to make. Each part of a Tesla coil interacts with every other part, so adjusting the length to width of the secondary coil, the size and shape of the tophat, the width and design of the spark gap, the coupling between the primary and secondary coil, the capacitors and the power of the input transformer all play a role. Richie's Tesla Coil page has a wealth of information. I'm in the process of making another secondary coil with different dimensions and I hope to find a better high voltage source soon.

A PIC based Christmas light controller 

This is a 6-channel Christmas light controller which was my Christmas gift to my parents. Sure, it's a bit 3rd-grade-art-project-as-a-present-ish, but hey, how many people get custom made electronics for Christmas? And besides, your mom loved your art projects. You simply plug in any ol' strand of christmas lights into each outlet and then you can control the timing of when each strand turns on and off, and you can also control the brightness from completely off to full brightness with any level in between, which gives you the ability to do all kinds of fading in and out or blinking - be as creative as you can be.

Making a light show is pretty easy too. You simply experiment with the string called program_str which is listed towards the top of main.c. 
It's a sort of script with each line being a command that contains the timing info, the channel, the command and any options for the command. Each line is terminated with \n.
The command format is
"100 1 c 70\n"
  • 100 is the number of milliseconds since the last command
  • 1 is the channel (which outlet/which strand of lights),
  • c is the command, in this case set to constant brightness
  • 70 is the option for the 'c' command, roughly half bright.
There are five different command that can be given to each channel
  • c  constant brightness, with 1 to 125 as the brightness levels with 1 being the brightest
  • f  fade, the first option is the starting brightness, the second is the stopping brightness and the third is the slope, which controls how fast it fades from dim to bright or vice verse.
    Eg. "200 2 f 125 1 -1" says "fade channel 2 from all the way dark to all the way bright in 1 step increments". Give it a -2 to fade in twice as fast.
  • s  seesaw, which fades up and down repeatedly, the options are the same as fade.
  • b  blink, which the four options being the "on" brightness, "off" brightness, "on" time, "off" time.
  • z  it's just a convenience that turns the channel off. Saves a few keystrokes
An example light show is
"0 1 b 1 125 4000 4000\n" // immediately, sets channel 1 to blinking,
"3000 loop 3\n" // wait 3 seconds and then loop the following 3 times (can also have nested loops)
 "0 2 f 125 0 -1\n" // fade channel 2 from off to on
 "500 3 f 1 125 2\n" // wait 500ms and then fade channel 3 from on to off, but do the fade twice as fast
"500 end \n" // wait 500ms and go back to loop
"0 1 c 1\n" // channel 1 full brightness
"0 2 c 50\n" // channel 2, little less bright
"0 3 c 90\n" // channel 3, still less bright
"5000 1 z\n" // wait 5 seconds now turn all channels off. It automatically repeats the light show
"0 2 z\n"
"0 3 z\n"

As a future improvement, I think it'd be relatively easy to write a GUI program that let's you graphically build the light show so you wouldn't have to write the commands by hand, just point-click-run. Another future improvement will be to put in a wireless link so the light show string isn't statically compiled in. I'd probably do this with something easy like an off the shelf zigbee or bluetooth product that can implement a simple wireless serial port - maybe an XBee module -


There's basically 3 parts to the circuit.

The first is the microcontroller circuit, which is just a PIC micro along with the necessary pull-up resistors. It runs off of a 5V supply (old cellphone charger - why buy a transformer and build your own when I have 4 of them just sitting in my drawer?) 

The second is the zero-cross detector. Since christmas lights run off of AC, they turn on and off 120 times a second, so to dim them, you just detect when the AC waveform is zero and then waiting a little bit before turning them on. So for half brightness, only turn them on for roughly half the time. The circuit I used is a very good circuit that I found here, except for I switched out the 22k resistor for a 50k one so that the pulse it gives is a bit closer to the actual crossing point. It uses an opto-isolator so the 5V side of the circuit is physically separate from the 120V side. The output is tied to an interrupt pin on the mcu, so each time the AC waveform crosses zero, an interrupt is called that updates when the last zero cross happens so the brightness control can be properly done. 

The third is the output channel circuits. It uses triacs - one for each channel - to turn the lights on and off. The circuit seems to be a relatively common way of controlling AC loads with a micro. These are electrically isolated from the 5V circuit as well by opto-triacs.

Although, all the part numbers are shown on the schematic, a complete list is here too

Since main.c is the only interesting file, so it's the only individual file link I'll put, but the entire code is available as christmas_light_controller.tar.gz

Since 6 channels isn't very many, you're somewhat limited in what you can do, but here's a quick example of controlling lights on a tree. But the good thing is, it'd be very easy to add more channels. I only stuck with the initial six as a proof of concept and you can't find plug-in bars with more than 6 outlets, and I think the plug-in bar conveniently ties it all together.


Ribble - a ruby clone of ChainShot/Samegame 

This is one of my favorite time killers. I used to play SameGnome that came with my Ubuntu distro, but upon upgrading my distro, the new version, Fell Swoop, wouldn't work. So I wrote my own and put in features I've always wanted. I can now replay the same grid layout multiple times to see if I can improve my score. To run, you'll need to install qtbindings with

> sudo gem install qtbindings

Then run with 

> ruby main.rb

or if you desire

> chmod +x ribble
> ./ribble

You can view the source by clicking on individual files listed below or you can download the tarball ribble.tar.gz


Life - Thee classic cellular automaton  

This is my version of Conway's Game of Life. I'm fascinating by the concept of emergence, where seemingly coordinated global behavior results from multiple agents following local rules. Examples of the phenomenon are the way schools of fish move together, the way ant colonies form and how neurons following local rules somehow produce this global behavior called consciousness. The game of life is another example. Each generation of the game board follows very simple rules but incredibly interesting and complex patterns can form, including self-reproducing structures. There is a huge list of various structures that have been found here
I wrote this in Ruby with Qt along with using Qt Designer to make the layout. To run, the procedure is similar as above, first install qt-bindings with

> sudo gem install qtbindings

Then compile the user interface

> rbuic4 lifewidget.ui -o lifewidget_ui.rb

and finally run with
> ruby main.rb

Get the whole tarball or see individual files. life.tar.gz


Accelerometer-based Controller

After seeing the motion sensing capabilities of the wii, I was compelled to experiment on my own with an accelerometer. Below is a few examples of what I came up with.
This is an accelerometer based controller I made. The main components are:
  • Freescale HCS08 8-bit microcontroller
  • AXDL330 3-axis accelerometer by Analog Devices (yes, the same one used in the wii Remote)
  • and the USB communications are handled by FTDI's FT232RL USB-to-UART bridge.
Three buttons finish off the design. The breakout boards for the accelerometer and the FTDI chip are from SparkFun. The accelerometer breakout board has 50hz lowpass caps already installed. The micro samples each axis at a rate of 100hz. After reading the three axes' values, it reads the button statuses and finally sends them to the computer via the USB-to-UART bridge.  I typically use the ball under Linux by using SDL. Upon instantiating the VirtualBall object, a thread is created that reads the values from the ball, and generates user-defined SDL events, which the program then handles normally with SDL's event handling mechanism. Filtering is also provided by the ball object with user-defined coefficients. I usually just use a 10 or 15 point averaging filter to smooth the readings from the accelerometer.


Now the controller in action...

YouTube Video

This demo is a basic shake-a-day game. Shake the ball to have a cup full of dice shake on the screen and then roll them onto the table!
Written in C++ using SDL with OpenGL.

This is a simple 3D demo of using the controller to tilt an object on the screen.
Written in C++ using SDL with OpenGL. This uses a small framework I wrote to wrap SDL and the accelerometer ball's functionality. This allows me to very quickly set up a program to test ideas.

This is the UML diagram of the main classes of the app.
...and some code

This is a video of using the accelerometer based controller as a mouse. Tilting the ball moves the mouse pointer. Pointer's velocity is proportional to the degree of tilt.
Written in C using the uinput driver.

Other Code

This is the code for a simple tetris game. Although a windows console program, it was written with the intent of porting to a Freescale HC12 for an embedded systems course. Written in C.