Sei sulla pagina 1di 12

Digital Tachometer

Tachometer is a measuring instrument used for measuring the speed of a rotating body. The
unit of measured speed by tachometer is expressed in revolution per minute or RPM.
Tachometers were purely mechanical in past. In that time, the speed measuring parameters
were sent to the tachometer through mechanical coupling (cable or shaft) and the rpm is
measured using a gear mechanism and it is identified using needle mechanism. The
tachometers have changed a lot due to rapid development of modern electronics. This article
is for a contactless digital tachometer using Arduino. Here the speed of the motor is also
controlled. The RPM, the duty cycle and other information are displayed on a LCD screen.
Tachometer is an essential instrument in this modern era of industrialization. In industry it is
necessary to control the speed of motor at a definite RPM and for this counting of RPM is
essential. Tachometer is an instrument used for measuring the number of revolution of an object
in a given interval of time. Usually it is expressed in revolution per minute or RPM. Earlier
tachometers are purely mechanical where the revolution is transferred to the tachometer
through mechanical coupling (cable or shaft), the rpm is determined using a gear mechanism
and it is displayed on a dial. With the advent of modern electronics, the tachometers have
changed a lot. This project is about a contactless digital tachometer using Arduino. The speed
of the motor can also be controlled with the circuit.

3.1 Component Details

Arduino UNO
This microcontroller is based on the ATmega 328. There are total of 20 pins (0-19) out
of which 6 are analog inputs which can also be used as general purpose pins, a ceramic
resonator of frequency 16MHz, an USB connection, a power jack and a reset button. It contains
everything needed to support a microcontroller.
A microcontroller often serves as the “brain” of a mechatronic system. Like a mini,
self-contained computer, it can be programmed to interact with connected hardware and/or a
user, much like a PC connected to a small network of hardware. As the computer industry has
evolved, so has the technology associated with microcontrollers. Every year microcontrollers
become much faster, have more memory, and extend their input and output feature sets, all the
while becoming even cheaper and easier to use.
Even the most basic microcontroller units (MCUs) can perform simple math operations,
monitor (read) analog/digital inputs, and control (write) analog/digital outputs. Most modern
controllers have analog-to-digital converters (ADCs), high-speed timers, counters and
comparators, interrupt capabilities, PWM outputs for producing square-waves, and a variety of
serial communication ports. All of these can be used to interact with the board's immediate
environment for a very wide variety of purposes.
The development board used in this course is called the Arduino. The name Arduino is
(admittedly somewhat ambiguously) used to denote the hardware board, the software
development environment, its library of easy-to-use software functions, and/or the layout
standard of the original version's connection headers, depending on the context. As you will
learn in the next few weeks, it is not necessary to use the Arduino IDE or libraries to use the
Arduino hardware if your requirements dictate otherwise.

The name “Arduino” is a copyright held by the original team based in Italy that
originally built the hardware, the IDE (integrated development environment) and the software
libraries. It was designed to be a platform for physical computing usable primarily by non-
programmers (artists, hobbyists, teachers, students, etc.). Another goal of the project was that
all of the hardware designs (except those for the chips themselves) as well as the software tools
are open-source – free to copy and distribute without any licensing restrictions. By making an
easy-to-use, easy-to-make platform, they hoped that it would enable a wide variety of
interactive and creative uses by an even greater variety of users. Its popularity and use has
spread much wider than originally anticipated. It's estimated that roughly 400,000 Arduinos
and Arduino-compatible boards have been made and/or sold by the end of 2011, and could
reach one million by the end of 2012. There are also dozens of variations of the Arduino
serving specific niche purposes such as robot/motor control, miniaturized applications, UAVs,
sensor networks, etc.
The board is most often powered from the USB connector on the upper-left side during
software development. The USB connection is the programming link over which programs
compiled on your computer are transferred to the MCU. This connection also may be used to
exchange data between the board and your computer.
For greater portability, the board can be untethered from the computer and separately
powered via the 2.1 mm barrel jack in the lower left corner with either a battery pack or a 6-20
VDC (7-12 VDC recommended) AC-to-DC wall adapter. You may also connect a similar voltage
source to the Vin pin in the power-ground header. The final, but less used, alternative is to
attach a regulated 5V power supply directly to the 5V POWER header pin near the center-
bottom of the board.
The Arduino board comes with a single LED, often called the Pin 13 LED because it is
electrically connected to Digital Pin 13. This LED is the board's only built-in indicator
accessible to programs. As you will soon see, you may bring more of your own input and
output devices to the party and connect them yourself. A virgin Arduino board comes pre-
programmed with a sample sketch called Blink that flashes the Pin 13 LED once per second.
This feature is handy because you can easily check the general health of your new board simply
by plugging it into USB, and the flashing LED demonstrates that the board is mostly working.

