Wednesday, May 27, 2009

Xbox Media Center: ccxstream

So I modded my xbox a while back, basically turning it into a media center. I keep TV shows, movies, and games on it. It's pretty handy. Any way, it only has a 200 GB hard drive in it, and a while back I discovered a program called ccxstream that allows me to use another computer as a media server, thus making the xbox's hard drive as big as any server it can connect to.

Any way, after upgrading to 64 bit Ubuntu a while back and trying to run ./ccxstream from command line, I got this error:

bryan@SERVER-UBUNTU:~/$ ./ccxstream
./ccxstream: error while loading shared libraries: cannot open shared object file: No such file or directory

I've gotten this error before and since then forgot how to fix it, so I'm putting it up here in case I one day forget again. The fix for this problem is to install the appropriate libreadline file, which can be done by:

bryan@SERVER-UBUNTU:~/$ sudo apt-get install lib32readline5
Reading package lists... Done
Building dependency tree
Reading state information... Done
lib32readline5 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

The key is that it's the 32-bit libreadline file. The one the 64-bit OS looks to is the 64-bit readline file, which my version of ccxstream doesn't like.

Tuesday, May 26, 2009

Something I Worked Out While Driving My Truck

OK so this is probably not going to have any pictures, but I need to get this down somewhere. I was thinking about Chase's Eclipse, and how the relay circuit I built was pretty big since I used relays instead of an IC. The reason I chose to go with relays in the first place is because I couldn't figure out a way to get an IC to tie into a real-life circuit. What I mean by "real life" is a circuit that has voltage AND current. And yes, I know that there is a little bit of current in an IC, but never enough to really work with. Definitely not enough to trip a relay. So the question I had always wondered, was how do you get a circuit at 5 volts and almost zero current to do anything useful?

I think the solution involves finding a field-effect transistor with a cutoff voltage (or "cuton" if it exists) of 5V. Then, tying the IC output to the gate of the FET and using the source and drain as the "switch" for the main circuit. FETs can usually handle exponentially more current from source to drain and only need a voltage at the gate to turn them on or off. I think this is a perfectly good solution to minimize the scale of Chase's circuit and increase reliability. (Relays wear out after about 500,000 operations.)

But any way, last night Chase and I were working on the Eclipse and remembered that the rear center plate that actually says ECLIPSE is the stock plate, and it's tinted red. So no matter what color the lights are on the inside, on the outside they'll be red. So this pretty much negates the need for the circuit whether it's built from ICs and FETs or from relays. We're still going to put 7000 mcd white LEDs back there, only they're just going to be wired straight into the brake lights and that's it.

More on that later.

Saturday, May 23, 2009

Felicity's Floor Mats and Shift Knob, More from Sue

So I ordered new "Z" emblem floor mats for my '92 Nissan 300ZX. The ones that were sold to me with the car were cheap generic rubber floor mats, and there can't be any of that in a car that is nearly a classic. To the best of my knowledge, the 300ZX came with mats that said "300ZX" up until '92 when Nissan switched to the "Z" emblem. They look pretty sleek, especially compared to the old mats, and really round out the interior.

I also bought a new shift knob. The old one's leather was wearing off and that's something that also needs to be fixed. The stock shifters had black stitching, and this one has red, which I think is a nice touch. I think that the JDM 300ZX had red-stitched shifters but I'm not sure. Any way, it looks pretty good.

This picture shows how badly I need to pull out the 10-CD changer that some idiot did a very poor job of installing. The plan is to get some black plastic to cover that panel in the dash and have a friend of mine engrave "300ZX" on it.

This was just a good picture, showing the new shifter and the new passenger side floor mat.

I also finished Sue's trunk liner a while back and only just now got around to putting pictures up. It's gotten a good bit of use since I installed it, and with all the stuff sliding around on it, it seems that I'll be carpeting it soon.

Monday, May 18, 2009

Hit the STOP button!

OK first of all, for my one reader, which is probably just me (and maybe Bradley) but that's ok since I only really made this blog (interesting post-production note: the blog's spell checker thinks that "blog" is not a real word) to keep myself in line any way, I know I haven't been up on things. I've been working on "The" Power Supply for Relay for Life, where I was on a team with the company I work for, which just so happens to be the power company. We weren't allowed to use generators so I mentioned I had a non-generator/silent power supply we could use to run lights and a projector. This plan was highly successful and somewhat ironic, when the actual power to the high school we were at went out and the power company team at the Relay for Life were the only people with lights on. Anywhere.

