Pinewood Derby Timer

I am attempting to make an affordable pinewood derby timer for a 4 lane track. I’m using the Arduino Duemilanove controller, a lever switch for the gate, 4 optical sensors to detect the cars, and 4 of the 7 segment serial displays (COM-09230) to display the times.

My plan is to have the system be able to stand alone with the displays, or have a more automated VB front end that will display the times via screen. I will communicate with the displays using NewSoftSerial on the digital pins, leaving the main serial port for programming and hopefully the VB front end.

I have written some test code (see below), to try out the displays. When working properly, it will display 1234 in each display, and when a button is pressed, display only the decimal points.

The problem that I’m having is this. When I have the USB connected, it messes with the displays so that they do not display properly. If I disconnect the USB and cycle power, it works fine.

I tried to post some pics and links, but this is my first post, and the forum rules wouldn’t let me. I’ll try to follow up with more information.

I’d like to have both the displays functional and the USB connection available. I appreciate any help you guys can offer.

Thanks!

#include <NewSoftSerial.h>

int Lane_1Pin = 10;
int Lane_2Pin = 11;
int Lane_3Pin = 12;
int Lane_4Pin = 13;
int Gate_Pin = 9;
int Lane_1_LEDPinTX = 8;
int Lane_2_LEDPinTX = 7;
int Lane_3_LEDPinTX = 6;
int Lane_4_LEDPinTX = 5;
int Lane_1_LEDPinRX = 14;
int Lane_2_LEDPinRX = 15;
int Lane_3_LEDPinRX = 16;
int Lane_4_LEDPinRX = 17;

int test = 0;


NewSoftSerial Lane_1Serial (Lane_1_LEDPinRX, Lane_1_LEDPinTX);
NewSoftSerial Lane_2Serial (Lane_2_LEDPinRX, Lane_2_LEDPinTX);
NewSoftSerial Lane_3Serial (Lane_3_LEDPinRX, Lane_3_LEDPinTX);
NewSoftSerial Lane_4Serial (Lane_4_LEDPinRX, Lane_4_LEDPinTX);
//SoftwareSerial Lane_1Serial (Lane_1_LEDPinRX, Lane_1_LEDPinTX);
//SoftwareSerial Lane_2Serial (Lane_2_LEDPinRX, Lane_2_LEDPinTX);
//SoftwareSerial Lane_3Serial (Lane_3_LEDPinRX, Lane_3_LEDPinTX);
//SoftwareSerial Lane_4Serial (Lane_4_LEDPinRX, Lane_4_LEDPinTX);


// The setup() method runs once, when the sketch starts

void setup()   {                
  // initialize the Lane Signal Pins
  pinMode(Lane_1Pin, INPUT);     
  pinMode(Lane_2Pin, INPUT);     
  pinMode(Lane_3Pin, INPUT);     
  pinMode(Lane_4Pin, INPUT);  
  pinMode(Gate_Pin, INPUT);
  // Turn on Pull Up Resistor on Gate Input
  digitalWrite(Gate_Pin,HIGH);  
  //Initialize the LED Serial Pins
  pinMode(Lane_1_LEDPinTX, OUTPUT);     
  pinMode(Lane_2_LEDPinTX, OUTPUT);     
  pinMode(Lane_3_LEDPinTX, OUTPUT);     
  pinMode(Lane_4_LEDPinTX, OUTPUT);     
  pinMode(Lane_1_LEDPinRX, INPUT);     
  pinMode(Lane_2_LEDPinRX, INPUT);     
  pinMode(Lane_3_LEDPinRX, INPUT);     
  pinMode(Lane_4_LEDPinRX, INPUT);     
  Lane_1Serial.begin(9600);
  Lane_2Serial.begin(9600);
  Lane_3Serial.begin(9600);
  Lane_4Serial.begin(9600);
  
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()     
{  
  int delaytime = 0;
  int OneShotOn = 0;
  int OneShotOff = 0;
  
  test = digitalRead(Gate_Pin);

  if ((test == 1) && (OneShotOn == 0)){ 
    Lane_1Serial.print(1);    
    delay(delaytime);
    Lane_1Serial.print(2);    
    delay(delaytime);
    Lane_1Serial.print(3);    
    delay(delaytime);
    Lane_1Serial.print(4);  
    delay(delaytime);
    
    Lane_2Serial.print(0x01,BYTE);    
    delay(delaytime);
    Lane_2Serial.print(0x02,BYTE);    
    delay(delaytime);
    Lane_2Serial.print(0x03,BYTE);    
    delay(delaytime);
    Lane_2Serial.print(0x04,BYTE);  
    delay(delaytime);
   
    Lane_3Serial.print(0x01,BYTE);    
    delay(delaytime);
    Lane_3Serial.print(0x02,BYTE);    
    delay(delaytime);
    Lane_3Serial.print(0x03,BYTE);    
    delay(delaytime);
    Lane_3Serial.print(0x04,BYTE);
    delay(delaytime);

    Lane_4Serial.print(0x01,BYTE);    
    delay(delaytime);
    Lane_4Serial.print(0x02,BYTE);    
    delay(delaytime);
    Lane_4Serial.print(0x03,BYTE);    
    delay(delaytime);
    Lane_4Serial.print(0x04,BYTE);
    delay(delaytime);
    OneShotOn = 1;
    OneShotOff = 0;
  }
  else if ((test == 0) && (OneShotOff == 0)){
    /*Lane_1Serial.print(0x78,BYTE);    
    Lane_1Serial.print(0x78,BYTE);    
    Lane_1Serial.print(0x78,BYTE);    
    Lane_1Serial.print(0x78,BYTE);  

    Lane_2Serial.print(0x78,BYTE);    
    Lane_2Serial.print(0x78,BYTE);    
    Lane_2Serial.print(0x78,BYTE);    
    Lane_2Serial.print(0x78,BYTE);  

    Lane_3Serial.print(0x78,BYTE);    
    Lane_3Serial.print(0x78,BYTE);    
    Lane_3Serial.print(0x78,BYTE);    
    Lane_3Serial.print(0x78,BYTE);  

    Lane_4Serial.print(0x78,BYTE);    
    Lane_4Serial.print(0x78,BYTE);    
    Lane_4Serial.print(0x78,BYTE);    
    Lane_4Serial.print(0x78,BYTE);*/
    Lane_1Serial.print(0x77,BYTE); 
    Lane_1Serial.print(0x01,BYTE);    
    Lane_2Serial.print(0x77,BYTE); 
    Lane_2Serial.print(0x01,BYTE);    
    Lane_3Serial.print(0x77,BYTE); 
    Lane_3Serial.print(0x01,BYTE);    
    Lane_4Serial.print(0x77,BYTE); 
    Lane_4Serial.print(0x01,BYTE);    
   
    
    OneShotOff = 1;
    OneShotOn = 0;
  }

}

Here is a link to my wiring diagram: http://users.zoominternet.net/~classicmustangefi/Arduino/Main_Circuit%20Rev1.pdf

A pic of my panel.....

Pics of displays working properly......

Pics of displays not working properly.....