Figure 3.1 Arduino UNO with its parts


Configuring the Arduino IDE
At this point you should connect the Arduino to the computer with the USB cable. After initial
set-up, the computer should issue its ascending-beep to acknowledge that the board has been
connected. After launching the Arduino IDE, you should see a window like that shown in
Figure 2 below.
Screenshot of Arduino IDE
Now you have to configure the IDE so that it can communicate with the Arduino board. Please
note that every time that you connect an Arduino over USB, you may have to go through the
same configuration procedure (at least with pre-Uno boards). Additionally, if you cause the
Arduino to hard-reset (for instance, because you created a temporary short), that will also reset
the USB connection. Hard resets are functionally equivalent to disconnecting and reconnecting
the cable or board. Fortunately, pressing the reset button on the Arduino board (or shields) will
not reset the USB connection.
There are only two settings that need to be configured, and one of them rarely changes. The
first setting is the board type. If you are using an Uno board, under Tools->Board select
Arduino Uno. This option is probably already the default, and this setting is retained from the
last time the Arduino IDE was run. If you are using a Demilune board, under Tools->Board
select Arduino Demilune or Nano w/ATmega328. Not setting the board type will cause
program downloads to the board to fail.
The other option, under Tools->Serial Port, specifies the COM port that the USB driver should
use to communicate with the Arduino. This one is annoying because every time that your USB
configuration changes, your Arduino board may move to another COM port. There are three
ways to figure out which COM port to use:
1) try to download to each of them,
2) For Windows only – grope around in Start->Control
Panel->System->Hardware->Device Manager->Ports, looking for an entry labeled
USB Serial Port,
3) remember which USB connections aren't connected to the Arduino (but to mice, etc.)
and use the one that changes
Trying a COM port using the trial-and-error method takes approximately fifteen seconds per
attempt, so it is up to you how you want to spend your time determining which COM port is
the right one to use. If the Arduino is the only USB device on your system, then it's easy
because you will only ever have one option to choose from. If no choices are offered in the
Serial Port list, unplug and replug your board and one should show up. If one does not, then
you either have a board that is toast, a bad cable, or hardware that is connected to your board
that is preventing the Arduino from functioning correctly, like a short circuit or something else
that's drawing an excessive amount of current even when the board is off.

Summary on Arduino
Microcontroller ATMega328
Clock Speed 16MHz
Analog Input pins 6
Digital input output pins 14 (6 pins provide PWM voltage)
Input voltage 6-20V
Operating Voltage 5V
LCD
LCD stands for liquid crystal display. They come in many sizes 8x1, 8x2, 10x2, 16x1, 16x2,
16x4, 20x2, 20x4 ,24x2, 30x2, 32x2, 40x2 etc. Many multinational companies
like Philips Hitachi Panasonic make their own special kind of lcd's to be used in their products.
All the lcd's performs the same functions (display characters’ numbers special
characters ASCII characters etc). Their programming is also same and they all have same 14
pins (0-13) and the lcd has about pins which are generally 16 pins (0 to 15).

ALL LCDs have

 Eight (8) Data pins


 VCC (Apply 5v here)
 GND (Ground this pin)
 RS (Register select)
 RW (read - write)
 EN (Enable)
 V0 (Set Lcd contrast)
