Friday, April 18, 2008

The Speed of Sound

Most instrumental guitar albums from the 80s are pretty much unlistenable now. Most of them were pretty unlistenable then, even if you were high on testosterone and Stridex acne pads.

I'd make the case for Ronnie Montrose's Speed of Sound as one of the few exceptions to that rule. I loved this album then, and it holds up today. Who the hell is this guy? Well, apparently he played with the Edgar Winter group (don't know if he did Free Ride or not), and had his own band (fronted by... echh... Sammy Hagar), but he is primarily known as an instrumental guitarist.

The album is from 1988 and features drum programming from the era where "the drum samples are good, but the dynamics aren't there", and mostly electronic, sparse accompaniment. The guitar sound is Heavily Processed, from an age where guitarists had eschewed the pedals-into-amp approach in favor of the rackmount Guitar Processor, lending the tone copious amounts of reverb and distortion that actually did not model any kind of amplifier or pedal, but was its own entity. It's a warm, fuzzy sound that in this case, doesn't sound "loud". You can put this album on and not want to put blankets over the speakers.

The playing is restrained and tasteful (as it gets for the genre). Very few wheedlie-whees, mostly simple melody lines and embellishments, with a good bit of emotion. I remember reading an interview with him in Guitar Player where he said his hand was healing from slicing it open with a knife, so recording the leads involved a significant amount of pain, which might explain the lack of pyrotechnics and the emotion-charged bends.

All of the songs have spacey names like "Outer Marker Inbound", "VTOL", and "Zero G". There's even a cover of the Ventures' "Telstar". Here's a sample from Amazon.

As with any album that was part of the soundtrack to your youth, I've lost all ability to judge it objectively. The songs put me back, waiting in front of the hardware store in the winter for my dad to pick me up from work. I'm listening to it on my new Toshiba walkman with auto-reverse and built in 3-band EQ. It's dark and snowing a little, and the guitar sounds perfect.

Thursday, April 17, 2008

Computer Dashboard, part 8 - All Done

Back to part 7

Well, here it is in its final form. I used Visio to print out a faceplate for it, and created some scales for the meters. Originally I was going to make a weather module that would scrape and return weather information to be displayed, but never got around to it.

I've had it hooked up to any number of computers since building it in 2005. It's currently working right now on my work computer. Only problem is that it doesn't move that much because I have such a beast of a machine that it's hard to tax it enough to push the CPU, Memory or Disk readings up. The Memory and Disk meters read pages/second, so they're not just measuring how much memory is being used in total, but the accesses.

It does impress people, though. You can send yourself an email and watch the email light glow, then read the email and watch the light go off. It was a fun project, and I sort of had plans to build quite simplified versions (say, a bobble head that starts going when you get new email or something equally insipid), but the cost of the USB I/O boards is somewhat prohibitive. And then I got interested in something else.

Wednesday, April 16, 2008

Computer Dashboard, part 7 - Software

Back to Part 6

The journey is almost complete. Just one last link in the chain. We've covered everything that happens after the signal leaves the computer via the USB cable, but how do we send the appropriate information to the USB board?

The USB board comes with a software component that lets you set the values of the pins via any number of programming languages. I chose C# because I had Visual Studio and the component was compatible. Comprende? I wrote a little C# program that queries the Microsoft system software many times a second as to the status of the CPU, the memory usage, disk usage, and network usage, and also whether there are any new emails. Here's a code snippet:

// setup of adapters and monitors
currAdapter = "CPUPercentageAdapter";
currMonitor = "CPUMonitor";
((Adapter)adapters[currAdapter]).Device = meters[0];
currAdapter = "CPUYellowAdapter";
((BinaryAdapter)adapters[currAdapter]).OnAt = 50;
((BinaryAdapter)adapters[currAdapter]).OffAt = 85;
((Adapter)adapters[currAdapter]).Device = yellowlights[0];
currAdapter = "CPURedAdapter";
((BinaryAdapter)adapters[currAdapter]).OnAt = 75;
((BinaryAdapter)adapters[currAdapter]).OffAt = 110;
((Adapter)adapters[currAdapter]).Device = redlights[0];

I structured the software around an Adapter and Subscriber model - an Adapter talks to one of the devices on the dashboard, and it can Subscribe to a Monitor. So if the CPU meter Adapter subscribes to the CPU Monitor, it will show the current CPU status. You can see in that code that I'm also setting some threshold values, so the CPU yellow light comes on at 50% usage, and the red light comes on at 75% usage.

All the gucky bits where you actually play with bits and do math and stuff are tucked away in the Adapter and USBDevice classes, so at the top level, you just hook up an Adapter to a Device, and Subscribe to a Monitor, and it magically shows up on the dashboard. The picture shows all the components in the chain.

Tuesday, April 15, 2008

Computer Dashboard, part 6 - Multiplexing

back to Part 5

I bought 4 meters and 4 LEDs and a box and came up with a layout. I figured that would be a good number of things to measure. Problem was, I didn't have enough pins on the I/O board. Each meter would need 5 pins dedicated to it, and each LED would need one, for a total of 24 pins. I only had 16 pins.

I thought about this for a while with no good ideas, and then, as is it so often does, a model railroading site came to the rescue. It seems to be dead now, but here's a cached copy. They had the same problem of wanting to control a bunch of stuff from a parallel port, with not enough pins, so they designed a parallel port expander using a gizmo called an octal latch.

An octal latch is kind of like a very small memory chip. It's called octal because it can store up to 8 bits of data. The way it works is, you signal the chip and say, "hey, I've got some data for you - here's 8 bits." The latch takes those 8 bits and outputs those 8 bits until you come back with some more data for it, at which point it forgets the previous 8 bits and starts outputting the new 8 bits.

So how does this help? Well, if we give each meter one of these latches, then we can run from latch to latch, setting values for each meter. In effect, we can use the same 5 pins on the I/O board to set each meter - we just activate one of the latches, send our 5 bits, the 5 bits get converted to a current, the meter displays that current. The 5 bits are held for that meter until we come back around to that meter and give it a new value.

Because we can cycle around many times a second, all of the meters appear to be moving simultaneously and independently, when in fact they are being set separately, one right after another. So now we can use 13 pins to set all of our meters and LEDs:

1 - activate latch 1
2 - activate latch 2
3 - activate latch 3
4 - activate latch 4
5 - 9 - 5 bits of meter output
10 - 13 - 4 LED outputs

Whew. Well, that covers all the "hardware" stuff. The latches, R/C networks and resistor networks were all placed on one breadboard, with a LOT of soldering. Because I hated to waste 3 bits on each latch, I decided to add a red and a yellow LED inside each meter to indicate some condition (medium value or high value), and piggybacked those onto each latch - so I actually ended up using 7 bits for each meter, 5 for the value and 2 for the LEDs. I put the LEDs inside the meter cases, and they glow from behind the meter scale.

Monday, April 14, 2008

Computer Dashboard, part 5 - Dampers

Back to Part 4

In the previous chapters we've seen how output from the pins of the I/O board can either switch an LED on or off, or move a meter. After doing some tests, I noticed that while it worked just fine, the output was rather "harsh". The LED was ON or it was OFF - immediately. The meter snapped with precision and speed to each position on the scale. Now, this might have been cool in the early 80s, when digital was new. But nowadays it's hip to soften the edges a bit and "fake" analog.

Witness the hypnotic sleep indicator on a MacBook - it fades in and out, as an incandescent lightbulb might do. So what I wanted to do was add some smoothing to my output devices - something to make the meter gradually move from one position to another, and fade the LEDs in and out.

This is very simple to do with a simple R/C network in between the output pins and the device. An R/C network is simply a single resistor and capacitor. A capacitor is like a very fast charging battery. (well, not really, but think of it that way). A resistor will affect how fast the capacitor charges. What this means is, when an output pin turns on, you can wire the resistor and capacitor in such a way that initially, most of the current goes into charging the capacitor, rather than into the LED. As the capacitor charges to full, more and more of the current goes into the LED. This results in a slow-on effect. When the pin turns off, the full capacitor discharges through the LED, resulting in a slow-off effect. Same for the meter - the capacitor will soak up current and release it during any change, resulting in a damping or slowing of any movement. The picture shows this - the input signal is the square spiky thing, the output is the gentle rampy thing.

I had to fool around with the resistor and capacitor values to arrive at the final configuration, but it's quite effective. Nowadays they're showing kids how to arrive at the same effect by programming microcontrollers. Sigh.

Friday, April 11, 2008

Computer Dashboard, part 4 - D/A Conversion 2

Back to Part 3

Gee, this is getting a little epic. Keath, I'm glad you're enjoying it. Or at least reading it. So. We have a meter to swing, and a number of pins, each of which can output a set voltage. What we need to do is some binary math. For my purposes, I decided that my meters were small enough that setting them to one of 32 values was going to be enough precision. That meant I needed 5 pins to dedicate to a meter, because 2 to the 5th is 32. Got it?

No? Well, binary numbers represent numbers with just 2 values, 0 and 1. Just like in decimal numbers we have the "ones place" and the "tens place" and the "hundreds place", ie, 124 has 1 in the hundreds, 2 in the tens and 4 in the ones, binary numbers have the 1's place, the 2's place, the 4's place, the 8's place, and the 16's place, etc. So, if you are using 5 pins, you can count from 0 to 31, because 16 + 8 + 4 + 2 + 1 = 31. That gives me 32 values, so for instance, the number 10011 is 16 + 2 + 1 = 19. (n-n-n-nineteen).

Got it? Well, go google it or something. The point, is we need some way of making pin 5 "count" more than pin 1. When pin 1 changes, we only want the meter to move by 1 unit. When pin 5 changes, we want the meter to move by 16 units. The way to do this is with a resistor ladder. As shown in the picture, each of the 5 pins will connect to the network from the bottom, and there is one output, to the meter. Pin 1 will be connected furthest from the output (marked LSB on the diagram), so as the voltage from that pin makes its way across all of those resistors, it will be dropped until it contributes very little to the total at the end. Pin 5 will be connected nearest to the output (marked MSB on the diagram), so the voltage from Pin 5 only has 1 resistor in its path to the output, and will thus influence the voltage, or current, at the end, much more. (Resistors drop voltage, by the way).

That's it - that's how simple a digital-analog converter can be - a bunch of resistors. Going the other way - not so easy.

Thursday, April 10, 2008

Pollen Nation

It's pollen season here in the south, and here in the south, pollen is not just an abstract thing that floats around and makes allergy sufferers complain. Oh no, it's a fine yellow dust that coats, I say coats, everything. These pictures really don't show you the full scope of the coverage.

On the doorstep one you can kind of see footprints, and get an idea of what color the doorstep is supposed to be.

I'll have to upload another picture when it rains, when the streams and rivulets run bright yellow with plant spooge.

Wednesday, April 09, 2008


I am a huge Anglophile, so this storyline in Achewood is making me larf und larf. Keep clicking next, it's ongoing, and is still in progress.

The Shrovis-Bishopthorpe Envaliant III

Tuesday, April 08, 2008

Computer Dashboard, part 3 - D/A Conversion 1

back to Part 2

Meters work by swinging a needle in response to an electrical current. No matter what the scale on the meter says, "Degrees C", "Fuel Level", "Houseguests Offended", the meter only cares about one thing- when you feed it no current, the meter goes to (usually) the left, or Empty, or 0, and when you feed it the maximum amount of current, the meter goes to Full, or 100, or "That's a paddlin'", or whatever. So the meter needs to be fed a variable amount of current, in response to whatever you're measuring.

Now the ActiveWire USB board doesn't have the ability to output a variable amount of current. It has 16 pins, each of which can either output a voltage (5V, I think), or no voltage. So somehow, we need to take a number of those pins, and change various digital combinations of "off" or "on" into analog values, varying between 0 (no current) and 1 (the maximum amount of current).

Such a thing is called a digital-to-analog converter, and it's amazingly simple. This is the same way your CD player or mp3 player works (more or less). What happens is that you assign a number of pins to represent a voltage (which is then converted to current). The more pins you assign, the more precisely you can specify the voltage. Let's say you assign 1 pin:

1 pin
On or Off
Analog Values:
0 or 1

2 pins
Pin1 ON, Pin2 ON
Pin1 ON, Pin2 OFF
Pin1 OFF, Pin2 ON
Pin1 OFF, Pin2 OFF
Analog Values:
0, 0.33, 0.66, 1

The more pins you assign, the more precision you get in the analog signal. CDs use 16 "pins", or bits, and all they do is read 16-bit sequences from the disk, many times a second, and simply send that voltage level, or current, to the speakers, which results in a waveform, which is converted to sound.

Sunday, April 06, 2008

All paneled in

The ice fishing hut is all paneled in. Here are some pics from the outside looking in and the inside looking out. Still needs some backwoods pimpin', but it's nice to have a dust-free space to solder and do endless metronome exercises in. I also had to put my shop back in order as a side effect, so now I have no excuse to not get to all that stuff I said I'd be getting to...

Thursday, April 03, 2008

Computer Dashboard, part 2 - USB

back to Part 1

So, now that I had the meters and blinkenlights which would form the display, it was time to think about how the information was going to get from the computer to the display. I decided to start with the simplest case - how would I turn an LED on and off? To turn an LED on, you need a source of voltage.

The parallel or printer port used to be the tool of choice for doing this. You get multiple pins, each of which can be assigned to be either on (voltage) or off (no voltage), and there are multiple drivers which can help you set these pins from your software. However, the parallel port and its cousin, the serial port, are rapidly disappearing, replaced by the USB port.

As I found out, USB communication is not accomplished with a chip or two from Radio Shack. You actually need a license, which you must buy, in order to talk to the port, and talking to the port more or less requires a microcontroller on the other end. So it didn't look as though I was going to build one from scratch.

Fortunately, several companies sell boards that will plug into a USB port, and offer that same, tinkerer-friendly set of pins which can be assigned to on or off. The one I chose was from ActiveWire.

Once I got the board, I plugged it in, wired up an LED to one of the pins, and used the sample application that came with the board to turn the LED on and off. Success! Now I would have to figure out how to control multiple LEDs, and some way of controlling the meters.

Wednesday, April 02, 2008

Computer Dashboard, part 1

This is a project I built some time ago, but I thought I'd give it a write-up, since it's kind of interesting and maybe someone else will get some ideas.

The idea is to create an "ambient device", which is something that either connects to your computer, or to a network, and displays some kind of information in a way that doesn't involve your computer screen. For instance, Ambient Devices sells plastic orbs that light up blue or red, depending on weather forecasts or the stock market. Kind of a way to see information from the internets that isn't as useful or dynamic as having a computer, but looks cooler. Or different.

I wanted to build a device with panel meters (the things with needles that swing back and forth) to display information either from the internet or about my computer (like a car dashboard for your system - CPU utilization, disk utilization, network traffic).

I started, as I usually do, with the fun cosmetic junk - what kind of old meters could I find to go on the front. I went to my favorite store, Austin Electronics, to peruse their surplus meters, and found some edge meters that met my main criteria of "cheap". The big ones were surprisingly expensive. I also found some huge LEDs which I thought would make good binary status indicators ("do I have any new email?")