Saturday, September 10, 2011

For Mary in Pennsylvania!


                When I started to write my master’s thesis, my adviser told me that I write telegraphically, that is, that I almost write in a kind of code, only covering what I think is the most important bits and leaving out all of the narrative that might connect those bits. I thought that I wrote like a car driving very fast down a dirt road, only hitting the top of the bumps and flying over the ruts. The first draft of my thesis was less than 25 pages.  I wondered how it would ever be enough to become an acceptable thesis. My adviser made me slow down, to cover every bit of the ground between the high spots. Both ways are a rough ride but when I finished, the gaps had all been filled in for my thesis and I had over 100 pages of text that covered less of the story than the original draft. Now, I’m going to try to fill in the gaps of my story on creating the lit guitar, as a friend commented today that what I’ve written so far leaves out all of the connections.  
                I picked up the guitar at John’s office, where the owner had sent it. We opened the box on his sofa and took the instrument out. An electric guitar is supposed to have a solid body. This one had been extensively altered already; the body had been cut out, leaving a rim of wood around the edge and a strip down the middle, extending from the neck to the area where the button for a strap might be inserted (on what I call the guitar’s butt). It had a pick-up inserted; a pick-up is the built-in microphone that captures the sound of the strings being struck. It is located in about the center of the body of an electric guitar. There was a bit of wood left to mount the bridge, which was in a plastic box in the case’s compartment. The strip of wood between where the bridge would mount and the butt of the guitar was cut back, so it no longer consisted of the full thickness of the body and had been drilled full of holes. All of the wood of the body had been painted with metallic silver paint. There was a piece of fiberboard inserted in the body. This fiberboard was coated with silvered plastic “holographic” film, to look like the lighted circuit board that was inserted in Ace Frehley’s lit guitars. The back of the guitar was covered by a piece of mirror, cut and drilled to fit the body.
                My task was to turn this guitar into an actual lit guitar, just like the ones that John and I built for Ace, “back in the day.”  
                It wouldn’t be possible to build an identical lit guitar; we had used a state-of-the-art microprocessor chip at the time but it was seriously outmoded in the year 2011! We also used about 1,000 incandescent light bulbs, each laboriously soldered on by me, and switched by large power transistors, each mounted on the aluminum back-plate of the guitar, which doubled as a heat sink.
                If you touch an incandescent light bulb, such as a 100 watt bulb in an ordinary light fixture, it will burn you! Incandescent lights require a lot of power a lot of which which turns into heat. A heat sink is a device whose purpose is to dissipate the heat that is produced by electronic devices. All of the power used by the light bulbs in Ace’s guitar had to be switched by the power transistors and they got HOT! By mounting them on the back plate, the plate warmed up but didn’t burn Ace (or destroy the transistors, which would have happened if the heat built up without a heat sink).
                We had to use modern components. Jack and I had discovered a popular microprocessor platform, the Arduino, whose source code is available to anyone (“open-source”). We had been experimenting with Arduinos since July 2010, when we went to “The Next Hope”, a conference for electronics and programming enthusiasts. So, we decided to use the ATMega328 chip and the Arduino programming language. I had designed and built prototype circuit boards as a teenager, so doing it again did not intimidate me.
                The big problem was figuring out how everything would fit together. When we made the guitars for Ace, he sent us new, intact Gibson Les Paul guitars, straight from the factory. We could think about how to minimize the amount of wood that we would remove. This guitar had had all of the wood that could be removed, removed! I worried that the neck would snap once the bridge and strings were installed, as the strings place force on the neck and body. The neck was already warped. For this reason, I did not want to install the bridge. Ultimately, I sent the guitar to an expert for set-up (straightening of the neck, installation of the bridge, proper mounting of the string adjusters, and installation of the strings). I opted to wire the pick-up and the jack (to plug the guitar in to an amplifier) because I wanted to connect the “ground” of this wiring to the “ground” of my electronics. By connecting the grounds together, I hoped to avoid any interference between the circuits (it worked).  On the original, the lighting effects caused loud pops and squeals in the sound signal going to the amplifier, so we had to add a lot of filters to the circuitry, to protect the sound circuit from the light circuit. Fortunately, I didn’t have to do this on this guitar, but I’m jumping ahead of myself.
                First, I designed a simple circuit for the microprocessor. The microprocessor has 14 digital I/O ports, which means they can be used as either inputs or outputs and will recognize or produce signals as either high or low voltages, not as shades of grey! I used them as outputs, each to control one of the fourteen segments of lights. I used six for the border and eight as vertical bars on the body. I also had six analog I/O ports. Analog ports are good for signals that you want to vary over a range. I used two as inputs; one for a speed control (a potentiometer, which is a variable resistor) and one for a switch to choose the pattern. I chose a switch with twelve stops, so the guitar’s microprocessor could have twelve different patterns programmed into it. As you can see, I had a number of decisions to make before I even started to build the circuit!