8-Data pins carries 8-bit data or command from an external unit such as microcontroller.
Liquid Crystal Display, which we are using in our project is JHD 1602A. This display consists
of 16 columns and 2 rows. The library that is used is <liquidcrystal.h>.
PIN SUMMARY OF LCD 1602A
Pin 1: VSS.
Pin 2: To VDD 5V input.
Pin 3: VL to adjust LCD contrast with the help of 10K potentiometer. Low VL indicates light
contrast and high VL indicates dark contrast.
Pin 4: RS for register select. Data registers used for high RS. Similarly, instruction register for
low RS.
Pin 5: R/W signal stands for read/write. When R/W bit is high, it indicates a read operation. If
R/W bit is low, it indicates write operation.
Pin 6: Clock Enable- Edge triggering.
Pin 7 to 14: Represents from Bit 0 to Bit 7.
Pin 15: back light Anode.
Pin 16: back light cathode.

LCD
The Character is displayed on lcd screen in 5x8 or 5x7 matrix. Where 5 represents number of
coulombs and 7,8 represent number of rows. Maximum size of the matrix is 5x8. You cannot
display character greater then 5x8 dimension matrix. To display character greater than this
dimension you have to switch too graphical lcd’s.
 The command 0x38 means we are setting 8-bit mode lcd having two lines and character
shape between 5x7 matrix.
 The command 0x20 means we are setting 4-bit mode lcd having 1 line and character
shape between 5x7 matrix.
 The command 0x28 means we are setting 4-bit mode lcd having 2 lines and character
shape between 5x7 matrix.
 The command 0x06 is entry mode it tells the lcd that we are going to use you'
 The command 0x08 displays cursor off and display off but without clearing DDRAM
contents.
 The command 0x0E displays cursor on and display on.
 The command 0x0c display on cursor off (displays cursor off but the text will appear
on lcd)
 The command 0x0F display on cursor blink (text will appear on screen and cursor will
blink).
 The command 0x18 shift entire display left (shift whole off the text on the particular
line to its left).
 The command 0x1C shift entire display right (shift whole off the text on the particular
line to its right).
 The command 0x10 Moves cursor one step left or move cursor on step ahead to left
whenever new character is displayed on the screen.
 The command 0x14 Moves cursor one step right or move cursor on step ahead to right
whenever new character is displayed on the screen.
 The command 0x01 clear all the contents of the DDRAM and also clear the lcd removes
all the text from the screen.
 The command 0x80 initialize the cursor to the first position means first line first matrix
(start point) now if we add 1 in 0x80+1=0x81 the cursor moves to second matrix.

16x1 lcd displays 16 characters only. The first will appear on 0x80 second 0x81 third 0x82 and
so on until last, the 16 once on address 0x8F.

Before you send commands and data to your lcd. Lcd must first be initialized.
This initialization is very important for lcd that are made by Hitachi because they use HD44780
driver chip sets. Hd44780 Chip set first has to be initialized before using it. If you don't
initialize it properly you will see nothing on your lcd.

For 8-bit mode, this is done as follows:


1. Wait more than 15 msecs after power is applied.
2. Write command 0x30 to LCD and wait 5 milli seconds for the instruction to complete.
3. Write command 0x30 to LCD and wait 160 micro seconds for instruction to complete.
4. Write command 0x30 AGAIN to LCD and wait 160 micro seconds or Poll the Busy Flag.

In 4-bit mode the high nibble is sent first before the low nibble and the EN pin is toggled each
time four bits is sent to the LCD. To initialize in 4-bit mode:

1. Wait more than 15 msecs after power is applied.


2. Write command 0x03 to LCD and wait 5 msecs for the instruction to complete.
3. Write command 0x03 to LCD and wait 160 usecs for instruction to complete.
4. Write command 0x03 AGAIN to LCD and wait 160 usecs (or poll the Busy Flag).
Write 0x02 to the LCD to Enable 4-Bit Mode

Buzzer
In our project the buzzer is used for beep sound either indicating the countdown time or wrong
password. It is as shown below:

