·
What is our requirement?
ð Here we want to measure the rpm of DC motor.
So we have to measure how many times a particular point on the rotor undergoes
a full rotation within a minute. So we have to use a sensor to keep track of
this data.
If we are able to determine the time between
two consecutive detection of fixed point then we can calculate the RPM easily.
Suppose the time between two consecutive detection is ‘t millisecond(s)’ then
In our
project we have used infrared sensor (IR sensor) for detection of fixed point.
This is all
about the basic requirement. Now we will see the basic block diagram of the
circuit we are going to make.
·
Block diagram of the circuit.
Now let us
see those units in our project, just overview.
Motor: -
Sensor: -
Processing unit: -
Power: -
Display: -
·
What components are required?
·
The required components
are –
a. 470 ohm [470 Ω 1/4W], 1/4 Watt Resistor
b. 10K ohm [10K Ω 1/2W], 1/2 Watt Resistor
c. 16Mhz Crystal
d. 9v Battery Zinc Chloride Battery
e. 9v Battery Snap Connector
f.
22pf/50V Ceramic
Capacitor
g. CD4511 - BCD to 7-segment Latch/Decoder/Driver
h. 28 Pin - DIP IC Socket/Base (DIP-28pin)
i.
3mm IR
Transmitter & Reciever [Rx - Equ. Phototransistor]
j.
Touch Switch -
Push button (4pin Tactile-Micro) Switch – small
k. PCB Board Universal - Perforated [Tin Plated]
2x3" inches
l.
Knob
Potentiometer - Small (inner semi-circle)
m. 10K Potentiometer (Linear)
n. Atmega8A-8PU Microcontroller
o. Wheels for BO motors - Dia 6.8cm (68mm) |
0.8cm(8mm) width - D shape hole
p. 300 RPM Straight DC Geared BO motor Single Shaft
q. 16 Pin - DIP IC Socket/Base (DIP-16pin)
r. 7-Segment Display - Common Cathode
s. 40x2 pin break-away Headers- Straight male
Headers
t.
40 pin Female
Berg strip - Straight Female Headers
That’s all. They are bought from – http://www.electronicscomponents.com/
·
What is the processing unit?
·
Here the
processing unit refers to the unit that is the heart of that measurement
device. It is responsible for the control of sensors, display. It does all the
mathematic operation required to calculate the rpm.
Here we have used Atmega8A-PU
microcontroller which is popularly known to be used in Arduino board.
·
Reasons for using microcontroller instead of
using discrete chips.
·
Since the
capability of a single microcontroller is beyond the discrete chips. Reasons
can be summarised as follows –
a. It will be cost effective w.r.t the individual
components. For example Atmega8A-PU is available at INR 99 only.
b. It is programmable; we change the programme
anytime, vary the sensitivity and store the results.
c. Circuit
will be small and compact, error detection will be easy.
d. High speed of operation.
DESCRIPTION OF THE INDIVIDUAL COMPONENTS
·
Atmega8A-PU microcontroller: -
·
The pin-out of
that microcontroller is –
Atmega8A - 28Pins 8MHz 8kb 8-bit Microcontroller
Feature
- 28-pin AVR Microcontroller
- Flash Program Memory: 8 kbytes
- EEPROM Data Memory: 512 bytes
- SRAM Data Memory: 1 kbytes
- I/O Pins: 23
- Timers: Two 8-bit / One 16-bit
- A/D Converter: 10-bit Six Channel
- PWM: Three Channels
- RTC: Yes with Separate Oscillator
- MSSP: SPI and I²C Master and Slave Support
- USART: Yes
- External Oscillator: up to 8MHz
Specifications
- High-performance, Low-power AVR 8-bit
Microcontroller
- Advanced RISC Architecture
- 130 Powerful Instructions - Most Single Clock
Cycle Execution
- 32 x 8 General Purpose Working Registers
- Up to 16 MIPS Throughput at 16MHz
- Fully Static Operation
- On-chip 2-cycle Multiplier
- Nonvolatile Program and Data Memories
- 8k Bytes of In-System Self-Programmable Flash
- Optional Boot Code Section with Independent
Lock Bits
- 512K Bytes EEPROM
- Programming Lock for Software Security
- 1K Byte Internal SRAM
- Peripheral Features
- On-chip Analog Comparator
- Programmable Watchdog Timer with Seperate
On-chip Oscillator
- Master/Slave SPI Serial Interface
- Two 8-bit Timer/Counters with Separate
Prescalar, Compare
- One 16-bit TImer/Counter with Seperate
Prescaler, Compare and Capture mode
- Real TIme Counter with Seperate Oscillator
- Four PWM Channels
- 8-channel, 10-bit ADC
- Byte-oriented Two-wire Serial Interface
- Programmable Serial USART
- Special Mircocontroller Features
- Power-on Reset and Programmable Brown-out
Detection
- Internal Calibrated RC Oscillator
- External and Internal Interrupt Sources
- Five Sleep Modes: Idle, ADC Noise Reduction,
Power-save, Power-down, Standby, and Extended Standby
- I/O and Packages
- 23 Programmable I/O Lines
- 28-pin PDIP, 32-lead TQFP, and 32-pad MLF
- Operating Voltages
- 4.5-5.5V for ATmega8L
- Speed Grades
- 0-16 MHz for ATmega8
- Power Consumption @ 4 MHz, 3V, and 35°C for
ATmega8L
- Active: 3.6mA
- Idle Mode: 10mA
- Power-down Mode: 0.5µA
Here
are using the digital pins only i.e. the pins 13, 12, 11, ….. up to 3.
We
are also using Arduino standalone circuit. For more details about Arduino
standalone circuit please visit -- https://www.arduino.cc/en/Main/Standalone
The
circuit diagram is as –
·
IR Sensor: -
·
We have used 3mm
IR transmitter and phototransistor as Rx.
IR Transmitter & Receiver - 3mm
General Description
This 3mm Transmitter & Receiver pair can be
used for various applications like used in remote controls, distance sensor,
object sensors, line sensors etc. The receiver(black color) can be used as
phototransistor.
Specifications:
- Working wavelength: 925-955nm.
- Size: 3mm
Blue
one is the Tx and the clack one is the Rx.
The
corresponding circuit i—
We are
monitoring the current in photodiode through Atmega PIN ~5.
·
Display:
-
·
Here we
have used common cathode 7-segment display as display. Corresponding circuit.
About
the CD4511 IC—
CD4511 - BCD to 7-segment Latch/Decoder/Driver
Category
|
Integrated Circuits (ICs)
|
Name
|
CD4511, BCD to 7-segment
Latch/Decoder/Driver
|
Family
|
CMOS
|
Series
|
4000
|
Mounting
Type
|
Surface Mount
|
No.
of Pins
|
16 (DIP)
|
Feature
- Contains a 4-bit Storage Latch, BCD-to-Seven
Segment Decoder and Output Drive
- Suitable for LED, Incandescent, Fluorescent or
LCD Readouts
- Blanking Input
- Lamp Test Provision
- Low Power TTL
The
corresponding circuit of our project is --
·
Circuit Diagram of our circuit: -
·
Atmega8A-PU Chip code :-
ð The corresponding code –
#include
<StopWatch.h>
StopWatch Sw;
int sensorpin=5,
count = 0,rpm=0, Elapsed=0 ;
void Display(int
value)
{
int e=0,f=0,g=0, a=0, b=0,c=0,d=0;
e=value/100;
/* Separating the first digit */
// Serial.println(e);
f=(value/10)-(e*10); /* Separating the second
digit */
// Serial.println(f);
g=value-((100*e)+(10*f)); /* Separating the last digit */
// Serial.println(g);
/*Decimal to Binary Conversion */
a=e%2;
b=e/2;
c=b/2;
b=b%2;
d=c/2;
c=c%2;
delay(100);
digitalWrite(8,LOW); /* Configuring the Latch enable pins */
digitalWrite(7,HIGH);
digitalWrite(6,HIGH);
LED(a,b,c,d);
delay(100);
a=f%2;
b=f/2;
c=b/2;
b=b%2;
d=c/2;
c=c%2;
delay(100);
digitalWrite(8,HIGH); /* Configuring the Latch enable pins */
digitalWrite(7,LOW);
digitalWrite(6,HIGH);
delay(100);
LED(a,b,c,d);
a=g%2;
b=g/2;
c=b/2;
b=b%2;
d=c/2;
c=c%2;
delay(100);
digitalWrite(8,HIGH); /* Configuring the Latch enable pins */
digitalWrite(7,HIGH);
digitalWrite(6,LOW);
delay(100);
LED(a,b,c,d);
digitalWrite(6,HIGH);
delay(100);
}
void LED(int a,
int b, int c, int d)
{
if(a==1)
{
digitalWrite(9,HIGH);
}
else
{
digitalWrite(9,LOW);
}
if(b==1)
{
digitalWrite(10,HIGH);
}
else
{
digitalWrite(10,LOW);
}
if(c==1)
{
digitalWrite(11,HIGH);
}
else
{
digitalWrite(11,LOW);
}
if(d==1)
{
digitalWrite(12,HIGH);
}
else
{
digitalWrite(12,LOW);
}
}
void setup() {
pinMode(5,INPUT);
pinMode(13,OUTPUT);
pinMode(8,OUTPUT);
pinMode(7,OUTPUT);
pinMode(6,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
pinMode(4,INPUT);
//Serial.begin(9600);
}
void loop() {
digitalWrite(13,LOW);
if(count<2 && digitalRead(4)==LOW) /*Setting conditions for loop */
{
if(digitalRead(sensorpin)==HIGH)
{
digitalWrite(13,HIGH);
Sw.start();
/*Starting stopwatch */
delay(100);
count=count+1;
if(count==2)
{
Sw.stop(); /* Stopping stopwatch */
Elapsed=Sw.elapsed();
rpm=60000/Elapsed;
//Serial.println(rpm);
Display(rpm);
Sw.reset();
count=0;
}
}
}
}
Here we have used Arduino ‘millis()’
function for time keeping.
·
Constrain on the motor: -
Suppose the sensor is placed at distance r’
from the rotor centre. The width of the square cut is ‘h’.
Let the RPM of that particular machine is ‘R’.
The angle at the centre = ɵ =h/r'
t=60/2πR*θ second(s)
S0,θ=2πRt/60 rad
=>h/r'=2πRt/60 rad
=>h=2πRt/60*r' rad
Assuming the width is very small, time
required to travel that angle is ‘t’.
For example, let R=300, r’= 3cm.
Arduino takes very less time to sense the rotation, let us take it as 1
millisecond.
Then the maximum width
Which is equals to 0.09 cm. So if the
width is greater than this the result obtained by that circuit will be
ambiguous. We intentionally introduced some delay in the code as to cut a width
of 0.09cm is very difficult.
·
Constrain on Atmega8A-PU microcontroller: -
ð Let, the time required to sense two consecutive movement detection
is ‘T’. That is uC can’t do no faster than this.
Then the maximum rpm it can measure
For example if T= 1 millisecond then
RPM = 1000.
·
Conclusion: -
The
total cost of that project is INR 500. The results obtained by our measurement
circuit are highly satisfactory. We also plotted the voltage across motor and
corresponding RPM.