Next, I had to order parts. I wanted very bright LEDs, light-emitting diodes, for my light source. I researched a number of different LEDs before I chose one particular device. Some of my choices included color, size, the width of the angle at which light can be seen, and the intensity of light. I needed about 200 devices; the owner and I had decided on that number for the price he was willing to pay. I also needed voltage regulators; the LEDs that I chose worked with 3.2 volts, but the Arduino used five volt signals, so the power had to be stepped down. Each segment of lights needed its own voltage regulator; otherwise, too much current would be drawn through the devices. Since I had never used these devices before, I ordered parts for a much more complicated circuit. Once I got the parts in the mail, I used a “breadboard” – a method of building a circuit before you build the final version - and discovered that I could greatly simplify the circuit to use fewer parts. I was happy!
In my mind, I had divided the circuit into three parts – the LED board, power distribution (how each segment would get its power, including the voltage regulator) , and the logic board (which included the microprocessor and all of its associated components). I did this to mimic the division of circuitry in the original lit guitar. Finally, the circuit had to be powered by an internal battery. I used a lithium-ion battery, a long-lasting battery commonly used in radio-controlled airplanes.
Once I had a circuit that worked constructed on the breadboard, I built the power distribution board. The first time I laid out the pattern on my computer, I reversed the inputs and the outputs, so I had to build it again. Oops! I also cut out the big circuit board for the LEDs, to fit the opening in the body of the guitar. I traced the fiberboard insert that came with the guitar and cut out the circuit board with a jigsaw. Then, I used scotch tape to protect the copper on the circuit board where I wanted to leave the traces. I bought a bottle of ferric chloride at Radio Shack. Ferric chloride is commonly used to etch circuit boards; it completely removes the copper when applied either with a sponge or as a bath. The ferric chloride reacts chemically with the copper. I think it makes cupric chloride and iron particles. In any case, it removes the copper anywhere it is not protected and creates a sludge on the sponge or in the bath.
There are several ways to create precise copper traces on a circuit board. All require some chemical or device to protect the copper (that has been applied to the epoxy base of a circuit board at the factory) and “resist” the action of the etchant. I used scotch tape, applied carefully but by eye, for the LED board, but it is more common to create a precise layout with a computer drawing program, and print out a precision copy of the pattern of traces. 
I used a photographic process, using a photo negative and special chemicals to sensitize and develop the circuit board, when I made circuit boards as a teenager (I drafted the board layout by hand, using special decals and precision-cut tape). While researching products for the guitar, I discovered a special paper for laser printers which could then be used with an iron to transfer the toner onto the board. After peeling off the paper, the toner-traces were protected with another product, an iron-on plastic film. Since I had a laser printer and it seemed to be a simple process, I bought a new iron and packages of the papers. 
A “Sharpie” pen can also be used as a resist, although I discovered that only a black pen works, and not as well as one might hope. Finally, one can paint fingernail polish on the copper to resist the etchant. I used a Sharpie and fingernail polish to touch up spots that didn’t completely bond by using the special paper process. In this way, I made the boards that I needed.
After etching the boards, I had to drill holes to insert electronic parts and connectors (all of these are collectively called components). Some parts have to be soldered before other parts could be inserted. For example, it is easier to solder all of the surface-mounted devices (SMDs - usually really tiny parts with lots of legs that have to be soldered to the top of the board without creating any bridges of solder between the legs) before anything else. You have to be careful in soldering, as keeping heat on any part for more than a few seconds can damage the part, rendering it unusable, but the solder has to completely melt and the part has to be hot enough for the solder to properly adhere. It’s a balancing act that requires practice to do well. I like building really intricate circuits that call for lots of SMDs. I think they are pretty and I like to show off my talents by using them. I draw like a jittery four-year-old; this and sewing are the only really artistic endeavors in which I am successful.
I was lucky; the circuit board with all of the LEDs on it had to be covered by Plexiglas to protect the circuit from the fingers of the guitar’s player. Otherwise, the bare LEDs would bend or break in the process of playing the guitar. I found some spacers, pieces of cylindrical plastic cut to a specific length, that I thought might work to hold the clear plastic away from the circuit board at the MIT flea market. I cut out a piece of Plexiglas to fit the opening but it cracked and a bit broke off. Plexiglas is rather brittle; it wouldn’t do. I found some Lexan at Home Depot. Lexan is another type of clear plastic sheet. The Lexan wasn’t very thick, about half of the thickness of the Plexiglas, but since Lexan is made from a different kind of plastic, it isn’t at all brittle. Thick pieces of Lexan are used to make bullet-proof windows. This piece was thin enough to be a bit flexible but I thought, once it was attached by the spacers to the circuit board, the whole thing would be stiff enough to protect the LEDs. When I sandwiched the LED circuit board, the spacers, and the Lexan with some machine screws and nuts, it fit exactly into the opening on top of some blocks that had been glued into the guitar by whoever had removed all of the wood before I received the guitar. The top of the glass precisely matched the top of the guitar’s edge; the height of the “sandwich” was perfect for the location of the blocks. I couldn’t have made it fit better if I’d planned it! Sometimes, you get lucky!  
I wired all of the circuit boards together into the back of the guitar, so I sent it off for final set up. When I got it back, all I had to do was program the chip and wire up the battery. I’m a little intimidated by power systems, probably because I’ve accidentally touched house-voltage twice, once as a really little kid. When I was about seven, I discovered (the hard way) that our kitchen wiring had improper grounding when I simultaneously touched the oven and the refrigerator. I had been standing on a step-stool, trying to get some turnovers out of the oven when I touched the refrigerator for balance as I opened the heavy oven door. The power to the appliances flowed through my body; I was knocked unconscious and blown clear across the kitchen! Ever since, I’ve been very suspicious of hooking up the power in anything.
I had thought for a long time about how to brace the battery. I didn’t want it rattling around loose in the back of the guitar, where it might short out and damage something. Originally, I thought I might use some plastic straps to hold it in place but there was nowhere to mount straps. Next, I thought I would put a piece of aluminum on the back, under the mirror, to have something solid to attach straps to. I didn’t like this idea because the only aluminum I could use was very flimsy. Finally, I switched directions and decided to mount the battery in a hole in a block of foam. I bought a piece of foam at the local sewing store; I cut it with a serrated knife. The block was too thick so I sliced it in half. The revised block fit very well, so I inserted the battery and got ready to wire it all up.
I bought a connector block, wired the power switch, and soldered the special connectors for the battery onto some wires. Finally, I took a firm grip on myself and hooked up the battery. I didn’t want to do it on my kitchen table, where I had done almost all of the rest of the project, so I did it in the company of some fellow geeks, who were watching to make sure the “magic white smoke” didn’t appear to curse the project! The guitar was fine but the program still needed some tweaking.
Both Jack and I used a storyboard to figure out the programming for the patterns. His program allowed each pattern to have ten “steps”. For each storyboard, we drew ten little guitar shapes and colored in the areas where we wanted the lights to be turned on. Each step was slightly (or very!) different from the last. The program would then repeat. One pattern consisted of only the leftmost bar of the body turned on for step one, only the adjacent bar turned on for the second step, then the third bar for the third step, and so on for eight steps. Step nine had the whole border turned on and step ten was all black with none of the lights turned on. The pattern then repeated as long as the switch stayed in that position and the guitar was turned on, so the light moved across the guitar, flashed the border, went black and repeated. The speed is determined by the speed knob. We each came up with twelve different patterns of lights, each pattern having ten steps. Jack’s patterns were very complex and looked chaotic in execution. I made very simple patterns. They look better. Simple is often clearer.
Jack wrote a very clever program to determine how the microprocessor would interpret the controls and to turn on the lights that included a matrix of binary numbers. Binary numbers consist of ones and zeros (we normally use decimal numbers, with ten different numerals – binary only has two numerals). He used two eight-bit numbers (bytes) for each step, so each line had twenty bytes, separated by commas. Each line controlled a single pattern, so there were twelve lines in the matrix. The first byte controlled the body; the first digit was the first bar, the second digit was the second bar, and so on. The second byte controlled the border. Since the border only had six segments, the left-most digits of the byte didn’t matter, but each segment was controlled by a specific digit. A one turned on the lights for that segment in that step, a zero kept the lights off.  You call this kind of matrix a bit-map. I just had to alter the bitmap to alter the patterns, not the entire program. This was a nice piece of programming; Jack is a talented programmer.
I have a dedicated Picoduino board with a cable to connect it to my computer. Using it, I can upload a program into the chip in the board, then carefully pry the chip out of its socket and plug it into the socket on the guitar logic board. This is how I update the program in the guitar. I can reuse the chips; the old program can be erased and a new program inserted by simply uploading a new program into a previously used chip.
Chips can only be inserted into sockets in one direction; if you put it in wrong, you can ruin the chip. I’m always very careful whenever I insert a chip. Chips are marked on one end, and I always put an index mark on my circuit boards, although sometimes, the index mark is pretty small!
I’ll take some photos to illustrate this and add them in a day or two. I hope this explains some cryptic portions, and the photos should help!

No comments:

Post a Comment