DC Motor:
Working principle of a DC motor
A motor is an electrical machine which converts electrical energy into mechanical energy. The
principle of working of a DC motor is that "whenever a current carrying conductor is placed
in a magnetic field, it experiences a mechanical force". The direction of this force is given by
Fleming's left hand rule and it's magnitude is given by F = BIL. Where, B = magnetic flux
density, I = current and L = length of the conductor within the magnetic field.

Fleming's left hand rule: If we stretch the first finger, second finger and thumb of our left
hand to be perpendicular to each other AND direction of magnetic field is represented by the
first finger, direction of the current is represented by second finger then the thumb represents
the direction of the force experienced by the current carrying conductor.
Animation: Working of DC Motor

Above animation helps in understanding the working principle of a DC motor. When


armature windings are connected to a DC supply, current sets up in the winding. Magnetic field
may be provided by field winding (electromagnetism) or by using permanent magnets. In this
case, current carrying armature conductors experience force due to the magnetic field,
according to the principle stated above.

Commutator is made segmented to achieve unidirectional torque. Otherwise, the direction of


force would have reversed every time when the direction of movement of conductor is reversed
the magnetic field.
This is how a DC motor works!

Back EMF

According to fundamental laws of nature, no energy conversion is possible until there is


something to oppose the conversion. In case of generators this opposition is provided by
magnetic drag, but in case of dc motors there is back emf.

When the armature of the motor is rotating, the conductors are also cutting the magnetic flux
lines and hence according to the Faraday's law of electromagnetic induction, an emf induces
in the armature conductors. The direction of this induced emf is such that it opposes the
armature current (Ia) . The circuit diagram below illustrates the direction of the back emf and
armature current. Magnitude of Back emf can be given by the emf equation of DC generator.
Significance of back emf:

Magnitude of back emf is directly proportional to speed of the motor. Consider the load on a
dc motor is suddenly reduced. In this case, required torque will be small as compared to the
current torque. Speed of the motor will start increasing due to the excess torque. Hence, being
proportional to the speed, magnitude of the back emf will also increase. With increasing back
emf armature current will start decreasing. Torque being proportional to the armature current,
it will also decrease until it becomes sufficient for the load. Thus, speed of the motor will
regulate.
On the other hand, if a dc motor is suddenly loaded, the load will cause decrease in the speed.
Due to decrease in speed, back emf will also decrease allowing more armature current.
Increased armature current will increase the torque to satisfy the load requirement. Hence,
presence of the back emf makes a dc motor ‘self-regulating’.

Types of DC Motors

DC motors are usually classified of the basis of their excitation configuration, as follows -

 Separately excited (field winding is fed by external source)


 Self excited -
o Series wound (field winding is connected in series with the armature)
o Shunt wound (field winding is connected in parallel with the armature)
o Compound wound -
 Long shunt
 Short shunt
IR Sensor:

PRINCIPLE OF WORKING

An Infrared (IR) sensor is used to detect obstacles in front of the robot or to differentiate
between colors depending on the configuration of the sensor.

The picture shown is a very simple black box model of the IR


Sensor. The sensor emits IR light and gives a signal when it
detects the reflected light.

An IR sensor consists of an emitter, detector and associated circuitry. The circuit required to
make an IR sensor consists of two parts; the emitter circuit and the receiver circuit.

The emitter is simply an IR LED (Light Emitting Diode) and the detector is simply an IR
photodiode which is sensitive to IR light of the same wavelength as that emitted by the IR LED.
When IR light falls on the photodiode, its resistance and correspondingly, its output voltage,
change in proportion to the magnitude of the IR light received. This is the underlying principle
of working of the IR sensor.

Distinguishing between black and white

IR sensors are also used to distinguish between black and white surfaces. White surfaces reflect
all types of light while black surfaces absorb them. Therefore, depending on the amount of light
reflected back to the IR receiver, the IR sensor can also be used to distinguish between black
and white surfaces.

Let us now see how to build an IR sensor using this principle.

Circuit Diagram
IR Emitter Circuit IR Receiver Circuit

Potrebbero piacerti anche