1 / 3
Arduino Nano Tachometer — image 1
1 / 3

Arduino Nano Tachometer

Order a print of this model

We calculate the final price from your selected file. You review and accept it before payment.

Saved on this device.

Reads up to 10k-20k RPM depending on conditions and IR sensor quality

Rating
5 / 5
Likes
25
Downloads
67
Makes
0
Views
624
Reviews
1

Updated at source:

Model information

Category
Electronics
License
Creative Commons — Attribution — Noncommercial — Share Alike

Warning: The potentiometer on some IR sensors may be in a slightly different position. I used the model of https://grabcad.com/library/hw-201-1. Make sure yours lines up.
Also, please adjust your potentiometer to a known rpm. Some readings may be too high because of debounce. Lower sensitivity until its as low as possible. 

Parts are designed to be glued in place.

DESOLDER PINS FROM OLED DISPLAY (removing black header spacer helps a lot). solder directly to pads

Hardware:
Arduino Nano with USB-C port, without headers (i used a chinese knock-off)

128X64 I2C OLED display (white text, 0.96)

IR proximity sensor (one clear led, one black LED.)


Wiring:
IR sensor OUT → D2
Display SDA → A4
Display SCL → A5
Connect all GND together
Connect all 5V together

Code:

#include <Adafruit_SSD1306.h>
#include <Wire.h>

#define OLED_RESET -1 Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

#define PULSE_PIN 2 #define DEBOUNCE_US 10000 // debounce threshold in microseconds

volatile unsigned long pulses = 0; volatile unsigned long lastPulseTime = 0; unsigned long lastTime = 0;

// Interrupt Service Routine with debounce void countPulse() { unsigned long now = micros(); if (now - lastPulseTime > DEBOUNCE_US) { pulses++; lastPulseTime = now; } }

void setup() { pinMode(PULSE_PIN, INPUT); attachInterrupt(digitalPinToInterrupt(PULSE_PIN), countPulse, RISING);

display.begin(SSD1306_SWITCHCAPVCC, 0x3C); display.clearDisplay(); display.setTextColor(SSD1306_WHITE); }

void loop() { if (millis() - lastTime >= 1000) { noInterrupts(); unsigned long count = pulses; pulses = 0; interrupts();

unsigned int rpm = count * 60;

display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
display.print("RPM:");
display.setTextSize(3);
display.setCursor(0, 20);
display.print(rpm);
display.display();

lastTime = millis();

} }

Tags