Projects / Workstation cycle timer

Workstation cycle timer

Intermediate1.7 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO

    Wire the sensor

    Pin 1 to 5V, pin 2 to GND, pin 3 to D2 with 10 kilohms to 5V.

  2. NANO

    Wire the display

    5V or 3V3, GND, SDA to A4, SCL to A5.

  3. NANO

    Wire the reset button

    D4 to GND through the button.

  4. NANO

    Upload the sketch

    The display shows zero cycles.

  5. NANO

    Pass the magnet by the sensor twice

    The first pass starts the clock and the second shows a cycle time.

  6. NANO

    Repeat at different speeds

    Average and best update.

  7. NANO

    Hold reset

    All the figures clear.

In short

How do you build a workstation cycle timer?

A Hall sensor and a small magnet on a hand fixture or a lever time every cycle of a manual job, and a Nano shows the last, average and best cycle times on an OLED. It teaches how a workshop measures a process before improving it. You need Arduino Nano, Hall Effect Sensor A3144, Neodymium magnets (10 × 3 mm), Resistor 10 kΩ, SSD1306 OLED Display, Tactile push button 6 mm, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 100 minutes.

Level
Intermediate
Time
About 100 min
Parts
8

Parts list

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

Wiring

FromToWhy
A3144 pin 1 (VCC)Nano 5VPower the sensor
A3144 pin 2 (GND)Nano GNDCommon ground
A3144 pin 3 (output)Nano D2Goes low when the south pole is close
10k resistorBetween D2 and 5VPull-up for the open-collector output
OLED VCCNano 5VPower (check your OLED accepts 5 V, otherwise use 3V3)
OLED GNDNano GNDCommon ground
OLED SDA and SCLNano A4 and A5I2C, address 0x3C
Reset buttonNano D4 and GNDClears the statistics

Code

The A3144 Hall sensor is a small switch that closes when it sees the south pole of a magnet. Stick a magnet on the moving part of a hand press, a lever or a drawer, and fix the sensor where the magnet passes it once per cycle. Each pass triggers an interrupt that records the time, and the time between two passes is one cycle. The display shows the last cycle, the average and the best, which is how a workshop sees whether a change to a job really makes it faster. Anything shorter than 300 ms is ignored so a double pass does not count twice. Safety: use this only to watch a process, never to switch a machine or as a guard. Keep fingers away from moving parts, fit the sensor so it cannot get in the way, and do not use it on a machine whose guards have been removed. Neodymium magnets are strong: keep them away from pacemakers, cards and phones, and take care of pinched fingers.

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 <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 oled(128, 64, &Wire, -1);

const uint8_t HALL_PIN = 2;
const uint8_t RESET_PIN = 4;
const unsigned long MIN_CYCLE_MS = 300;    // ignore anything faster, it is a bounce or a double pass

volatile unsigned long passAt = 0;
volatile bool passed = false;

unsigned long lastCycle = 0, bestCycle = 0;
unsigned long sumCycles = 0;
unsigned int cycles = 0;
unsigned long previousPass = 0;

void onPass() {
  unsigned long now = millis();
  if (now - passAt > MIN_CYCLE_MS) {
    passAt = now;
    passed = true;
  }
}

void draw() {
  oled.clearDisplay();
  oled.setTextColor(SSD1306_WHITE);
  oled.setTextSize(1);
  oled.setCursor(0, 0);
  oled.print("Cycles ");
  oled.print(cycles);
  oled.setTextSize(2);
  oled.setCursor(0, 14);
  oled.print(lastCycle / 1000.0, 1);
  oled.print(" s");
  oled.setTextSize(1);
  oled.setCursor(0, 40);
  oled.print("Avg  ");
  if (cycles > 0) oled.print(sumCycles / cycles / 1000.0, 1);
  oled.print(" s");
  oled.setCursor(0, 52);
  oled.print("Best ");
  if (cycles > 0) oled.print(bestCycle / 1000.0, 1);
  oled.print(" s");
  oled.display();
}

void setup() {
  pinMode(HALL_PIN, INPUT_PULLUP);
  pinMode(RESET_PIN, INPUT_PULLUP);
  Wire.begin();
  if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { while (true) {} }
  attachInterrupt(digitalPinToInterrupt(HALL_PIN), onPass, FALLING);
  draw();
}

void loop() {
  if (passed) {
    noInterrupts();
    unsigned long t = passAt;
    passed = false;
    interrupts();
    if (previousPass != 0) {
      lastCycle = t - previousPass;
      sumCycles += lastCycle;
      cycles++;
      if (bestCycle == 0 || lastCycle < bestCycle) bestCycle = lastCycle;
      draw();
    }
    previousPass = t;
  }
  if (digitalRead(RESET_PIN) == LOW) {
    cycles = 0; sumCycles = 0; lastCycle = 0; bestCycle = 0; previousPass = 0;
    draw();
    delay(400);
  }
}

Test checklist

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

CheckExpected
First passStarts timing only
Second pass after 5 secondsLast 5.0 s, cycles 1
Faster pass after 3 secondsBest 3.0 s
Wave the magnet back and forth quicklyPasses under 300 ms are ignored
Press resetBack to zero

If it does not work

No pass seen

Turn the magnet over, the A3144 reacts to one pole.

Too many counts

Raise MIN_CYCLE_MS or keep the magnet further away.

Display blank

Check the OLED address 0x3C and the I2C wires.

Odd times

Make sure the sensor output has its 10 kilohm pull-up.

Sensor too sensitive

Increase the gap between magnet and sensor.

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

Ask Lark AI

Common questions

What parts do I need for the workstation cycle timer?

Arduino Nano, Hall Effect Sensor A3144, Neodymium magnets (10 × 3 mm), Resistor 10 kΩ, SSD1306 OLED Display, Tactile push button 6 mm, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the workstation cycle timer take to build?

About 100 minutes for a intermediate maker, in 7 steps.

How do I know the workstation cycle timer works?

First pass: Starts timing only. Second pass after 5 seconds: Last 5.0 s, cycles 1. Faster pass after 3 seconds: Best 3.0 s.

No pass seen: what should I check?

Turn the magnet over, the A3144 reacts to one pole.

Too many counts: what should I check?

Raise MIN_CYCLE_MS or keep the magnet further away.

Display blank: what should I check?

Check the OLED address 0x3C and the I2C wires.

Odd times: what should I check?

Make sure the sensor output has its 10 kilohm pull-up.