Trying to make a 6 lane hot wheels drag race timer

Hello everyone, and thank you for having me.

This is my first ever arduino project, and I am completely thrown for a loop on where to start.

The basic idea is to make an electronic 6 lane finish line for my hot wheels cars, that displays the time in seconds, with a decimal, and then 3 decimal places, (tenths of a second, hundreths of a second, and thousandths of a second.)

The track is a scale quarter mile, and most cars clear it in 2 to 5 seconds.

My research led me to this setup here, which details a build for something similar.

I followed his links, which led me to this website here, complete with an arduino sketch to run everything.

Principles of operation are as follows:

1: There is a switch on the start gate that tells the arduino to start the race timer.

2: There is an IR transmitter and receiver on each lane, which tells the arduino how long the car in that lane took to go from start to finish.

3: The times for each lane are then displayed upon a 4 digit 7 segment display, and all have colons and decimals. Each lane has it's own 4 digit 7 segment display. The time is displayed for each lane until the system is reset.

My problem is that while I have the right arduino uno R3, and the right IR sensors, my displays are different. They have 4 pins each, labled "CLK,D10,GND, 5V" they use the Arduino Library "TM1637.h"

As such, the build does not work with these displays. I have already soldered to them, so returning them is not an option, and buying the actual adafruit displays is meh, since I got these 6 displays for the price of 1 Adafruit display. I was assured these were better. Somethingbto do with being able to tell it to display a number with fewer lines, rather than having to denote each character with the Adafruits.

I know next to nothing about coding, and have already spent at least 6 hours watching Mcworther's youtube series. He is awesome but not really helping me with my situation.

If you can help me alter this code to work with these displays, or point me in the right direction where I can learn how to write a sketch thatcwill work, it would be greatly appreciated.

Thank you in advance for your time.

So instead of me trying to work out what the code is that you have now, how about you share the code that you have now, here on this forum (within code </> tags please)
It will most probably not be very hard to make the modification to use the tm1637 instead of the adafruit.

Also start with interfacing the tm1637 with your board already, without all of the other stuff, and learn to understand how you can print data and that particular format of time onto the displays that you have (basically check the examples and modify till you have a format that suits your needs)

The code I have is what was downloaded from here.

https://www.dfgtec.com/download/timer.ino

That is not what i asked.
Regardless, if you download a code from anywhere you should first contact the author to see if there is a version that supports your display. It is more work to modify someone else's code than ones own.

That said, most of the display related functions are self contained and should be fairly easy to modify, though clarity is obfuscated by the possible different displays and even dual mode.

/*================================================================================*
  UPDATE LANE PLACE/TIME DISPLAY
 *================================================================================*/
void update_display(int lane, int display_place, unsigned long display_time, int display_mode)
{
  int c;
  char ctime[10], cplace[4];
  double display_time_sec;
  boolean showdot;

//  dbg(fDebug, "led: lane = ", lane);
//  dbg(fDebug, "led: plce = ", display_place);
//  dbg(fDebug, "led: time = ", display_time);

#ifdef LED_DISPLAY
  if (display_mode)
  {
    if (display_place > 0)  // show place order
    {
      sprintf(cplace,"%1d", display_place);

      disp_mat[lane].clear();
      disp_mat[lane].drawColon(false);
      disp_mat[lane].writeDigitNum(3, char2int(cplace[0]), false);
      disp_mat[lane].writeDisplay();

#ifdef DUAL_DISP
      disp_mat[lane+4].clear();
      disp_mat[lane+4].drawColon(false);
      disp_mat[lane+4].writeDigitNum(3, char2int(cplace[0]), false);
      disp_mat[lane+4].writeDisplay();
#endif
    }
    else  // did not finish
    {
      update_display(lane, msgDashL);
    }
  }
  else                      // show finish time
  {
    if (display_time > 0)
    {
      disp_mat[lane].clear();
      disp_mat[lane].drawColon(false);

#ifdef DUAL_DISP
#ifdef DUAL_MODE
      disp_8x8[lane+4].clear();
      disp_8x8[lane+4].setTextSize(1);
      disp_8x8[lane+4].setRotation(3);
      disp_8x8[lane+4].setCursor(2, 0);
#else
      disp_mat[lane+4].clear();
      disp_mat[lane+4].drawColon(false);
#endif
#endif

      display_time_sec = (double)(display_time / (double)1000000.0);    // elapsed time (seconds)
      dtostrf(display_time_sec, (DISP_DIGIT+1), DISP_DIGIT, ctime);     // convert to string

//      Serial.print("ctime = ["); Serial.print(ctime); Serial.println("]");
      c = 0;
      for (int d = 0; d<DISP_DIGIT; d++)
      {
#ifdef LARGE_DISP
        showdot = false;
#else
        showdot = (ctime[c + 1] == '.');
#endif
        disp_mat[lane].writeDigitNum(d + int(d / 2), char2int(ctime[c]), showdot);    // time
#ifdef DUAL_DISP
#ifdef DUAL_MODE
        sprintf(cplace,"%1d", display_place);
        disp_8x8[lane+4].print(cplace[0]);
#else
        disp_mat[lane+4].writeDigitNum(d + int(d / 2), char2int(ctime[c]), showdot);    // time
#endif
#endif

        c++; if (ctime[c] == '.') c++;
      }

#ifdef LARGE_DISP
      disp_mat[lane].writeDigitRaw(2, 16);
#ifdef DUAL_DISP
#ifndef DUAL_MODE
      disp_mat[lane+4].writeDigitRaw(2, 16);
#endif
#endif
#endif

      disp_mat[lane].writeDisplay();
#ifdef DUAL_DISP
#ifdef DUAL_MODE
      disp_8x8[lane+4].writeDisplay();
#else
      disp_mat[lane+4].writeDisplay();
#endif
#endif
    }
    else  // did not finish
    {
      update_display(lane, msgDashT);
    }
  }
#endif

  return;
}

is the function that updates the display. Of course the display gets initialized first.

what did you find in the way of tm1637 examples ?

Understood.

I took your advice, and reached out to the original programmer.

The TM1637s can't be used, since each one needs its own I/O. The Adafruits used here can be daisy chained, since the other pins are already used elsewhere.

So yes, I need to order the shield they use and the displays used.

those units do tend to lack an 'enable pin', but i guess you could switch the use of the clock pin even through a bitshifter if you'd want to.

really all of them ?

that is the easiest solution yes !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.