Projects / Engine hour meter for pumps and tractors

Engine hour meter for pumps and tractors

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANOLM2596

    Set the buck module

    Feed 12 V to the LM2596 and adjust to 5.0 V on a multimeter.

  2. NANO12:45LM2596

    Wire the electronics

    Fuse, LM2596, Nano, SW-420 and TM1637 as in the table.

  3. NANO

    Bench-test the sensor

    Tap the SW-420 and watch the on-board LED and D2 change.

  4. NANOABS

    Fix it to the engine

    Bolt the sensor to the engine body or pump frame with the electronics box on a stable, clean place.

  5. NANO

    Tune sensitivity

    With the engine running, turn the trimmer until the sensor pulses often. When off, it must stay quiet.

  6. NANO

    Check the count

    Run the engine for 15 minutes and see the total rise by a quarter hour once it reaches the save interval.

In short

How do you build an engine hour meter for pumps and tractors?

A vibration sensor tells when a diesel pump or tractor is running and adds up engine hours for oil changes, stored safely in EEPROM. You need Arduino Nano, Vibration sensor module (SW-420), TM1637 4-digit display, LM2596 Buck Module, ABS project box (100 × 60 × 25 mm), Fuse 1 A glass (5 × 20 mm), Fuse holder (panel, 5 × 20 mm) and Jumper wires male to male (40 pcs, 20 cm). It takes 6 steps and about 90 minutes.

Level
Beginner
Time
About 90 min
Parts
8

Parts list

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

Wiring

FromToWhy
12 V battery +1 A fuse, then LM2596 IN+Fused supply
12 V battery -LM2596 IN- and groundGround
LM2596 OUT+ (set to 5.0 V first)Nano 5V pinRegulated supply
LM2596 OUT-Nano GNDGround
SW-420 VCC and GNDNano 5V and GNDSensor supply
SW-420 DONano D2Vibration pulse output
TM1637 CLK and DIONano D4 and D5Display
TM1637 VCC and GNDNano 5V and GNDDisplay supply

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "TM1637" by Avishay Orpaz. The meter adds a minute only when the sensor changes state at least 20 times in that minute, so a bump does not count. Hours are saved every 10 minutes, so up to 10 minutes can be lost if power fails. Adjust the sensor's trimmer so a running engine triggers it and a still one does not. Set the LM2596 to exactly 5.0 V before connecting the Nano.

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>
#include <EEPROM.h>

TM1637Display display(4, 5);
const byte VIB = 2;
const int MIN_TRANSITIONS = 20;              // changes per minute that count as running
const byte SAVE_EVERY_MIN = 10;
uint32_t totalMin = 0;
byte minsSinceSave = 0;
unsigned long minuteStart = 0;
int transitions = 0;
bool last = false;

void setup() {
  pinMode(VIB, INPUT);
  display.setBrightness(5);
  EEPROM.get(0, totalMin);
  if (totalMin == 0xFFFFFFFF) totalMin = 0;  // blank EEPROM
  minuteStart = millis();
}

void loop() {
  bool now = digitalRead(VIB);
  if (now != last) { transitions++; last = now; }

  if (millis() - minuteStart >= 60000UL) {
    minuteStart = millis();
    if (transitions >= MIN_TRANSITIONS) {    // the engine shook the sensor this minute
      totalMin++;
      if (++minsSinceSave >= SAVE_EVERY_MIN) { EEPROM.put(0, totalMin); minsSinceSave = 0; }
    }
    transitions = 0;
  }

  uint32_t hours = totalMin / 60;
  bool serviceDue = (hours % 250) < 2 && hours >= 250;
  if (serviceDue && (millis() / 500) % 2) display.clear();       // blink for 2 hours after each 250 h
  else display.showNumberDec(hours % 10000);
  delay(5);
}

Test checklist

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

CheckExpected
Engine offNo change in the total
Engine running 15 minTotal increases by 15 minutes
Power cycleTotal restored from EEPROM
After 250 hoursDisplay blinks for two hours

If it does not work

Counts while the engine is off

The sensor is too sensitive or on a shared bench. Lower the trimmer.

Does not count

The engine does not shake the sensor enough. Mount it on a rigid part nearer the engine.

Total resets to zero

EEPROM write failed or was never saved. Run for at least 10 minutes.

Nano resets when starting the engine

Add a 470 µF capacitor at the buck input.

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

Ask Lark AI

Common questions

What parts do I need for the engine hour meter for pumps and tractors?

Arduino Nano, Vibration sensor module (SW-420), TM1637 4-digit display, LM2596 Buck Module, ABS project box (100 × 60 × 25 mm), Fuse 1 A glass (5 × 20 mm), Fuse holder (panel, 5 × 20 mm) and Jumper wires male to male (40 pcs, 20 cm).

How long does the engine hour meter for pumps and tractors take to build?

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

How do I know the engine hour meter for pumps and tractors works?

Engine off: No change in the total. Engine running 15 min: Total increases by 15 minutes. Power cycle: Total restored from EEPROM.

Counts while the engine is off: what should I check?

The sensor is too sensitive or on a shared bench. Lower the trimmer.

Does not count: what should I check?

The engine does not shake the sensor enough. Mount it on a rigid part nearer the engine.

Total resets to zero: what should I check?

EEPROM write failed or was never saved. Run for at least 10 minutes.

Nano resets when starting the engine: what should I check?

Add a 470 µF capacitor at the buck input.