arduino-tachometer/README.md

26 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2024-06-17 12:32:09 +02:00
# Arduino nano tachometer
2024-06-17 12:25:23 +02:00
2024-06-17 12:32:09 +02:00
# Program Functionalities
2024-06-18 00:16:05 +02:00
This Arduino program is designed to interface with a two-channel incremental encoder and display the rotational speed of a roller conveyor on an LCD screen. The main functionalities of the program include:
2024-06-17 12:32:09 +02:00
## Initialization of LCD and Encoder Pins
- The program initializes a 16x2 I2C LCD to display the calculated speed.
- It sets up two digital pins as inputs with internal pull-up resistors to read signals from the encoder.
## Interrupt Handling for Encoder Pulses
- The program uses external interrupts on the encoder signal pins (CLK and DT) to accurately count pulses.
- Two interrupt service routines (ISRs) are defined: `ai0()` and `ai1()`. These routines increment the pulse counter based on the state of the encoder signals, ensuring the counter increases only in one direction to prevent negative values.
## Real-Time Calculation of RPM and Speed
- The main loop of the program calculates the RPM (revolutions per minute) and the speed in meters per minute (m/min) every second.
- RPM is calculated using the formula:
2024-06-17 12:37:54 +02:00
`RPM = (counter * 60) / pulses per revolution`
2024-06-17 12:32:09 +02:00
- The speed in m/min is calculated using the formula:
2024-06-17 12:37:54 +02:00
`Speed (m/min) = (RPM * π * roller diameter) / 1000`
2024-06-17 12:32:09 +02:00
- After each calculation, the counter is reset for the next measurement period.
## Displaying Speed on the LCD
- The calculated speed in m/min is displayed on the LCD screen.
- The LCD is updated every second with the new speed value, ensuring the display shows real-time data.