Any way, I'm not sure yet if I want to put the power supply up here, despite the fact that it's probably the coolest thing I've ever built. That project took up a good bit of time though, along with the fact that I was also working on an air conditioner for my car (Sue) because she doesn't have one built in. But I might put pictures of that up sometime.

On to better things! As you all know, I have a '92 Nissan 300ZX named Felicity, and up until recently I thought I could modify the the stock rear center panel to look something like this:

Any way, the stock center panel lettering is actually silver paint on a black backdrop. I did not think that was the case. On the other hand, my buddy Chase's '99 Mitsubishi Eclipse has a backlightable rear center panel:

[picture of this later]

The idea for my Z was to run a set of red LEDs off of the brake light wire, and a set of white LEDs off the tail light wire. In the Z (and apparently most Nissans of that era) there's separate brake and tail light circuits that never operate simultaneously. So when the brakes come on, the tail light circuit voltage drops to zero. This would be easy to wire up.

The Eclipse, not so much. The tail light circuit stays on all of the time, and the brake lights come on as needed. So simply moving the circuit design from the Z to the Eclipse wouldn't work because the white and red LEDs could be on at the same time. No one wants this.

So I said to myself, "Hey! How about some logic gates and what not?" and I replied "Yeah that'd be great, but none of my professors up in college taught us how to actually use ICs in a real life circut to run anything useful, they only just taught us the inner workings of logic gates just in case we went into the bustling industry of logic gate fabrication." Then I told myself I'd figure something else out than some lame integrated circuit. I mean, I am an electrical engineer, after all, and when we build computers (or logic) we do it almost 100% with hardware. No one wants to see any software. That's slow, and boring. So, this is what I did:

I bought three 40A relays. One is an 8-pin DPDT relay from Radioshack. The other two are standard four-terminal automotive relays. The plan is to use the 8-pin relay as a NOT gate which would be connected as a "normally closed" relay connected to the brake wire. Then, the other two relays would be connected in series to form an AND gate. One of the relays would accept input from the "normally closed" relay from the brake wire and the other would be wired up to the tail light wire. Basically, this is the logic implemented:

The brake light is connected to the top input, and the tail light to the bottom input. The white (tail light) LEDs are connected to the output. When both are on (when the tail lights are on and the brakes have been applied) the NOT gate tells the AND gate to output a logic-0, which turns the tail lights off. Otherwise, with the brakes off and the tail lights on, the AND gate outputs a logic-1 which turns on the white LEDs. Meanwhile, the red brake LEDs will be wired straight into the brake light circuit. The only logic needed is to tell the white tail light LEDs to turn off when the red brake light LEDs come on.

Here is my circuit diagram of what I planned to build. The relays are numbered 1-3 and labeled "normally closed" or "normally open." In the picture after this one, relay 1 is the relay on the top left, relay 2 should be the relay on the top right, and relay 3 should be the relay on the bottom right. More or less, relays 2 and 3 are interchangeable. The actual circuit ended up not being wired up exactly like this, since my idea of where a +12V DC voltage source should be were off a little. But you can see my changes now:

Definitely rocking the free prescription drug post-it note pad. NOTE: When this circuit is moved to the Eclipse, the 12V DC sources connected to switches labeled Bs and Ts will just be wires tapped into the brake/tail wires. This was a drawing of the circuit model, not the circuit that will be put into practice. The resistor labeled TL is the tail light LED, the brake light LED is not pictured in the drawing because it is so simple to wire up. And... I don't know if that's actually the symbol for a relay, but that's my artistic interpretation of what it does. Although I guess you wouldn't actually call it "art" since it's useful and makes sense. But I think it's neat. The circuit I drew up makes sense to me, and that's what's important. ALSO IMPORTANT: A fuse, or many fuses, must be built into this at some point.

But any way! This jumbled mess is the circuit that I physically built:

