Previous 10

Jun. 25th, 2007

meh

I wound up spending a ridiculous amount of time just getting the Delcom driver to work on OS X. The program was written years ago by an Apple developer, and a lot has changed since then. There were a few minor problems that caused me a great deal of headache.

For instance, there were a few lines of code that checked for null values using the tried and true:

if(something != null)
    doSomething();

GCC kept complaining that I was using an object in a mathematical operation. I wasn't having much luck finding anyone else on the internet who seemed to have the same problem. Once again, Tom came to my rescue when he commented that he always used the form:

if(!something)
    doSomething();

I think I wasted roughly two evenings just getting the Delcom drivers to compile, and that wasn't the last time that Tom would ride to my rescue.

Advertisement

The software

Even though the project was born out of a need at work, I decided that I would target the Mac platform first. There's no good reason for this decision, other than the fact that I love Macs.

My original design idea was actually to calculate the number of windows open on the system at any given time, and change the light based on that figure. There's actually a major distinction between how many windows you have open, and how many applications you have running. I was violently opposed to polling the system for status changes. I demanded that the light changed instantaneously when a new event occured.

My friend Tom recommended that I check out the NSDistributedNotificationCenter feature in Cocoa. This is a class that is available to all applications, and allows you to get some pretty interesting information from your computer such as when a new application is launched or the computer is preparing for sleep. Unfortunately, it doesn't allow you to find out how many windows are open on the system.

Tom also gave me some applescript code that would enable me to count the number of open windows on the system, but I insisted on using notifications. I was certain that other programs, such as Mail.app and iCal would post useful notifications that I could use to determine the number of unread emails, scheduled appointments etc

Progress

I set out in search of a novelty stoplight again. By now I was certain that I could complete the project, and it was time to get the rest of the hardware on order. I selected a generic looking Random Flashing Traffic Light  from www.blacklight.com despite never having heard of the company.

It was time to focus on the software.

More disappointment

Now that I had a working USB interface and a means to control lights through it, I started to think that this project might actually become a reality. I really needed this to become a reality. I needed something in the "win" column to boost my self esteem.

And now that success seemed reasonable, I started thinking about the software. The Delcom USB module came with Windows drivers, but I was curious if Mac and Linux drivers were also available. I use all three Operating Systems in my home, and I am a huge advocate of interoperability. I quickly found a sample program for Mac OS X that used the IOKit Framework to communicate with the Delcom USB controller, and I found several open source Linux drivers on sourceforge.net.

But it was an entry on the main page of the Delcom site that intrigued me the most. On the front page of their site, labeled "New" was a set of USB Traffic Indicators. I was simultaneously overjoyed and disappointed. On the one hand, it was like having your lunch money stolen by your best friend. The very same people whom I was using to develop this product, had coincidentally stolen the rug right out from under me. On the other hand, it was a sense of validation that I was really onto something here. Delcom was charging $54 for a three color lamp like mine. It was the first time that my wife finally took note, and realized that maybe my idea wasn't so crazy after-all.

I must have stared at the page for 30 minutes. Living in the state of mixed emotions. Then, true to form, I noticed something. Check out the picture below:



Either that's the world's largest USB connector, or that thing is the size of a freaking keychain! What gives? Is that thing seriously three LED's in a tiny little case? I was more inspired than ever before to finish this project and share it with the world. I was convinced that there would be an interest in a product like this.

Advertisement

Back in business

Now that I had stumbled across a circuit that would drive my light bulbs from a DC voltage, I finally decided to troubleshoot the USB Interface board.

Now, I'm telling you this because I want you to know exactly how stupid I can be sometimes. I had shelved the USB Interface board for an entire week because it didn't work, and I was certain that it would be weeks of probing before I would be able to find the single cold solder joint responsible.

This time when I pulled the board out, I noticed something. Look closely:



I want to note that I assembled this board (well, not this board, exactly. This is a product shot - but you know what I mean) with my own two hands. I am going to admit to you right now, publicly. I did not realize that those headers acted as jumpers. Thankfully, it dawned on me this time. I quickly snatched up a handful of jumper wires, ran the demo program included with the board, and like magic I had a working USB Interface board. It would have only taken a moment of probing before I realized what the jumpers were for, but I had allowed my procrastination and fear of failure to stand in my way yet again.

