Projects / Speedcube stack timer

Speedcube stack timer

Beginner1 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANOTTP223

    Mount the pads

    Fix the two touch modules on a board about 25 cm apart, with metal pads uncovered or covered by thin tape.

  2. NANO

    Wire the pads and display

    OUT pins to D2 and D3, display to D4 and D5.

  3. NANO14.1 mA

    Add the ready light

    Green LED with 220 Ω to D6.

  4. NANO14.1 mA

    Upload and test

    Rest both hands on the pads. After half a second the green LED lights.

  5. NANO

    Start and stop

    Lift both hands to start the timer, put both back to stop it.

  6. NANO

    Check best time

    Do three solves and see the display alternate between the last time and the best.

In short

How do you build a speedcube stack timer?

Two touch pads start the timer when both hands lift and stop it when both are placed again. You need Arduino Nano, Touch sensor module (TTP223) × 2, TM1637 4-digit display, LED 5 mm green, Resistor 220 Ω, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data). It takes 6 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Touch pad left OUTNano D2High when touched
Touch pad right OUTNano D3High when touched
Both touch modules VCC and GNDNano 5V and GNDSupply
TM1637 CLK and DIONano D4 and D5Display
TM1637 VCC and GNDNano 5V and GNDSupply
Green LED anodeNano D6 through 220 ΩReady light
Green LED cathodeNano GNDReturn

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "TM1637" by Avishay Orpaz. The TTP223 modules read HIGH while touched in their default mode. The display shows seconds and hundredths, and alternates with the best time of the session after each solve.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <TM1637Display.h>

const byte L = 2, R = 3, READY = 6;
TM1637Display display(4, 5);
enum State { IDLE, ARMED, RUNNING, DONE } state = IDLE;
unsigned long armedAt = 0, startAt = 0, finalMs = 0, doneAt = 0;
unsigned long best = 0;

bool both() { return digitalRead(L) == HIGH && digitalRead(R) == HIGH; }
bool neither() { return digitalRead(L) == LOW && digitalRead(R) == LOW; }

void showMs(unsigned long ms) {
  unsigned long s = ms / 1000, cs = (ms % 1000) / 10;
  display.showNumberDecEx((s % 100) * 100 + cs, 0b01000000, true);   // SS.CC
}

void setup() {
  pinMode(L, INPUT); pinMode(R, INPUT); pinMode(READY, OUTPUT);
  display.setBrightness(6);
  showMs(0);
}

void loop() {
  switch (state) {
    case IDLE:
      digitalWrite(READY, LOW);
      if (both()) { armedAt = millis(); state = ARMED; }
      break;
    case ARMED:
      if (!both()) { state = IDLE; break; }
      if (millis() - armedAt > 500) digitalWrite(READY, HIGH);       // hold for half a second: ready
      if (millis() - armedAt > 500 && neither()) { state = RUNNING; startAt = millis(); digitalWrite(READY, LOW); }
      break;
    case RUNNING:
      showMs(millis() - startAt);
      if (both()) {
        finalMs = millis() - startAt; state = DONE; doneAt = millis();
        if (best == 0 || finalMs < best) best = finalMs;
      }
      break;
    case DONE:
      if (millis() - doneAt < 3000 || (millis() / 3000) % 2 == 0) showMs(finalMs);
      else showMs(best);                                              // alternate time and best
      if (neither() && millis() - doneAt > 1000) state = IDLE;
      break;
  }
  delay(5);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Both hands held for half a secondGreen LED lights
Both hands liftedTimer starts and runs
Both hands downTimer stops and shows the time
Several solvesBest time shown between times

If it does not work

Timer starts too early

One pad releases briefly. Add a tiny delay or use the TTP223 latch jumper settings correctly.

Pad does not respond

Cover is too thick or the module is not powered. Test the module's LED.

Display shows weird digits

CLK and DIO swapped.

Pads trigger without touch

Electrical noise near the Nano. Keep the touch wires short and grounded.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the speedcube stack timer?

Arduino Nano, Touch sensor module (TTP223) × 2, TM1637 4-digit display, LED 5 mm green, Resistor 220 Ω, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data).

How long does the speedcube stack timer take to build?

About 60 minutes for a beginner maker, in 6 steps.

How do I know the speedcube stack timer works?

Both hands held for half a second: Green LED lights. Both hands lifted: Timer starts and runs. Both hands down: Timer stops and shows the time.

Timer starts too early: what should I check?

One pad releases briefly. Add a tiny delay or use the TTP223 latch jumper settings correctly.

Pad does not respond: what should I check?

Cover is too thick or the module is not powered. Test the module's LED.

Display shows weird digits: what should I check?

CLK and DIO swapped.

Pads trigger without touch: what should I check?

Electrical noise near the Nano. Keep the touch wires short and grounded.