Programacion De Sircuitos
Enviado por teterilla • 10 de Octubre de 2013 • 2.069 Palabras (9 Páginas) • 187 Visitas
Arduino Tachometer
Jump To:
• Part 1: Introduction
o Part 1: Introduction
o Part 2: Parts List
o Part 3: Schematic
o Part 4: Theory of Operation
o Part 5: Hardware
o Part 6: Software
o Part 7: Data & Observations
o Part 8: Conclusion
Project Info
Author: Chris
Difficulty: Medium
Time Invested: 3 Hours
Prerequisites:
• Intro To Arduino
• Arduino LCD Interface
• PIC Tachometer
Take a look at the above
articles before continuing
to read this article.
A tachometer is a useful tool for counting the RPM (rotations per minute) of a wheel or basically anything that spins. The easiest way to build a tachometer is using a transmitter and receiver. When the link between them is broken, you know that something is spinning and can execute some code that calculates the current RPM of whatever is spinning to break the transmitter/receiver link.
In this article we will explore how to use an IR transmitter and receiver break-beam pair similar to the PIC Tachometer project I built a few months ago, but because of popular demand, the Arduino system will be used for all the processing and break-beam interruption counting. The end result will be a 16x2 LCD displaying the RPM of some computer fans.
Arduino Tachometer - Demonstration
Arduino Tachometer - Project Setup
Purpose & Overview Of This Project
The purpose of this project is to build a single input, single output system. The input will come in the form of a signal state change from high (+5v) to low (+0v) which will occur when the IR break-beam is interrupted and the Arduino will then increment an internal counter. As time goes on, additional processing and calculation will occur as interrupts are trigger and the LCD will output the calculated RPM.
To create the IR break-beam, we will used an IR LED with a low value resistor so that it shines very bright. The receiver will be a phototransistor which biases 'on' whenever the IR LED's light is detected. A computer fan will be placed between the IR link and turned on so as to continuously generate an interrupt through some additional transistor logic circuitry. For output, the Arduino LCD interface that we saw last week will be used so that we can output the final RPM value to the LCD.
Parts List Details
The parts used in this project are all listed out above, but the more interesting and necessary parts are listed out below with a little more detail to describe their function.
Arduino UNO
This is the Arduino board that we will be using to process the IR break-beam pulses that tell us when the CPU fan has moved. The Arduino will use these pulses along with a timer to figure out what the current RPM of the fan is.
16x2 LCD
After the Arduino has figured out what the curent RPM is, it will be displayed on this LCD so that it's obvious to the user.
5kΩ Trimpot
This trimpot will be used for setting the contrast of the 16x2 LCD. It's gives an anaolg output varying from +5v to 0, which the LCD translates to a brightness setting.
IR Emitter Diode and Phototransistor
The photo transistor turns on whenever intense Infrared light shines on it. So whenever the IR LED is on and shining, it keeps the phototransistor biased 'on', but if the IR LED is blocked, by...for example a CPU fan blade, the phototransistor is biased 'off'.
2n3904 and 2n3906
These transistors will mainly be used as level shifters to ensure the pulses output from the IR break-beam to the Arduino come in the form of +0v to +5v and nothing in-between.
Schematic Overview
The circuit diagram for this project is a little more complicated than last week's 16x2 LCD Interface. For starters, the LCD interface is simplified to have only 2 control lines and 4 data lines. Then the tachometer IR break-beam circuit is added on the side to make things a little more complex.
View Full Schematic
Schematic Specifics
16x2 LCD Interface
2 control pins and 4 data pins are connected from the Arduino to the LCD. These are what will tell the LCD what to do and when.
IR Break-Beam Circuit
The break-beam circuit's signal goes to the digital input pin #2 on the Arduino. This will interrupt the Arduino so it can count that a pulse has just been registered and the tachometer is reading data.
Arduino LCD Library
For this project we'll be using the same Arduino LCD library as before to control and output to the LCD. Mainly we will just be udpated the 2nd row with the newly calculated RPM value. But we'll still use the same theory as seen here.
Just as a refresher, the basic way to setup the Arduino LCD interface uses the 'Hello, World!' code seen below. We'll be using code very similar to this, especially the: "lcd.print(millis()/1000);" for our tachometer.
So understand these LCD library functions as best you can before continuing. They're not overly sophisticated and are well documented on Arduino's website.
Arduino RPM Counting
Since we're going to be counting the RPM for a CPU fan, first we need to realize that we're using an IR break-beam that counts every interruption. This is great, except we do need to realize that the CPU fan has 7 blades. This means 7 interrupts is 1 RPM.
If we keep track of the interrupt count, we can know that every 7th interruption means 1 full rotation has
...