It was not my finest hour.

Lucky me

So, at this point I can't find a reputable seller for the novelty store traffic light, I have no idea how to power three individual light bulbs from a 5VDC device, and the project was shelved due to technical difficulties with the USB Interface board.

Basically, the project was totally finished.

My work had asked me to install some new cubic scanners, these fancy devices that measure height, width, depth and weight and transfer the information to a PC. Our software is configured to read the input from the devices and automatically assign the information when new gear is scanned into the warehouse. Unfortunately, these fancy new devices connect through an old school RS232 serial cable which, of course, did not come with the scanner.  I hate ordering anything through the Marine Corp. It takes weeks to get anything, and you have to justify everything. I decided it would be easier to stop at the electronics store on my way home and pick one up for a couple of dollars (or couple of hundred Yen).

Whenever I go to the electronics store I'm compelled to stop by "kits" section. I've always been attracted to electronic kits. It's something of an addiction. As a child I would carry around those old Heathkit (Zenith at that time) catalogs and fantasize about building my own computer. Alas, it was never to be. My parents would never pony up the dough for something like that and by the time I got my own job I discovered why they were so reluctant to part with the money.

Anyways, I'm looking through the kits. Which are all written in Japanese. When this kit caught my eye:



The kit itself was only the top board pictured. The other board was part of a separate kit. I didn't need to understand Japanese to figure out what this kit was for. It would allow me to control up to four light bulbs (100W was clear on the package) using the same DC signal that would drive an LED. I'm no electrical engineer, but I did recall a certain USB interface board that had four LEDs built in.

And just like that, my USB controlled stoplight was back on track.

Friends and Family

At this point, I should take a moment to mention the typical responses that you might get from your friends and family. My wife, bless her heart, has always been supportive of me, but I could tell that this project was a little much even for her. You know that look that your loved ones give you. It's the same look your parents probably gave you when you told them you want to be an astronaut. It's part love, party pity, and all sympathy.

The typical response from my friends was pretty much the same affair. "You want to make a what?" I simply refused to let this kind of thinking stop me. I knew that I wanted this device, and I hoped that others would find it interesting as well. To their credit, a couple of my friends did really enjoy the idea; and I knew who amongst my friends would find it amusing even before I pitched it. I know who my target audience will be. Watch this. I can say with 100% certainty that if you're reading this blog, you shop at ThinkGeek. There's a also strong likelihood that you also enjoy Make: Magazine and Penny Arcade. I know there are others out there like myself, and I know where they dwell.

Advertisement

Setbacks abound

I've stated before that the purpose of this blog is to outline my shortcomings. It was almost a month before I finally got around to soldering together my USB Interface board, so this was probably sometime mid-May. I have a bad habit of procrastinating things like this. I think it's a fear of failure; a fear that I hope to alleviate via this blog.

The board didn't take long to put together, but after everything was assembled it didn't work. I was completely discouraged. It was such a simple design, how could I not solder a couple of dozen joints properly? I would have to probe out the board with my multimeter. Once again, I let my fear of failure takeover and the project was shelved once again. I had a sinking sensation that this project would never see the light of day.

Jun. 24th, 2007

Research

As luck would have it, I stumbled into the local library a few days later and noticed a novelty store stoplight hanging on the wall. The lights flashed randomly, and it ran on typical wall power. I was relieved to know that such products actually existed, and that I would probably be able to modify it relatively easily. Unfortunately I had absolutely no idea how I was going to drive 117VAC lights from my 5VDC USB port. I decided to worry about that later.

I went home that night and started searching for stoplights on ebay. There were actually quite a few of them listed, but most of them were being offered by dodgy distributors in Hong Kong. I've had bad run-ins with those organizations on ebay before.

I decided not to buy a light that evening. At this point I wasn't sure if I'd ever be able to actually complete the project anyhow. What on Earth would I do with that atrocious thing if I couldn't hack it into something more useful.

The USB Interface Board

Astute readers will notice that I first posted a link to the Electronix Express USB Interface board on my Tumblog way back on Mar 27, 2007. That's how long this idea was kicking around in my head before becoming a reality.

I haven't updated my Tumblog recently, but it generally gives a pretty fair indication of what types of projects I have brewing in my head.

Previous 10