Thursday, December 30, 2010

Fun with Processing + Future project (IR thermal scanner)

I anticipation for my next project I've been looking at different ways to process and represent feedback from a digital IR sensor. I found this very nice tool called Processing. The tool allows me to write a piece of code that ca take multiple inputs (such as serial) and display it in anyway I want. As a sample test I decided to make a binary clock. A lot of this will be translated into my project such as the live updates and ellipse drawings. It's too bad I can't attach a java app to this blog so here's the code:

Processing page (http://www.processing.org/)

void setup() {
size(300,160);
frameRate(1);
}

void draw() {
//hh:mm:ss
//24:69:69
//23:34:34
background(50,50,50);
String s = ""+second();  // Values from 0 - 59
String m = ""+minute();  // Values from 0 - 59
String h = ""+hour();    // Values from 0 - 23
String time = ""+h+m+s;

println (time);

boolean [][] hs = digit(h);
boolean [][] ms = digit(m);
boolean [][] ss = digit(s);
digit_draw(2,3,33,0,hs);
digit_draw(3,4,33,3,ms);
digit_draw(3,4,33,6,ss);
}

void digit_draw(int d0, int d1, int sz, int xoffset, boolean [][]vs) {  
for(int i=0; i < d0; i++) {
        if(vs[0][i]) fill(255,0,0);
        else fill(0,0,0);
        ellipse(sz*xoffset+sz, sz*i+sz, sz, sz);
    }
    for(int i=0; i < d1; i++) {
        if(vs[1][i]) fill(255,0,0);
        else fill(0,0,0);
        ellipse(sz*(xoffset+1)+sz, sz*i+sz, sz, sz);
    }
}

boolean [][] digit(String v) {
  int h0,h1;
  h1=-1;
  h0=v.charAt(0)-48;
  if(v.length() > 1) h1=v.charAt(1)-48;
int ht=h1;
if(h1==-1) { h1=h0; h0=0; };
int sz=4;
boolean [][] d = new boolean[sz][sz];
String b0 = binary(h0);
String b1 = binary(h1);
//println (h0 + "" + h1 + " " + b0 + " " + b1);
for(int i=0; i < sz; i++) {
d[0][i] = d[1][i] = false;
}

for(int i=0; i < b0.length(); i++) {
if(b0.charAt(b0.length()-1-i) == '1') d[0][i]=true;
else d[0][i]=false;
}
for(int i=0; i < b1.length(); i++) {
if(b1.charAt(b1.length()-1-i) == '1') d[1][i]=true;
else d[1][i]=false;
}
return d;
}

Sunday, December 19, 2010

Custom Racing seat - impressions

So after many hours behind the wheel in my seat I decided that I did a very good job! Haha, yeah I'm gloating. Unlike some other make-shift setups that I have done this one was very comfortable and my back and legs don't hurt after getting up from a 4+ hour run.

My friend came over to test it out and before hand was skeptical of the placement of the shifter, that it would get in the way. After some adjustments (wheel hight/pull-in) he found out it worked really well. There is a lot less stress on the arms when using the H pattern shifter which is a benefit when doing competition racing. Unlike a "normal" setup where the shifter ball is higher than the center of the wheel, this one is much further down resulting in a relaxed arm position while shifting and adding quicker hand movement from shifter to wheel.

I was originally planning on attaching the seat to the box for those panic brakes (thought was that the box would slide away) but it turns out that the 70something pounds that is the box + controller stays put on carpet even under "stressful" conditions. This is a benefit to me since my cat likes to interact with the chairs soft fabric and I need to hide it :)

Some additions that were added are an extended top plank for a mouse just behind the shifter and side tray for keyboard for those PC simulators (LFS, iRacing....). I would imagine that if I wanted to extend this to a full-on simulator I could easily make a flight stick holder that would bolt right in, but that's to be seen in the future.

Monday, December 13, 2010

Custom Racing Seat

So after getting GT5 (and other racing sims) and not wanting to use the standard controller I decided to create a custom racing cockpit. The idea came to design & build quickly when a friend showed interest in having one as well. I plotted everything in sketchup (go google!) so that I could just cut and put together. What a time saver! I was able to determine that a single 4'x8' plywood sheet (oak covered) could fit the pieces. The nice thing about planning the way I did was I could determine where to cut with the hand circular saw and what can go on the table saw. In the end I did a single cut with the hand circular saw and with help did another on the table. After that all the pieces were very manageable! So after 7ish hours this is the product:

The wheel can slide up/down and in/out with the bolts. The seat is a real car seat with front/back sliding rails. When comparing to a pre-made simulation seat that's around $400 (seat + stand for controller and pedals) ... the cost of this is well worth the effort. The wood sheet was only $45 from Home Depot and the seat from Amazon. 

The touch up is to use the router and round all the edges so they are not 90 deg corners which are painful when hit! Maybe a touch of stain might do well?

Update: I used the router to smooth all the visible edges so there are no sharp corners. I also cut the bolts so that the threads don't stick out further than the hex-nut. These two modifications have made the appearance of the box much more appealing.