Archive for the 'Programming' Category


So a quick update… (after successfully battling a pretty sweet cold)
This last week I finally got around to repairing the damage done to the powerbase. If you missed it, we were having some power supply issues and, long story short… a car literally blew up and emitted some of that good ol’ fashioned magic electronic smoke, a somewhat frightening experience i might add. Apparently the interesting-looking slot car power supply I found in Steve’s vintage boxes of scalextric stuff wasn’t rated properly for our track (even though it was labeled so) and ended up doing some damage. Fortunately, it wasn’t anything more serious than a trip to radio shack and plugging in the soldering iron.

I’ve been working a lot on reviewing the code I wrote back in July and trying to get a hold on everything again. After a lot of thinking I’m pretty sure that the fixes I have made to the framework (Data retrieval and basic car variables) will be a hell of a lot more stable than it was in the past. I wanted to be sure of this because if something isn’t working right at this fundamental level, it could throw off everything I do from now on. I also came up with a new model for the entire system that I think will work quite well, utilizing a Server / Client relationship. The PowerBase is connected straight to a networked “server” that can feed as many client computers / monitors / projections as needed. Here’s a quick illustration:

The current run-down:
-Repaired PowerBase (New Resistor for Lap Sensor)
-Reworked Data Retrieval Algorithm to be more stable
-Data processing now runs on its own Thread:
  +Sends raw data to network clients over OSC
-Reworked car code to make use of all possible variables
-Working on rough HUD and text output for car variables
-Experimented briefly with race “recording”

Currently have access to:
+Reliable throttle (raw, smooth, and normalized versions)
+Both Lane and Brake buttons functional
  (No longer interfere with throttle numbers)
+PowerBase & Processing estimated Lap Times (Previous & Current)
+Reliable Lap Counting
+Approximated instantaneous and average speed (1:1 or 1:32 scale)
  (Likely needs tweaking)

-Running Average Lap Time
-Running Average Speed
-Fastest Speed
-Fastest Lap

Will post some pics of the HUD output as it develops.

Sketches: Experiments

Here are some screenshots of ongoing sketches / concepts for visualizing data off of the track.

The first concept was to mimic the relationship of the car’s relative position on the track (in this case by drawing a continuous oval/spiral) and tie that in with the car’s current throttle. In this way we can get a sort of “histogram” of the entire race.

Oval concept using random data:

Using throttle input (changing colors per lap)

I tried something a bit different using strips of color, almost like a line graph. In this way it might be easier to visually distinguish a faster laptime based on the length of the color strip:

Video: Data Retrieval


Data Time.

After being sick for no explainable reason, I finally got around to posting some pictures of the progress I’ve made in getting information from the powerbase.

Testing Area, and pretty much the smallest track circuit you can set up with this kit

Testing Area, and pretty much the smallest track circuit you can set up with this kit

I set up a testing area in my room so that I could run some cars and still be close to my desk. A piece of plywood is pretty high-tech, I know..

PowerBase is powered-up and ready to unleash its magic

PowerBase is powered-up and ready to unleash its magic

I found a power supply in my basement that works great for the time being. The Aux Port is really just a typical phone jack outlet, so I wired a phone cable up to this:

Don\'t mind the shoddy looking tape... It\'s a Prototype!

Don't mind the shoddy looking tape... It's a Prototype!

Underneath the electric tape is a small fuse which should prevent me from blowing up our precious powerbase if there is any accidental mishaps/crossed wires. This is a 9-pin serial adapter that is typically found on PC’s. However, Mac computers don’t have these kind of connections (only USB/Firewire) and need this Serial-USB adapter:

This plugs into laptop USB port

This plugs into laptop USB port

I got this a while back from Amazon, and it works great!

Basic sketch that retrieves and plots data in real-time.

Basic sketch that retrieves and plots data in real-time.

I wrote a quick sketch that plots the data coming from the powerbase. This shows the input from the hand throttle and you can also see the strings of numbers on the bottom which is the data in its raw form. Now just have to figure out the interesting things we can do with this data!

Computer Controlled Slot Cars Anyone?

Computer Controlled Slot Cars Anyone?

I also finally received some electronic samples I ordered a while back. The black chip is called a “digital potentiometer” and acts as a digital version of a hand throttle. I hooked this up on a Basic Stamp II Development board I had lying around (Similar to Arduino). It receives data from processing and sends a signal through the plug I’ve wired up. Sweet.

Also got the beginnings of a network/internet controlled car basically running (still buggy). Things are finally moving along!

Good News

Lets talk about some good news…

Today, I continued some work on the simulation sketch. Currently it simulates four “cars” (rectangles) that have specific attributes (location, speed, laps remaining, race standing.. etc). The rectangle travels across the screen, simulating a lap completion when it reaches the far edge, and then cycling back to the beginning again. These “cars” are fed their speed data via an on-screen slider control. This allows you to modify the speed of the car in real-time much like what the physical hand throttle does on the track. The next thing to do on this is figure out issues such as lap timing and race standing, as well as a simple way to interface this sketch with others that will use the data.

Now for the REALLY good news!…

After playing around with the physical track & powerbase for a while, I figured it was time to get this thing to spit out some data. Although, I was missing a couple of pieces of hardware that would make the data stream more reliable (MAX233 Serial Driver), I figured “what the hell,” and attempt to see what it would give me anyways. I wired everything up… checked all connections… opened up processing… crossed my fingers… and flipped the power on.

The research on this thing finally payed off. I was seeing the numbers I needed to see. And after staring at the data for awhile, I managed to code a parser to organize the information into a usable form. A couple of hours of programming later, I now have instantaneous feedback on the hand throttle’s current position as well as a simple plot of its value over time. And I also decoded the elapsed lap time data that is triggered every time the cars pass over the finish line.

I have to admit… this is extremely cool and absolutely amazing, and only reinforces all that is nerd within me.

Pictures, Screencaps, and possibly video to follow…

Day 2 – Going through my head…

I have a couple of things that are currently going through my head:

It’s obviously incredibly hard to envision what this project is going to end up looking like in its final stages. (compounded by the fact that I haven’t even seen “the track” in person or know what it is capable of) But it’s still interesting to imagine the possibilities. I’m at a loss for what I will create visually and what purpose it will serve… Although, I’m sure this will manifest in the coming weeks when I begin to actually play around with it.

Still on my sound/audio mind binge from working with my senior project, I have a slew of ideas for little sound reactive processing sketches. Anything that deals with the hand throttles to cars crossing the finish line to create some sort of soundscape/musical piece, could end up being an interesting auxiliary element.

As for actual processing programming I might do in the near future: I may put in some time to set up a small sketch/program that acts as a “Track Simulator” that will be able to interface with any future sketches I make. This might make it much easier to share processing sketches and ideas without needing the actual Scalextric Track on hand. As for how to go about doing this, I need to do a bit more research and thinking.