Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Nano-Based Tachometer with IR Sensor and I2C LCD Display

View and Edit Project In Cirkit DesignerImage of Arduino Nano-Based Tachometer with IR Sensor and I2C LCD Display

Circuit Documentation

Summary of the Circuit

This circuit is designed to function as a tachometer using an Arduino Nano as the central processing unit. It utilizes an infrared (IR) sensor to detect the rotation of a wheel and displays the rotation count on a 16x2 I2C LCD. The IR sensor's output is connected to one of the digital pins on the Arduino Nano, which counts the rotations and updates the display. The LCD communicates with the Arduino Nano via the I2C protocol, using dedicated SDA and SCL lines. The circuit is powered by a 9V battery connected to the VIN pin of the Arduino Nano, which also supplies power to the IR sensor and the LCD.

Component List

Arduino Nano

IR Sensor

16x2 I2C LCD

9V Battery

Wiring Details

Arduino Nano

IR Sensor

16x2 I2C LCD

9V Battery

Documented Code

/*
 * Arduino Nano Tachometer
 * This code reads the output from an IR sensor connected to pin D2 to detect
 * the rotation of a wheel. The rotation count is displayed on a 16x2 I2C LCD.
 * The LCD is connected to the I2C pins (A4 for SDA, A5 for SCL).
 */

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#define IR_SENSOR_PIN 2

LiquidCrystal_I2C lcd(0x27, 16, 2);

volatile unsigned int rotationCount = 0;

void setup() {
  pinMode(IR_SENSOR_PIN, INPUT);
  attachInterrupt(digitalPinToInterrupt(IR_SENSOR_PIN), countRotation, RISING);
  lcd.begin();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Tachometer");
}

void loop() {
  lcd.setCursor(0, 1);
  lcd.print("Count: ");
  lcd.print(rotationCount);
  delay(500);
}

void countRotation() {
  rotationCount++;
}

Filename: sketch.ino

Description: The code initializes the LCD and sets up an interrupt to increment the rotationCount variable each time the IR sensor detects a rotation. The count is then displayed on the LCD. The LiquidCrystal_I2C library is used to simplify communication with the LCD over the I2C protocol.