Actually that picture had two misconnected wires. Also, the breadboard has a bunch of other junk on it from previous projects that you may or may not remember. But I fixed all the problems and the circuit worked amazingly well, after I wired up a 12V DC rectifier to the circuit so I could just plug it into the wall to test it. Any way, the red test LED came on when the brake switch was in the GO! position regardless of whether or not the tail light switch was in the GO! or STOP! position. Likewise, the white LED was on when the tail light switch was in the GO! position but only if the brake switch was in the STOP! position. You get the picture.

I tried taking pictures of the lights with the switches in various positions. That just washed out the pictures, and it was impossible to tell what color light was on. Any way, more on this when Chase and I actually put the circuit in the car and get real lights for it.


I'm going to start by throwing in a picture of the rear of Chase's Eclipse to show everyone what we're working with. It's a '99 model with a really big rear wing, but it's non-turbo. I'm not an Eclipse guy so I'm not really sure which version of the Eclipse it is. I also like how you can see just a little bit of my 300ZX in the background.

Any way, here's the rear center panel from Chase's '99 Mitsubishi Eclipse. The plan has been to backlight it somehow, and now we're going with a simpler single-color design which does not involve any relays, transistors, or ICs. Kind of boring, but it'll look good when it's done. This next picture gives a general idea of how much light comes through the center panel.

The back of the rear center panel was covered in a silver mesh. We sanded it down pretty well to remove as much of it as possible without losing the textured effect. The more light that can come through, the better.

The next post should be us finishing it up. I just wanted to get these pictures up here.


All right! This one looks pretty good when it's finished so hang in there.

First thing's first. We started out by measuring where the lettering was in relation to the back of the panel and drilling the holes. Chase made a measuring error here but it ended up working out. We had ten 7,000 mcd white LEDs from Radioshack, so we were going to drill ten holes. Well, Chase measured and divided and marked eleven spots somehow. So we decided to use nine LEDs to everything would still center up (leaving the two on the end out.) The picture above shows the LEDs installed in the plastic backing of the rear center panel, which more or less just snaps back together.

This picture shows the underside of the panel, with the LED leads sticking out of the back. We made sure that all the anodes and cathodes of the LEDs lined up to make it easier to wire. We started with an aluminum grounding rod because I thought it would be easier, but aluminum oxidizes really fast if the soldering iron gets near it. We eventually removed the aluminum grounding rod in favor of stranded 16-gauge copper wire. Probably a little more work but it did the job right.

The next step (even though I'm writing it somewhat out-of-order from how the pictures show, but it happened in the way I'm writing) was to solder in the current-limiting resistors. Since diodes have [essentially] no resistance, simply connecting them to a power source would cause a short-circuit, which would definitely ruin the LED and potentially damage other things. The resistor values are calculated by:

(available power source voltage) - (voltage drop across LED) = (LED rated current) * (resistor value)

In this case:

12V - 3.3V = 25 mA * 348 ohms

The available power source voltage (car battery), voltage drop, and rated current values should all be known. The manufacturer of the LEDs should definitely be including the current rating and the voltage drop.

Apart from that, I'm doing this math from memory, so that's at least the general idea. The resistor color codes are clearly shown in the picture so I might be changing this later on. It is important to note that Radioshack doesn't just have a 348 ohm resistor laying around, so I believe we went with sets of 320 ohm and 20 ohm resistors.

Also important to note is the power that will be dissipated by these resistors. The current that will be drawn across the resistors is known, and using P=IV and V=IR, we can deduce that

P=I^2 * R, and since I=0.025A and R=320 and 20 ohms, we can show that the most power any resistor would dissipate is about .21 watts. This is why we chose quarter-watt resistors.

After we finished tying up all the lose ends, we cut off one of the bolts on the center panel and used the now-freed hole in the body of the car to run the wires back in. Then we cut a 5-amp fuse in line and tied it all into the brake wire. This is the result:

Awesome. I especially like how it kind of looks like an actual eclipse. (The event, not the car.) The camera I use sucks for taking pictures of lights, so imagine a better version of how this looks and that's actually how it looks. Also, it wasn't quite dark outside, so at night the lights will appear to be much brighter. Maybe I'll get to take a picture of that later on.

As a side note, you can see Sue a little on the right. She has a fresh coat of wax and is extra shiny.