You are on page 1of 31

CHAPTER 1 - INTRODUCTION

1.1 INTRODUCTION

The DC motor converts the mechanical power into dc electrical power. One of the most
important features of the DC motor is that their speed can easily be control according to the
requirement by using simple methods. Such type of control is impossible in an AC motor.
Until the 1960s, the only really satisfactory way of obtaining the variable-voltage DC supply
needed for speed control of an industrial DC motor was to generate it with a DC generator.
The generator was driven at fixed speed by an induction motor, and the field of the generator
was varied in order to vary the generated voltage. The motor/generator (MG) set could be
sited remote from the DC motor, and multi-drive sites (e.g. steelworks) would have large
rooms full of MG sets, one for each variable-speed motor on the plant. Three machines (all of
the same power rating) were required for each of these 'Ward Leonard' drives, which was
good business for the motor manufacturer. For a brief period in the 1950s they were
superseded by grid-controlled mercury arc rectifiers, but these were soon replaced by
thyristor converters which offered cheaper first cost, higher efficiency (typically over 95%),
smaller size, reduced maintenance, and faster response to changes in set speed.

The concept of the speed regulation is different from the speed control. In speed regulation,
the speed of the motor changes naturally whereas in dc motor the speed of the motor changes
manually by the operator or by some automatic control device. The development of high
performance motor drives is very important in industrial as well as other purpose
applications. Generally, a high performance motor drive system must have good dynamic
speed command tracking and load regulating response. The dc motors are used in various
applications such as defences, industries, Robotics etc. DC drives, because of their simplicity,
ease of application, reliability and favourable cost have long been a backbone of industrial
applications. The project provides the efficient and simple method to motorizing ATmega
328p microcontroller and motor driver circuit. The aim of the circuit presented here is to keep
the permanent magnet dc motor running at a constant speed, set externally. To do this, the
current through, and the voltage across, the brushes of the motor are monitored. The voltage
consists of two components: First, a back-EMF generated by the windings of the armature
moving through the magnetic field of the motor. Secondly, there’s a voltage caused by the
current passing through the real resistance of the windings and the brushes. The current

1
through the motor armature is caused to pass through a resistance (rm/10) that is, for example,
approximately 0.1 as large as the ohmic resistance of the motor. The voltage across this
resistance is then amplified by a factor of approximately 10, and the resulting voltage is
added to a second voltage in a differential amplifier. This second voltage is the voltage as
measured across the two brushes of the motor.

In constant speed application of D.C motor where speed fluctuation of the motor is negligible
a close loop type of system is used. In this project we use a close loop speed control scheme
of D.C machine in which a PID controller is used to correct the output which is speed of D.C
motor to its set value. In this arrangement motor is driven through a motor driver circuit
which supply the required power to the motor as controlling unit cannot supply that much
power. When motor is loaded with a mechanical load the RPM of motor decreases which is
undesirable in constant speed drive applications. As soon as speed measurement unit sense
the decrease in speed it provide a feed back to the control unit by generating an error signal.
The PID controller programmed inside the controlling unit generate a correcting signal
according to the error signal and controlling unit control the gate driver circuit. On obtaining
the signal from the controlling unit gate driver increase the power delivered to the motor
which return’s the motor to original set RPM.

2
CHAPTER 2 – LITERATURE REVIEW

2.1 Speed Control of Shunt Motor

2.1.1 Flux Control Method

Fig. 1. Flux control method

It is already explained above that the speed of a dc motor is inversely proportional to the flux
per pole. Thus by decreasing the flux, speed can be increased and vice versa.

To control the flux, a rheostat is added in series with the field winding, as shown in the circuit
diagram. Adding more resistance in series with the field winding will increase the speed as it
decreases the flux. In shunt motors, as field current is relatively very small, Ish2R loss is
small. Therefore, this method is quite efficient. Though speed can be increased above the
rated value by reducing flux with this method, it puts a limit to maximum speed as weakening
of field flux beyond a limit will adversely affect the commutation.

3
2.1.2. Armature Control Method

Fig. 2. Armature control method

Speed of a dc motor is directly proportional to the back emf Eb and Eb = V - IaRa. That means,
when supply voltage V and the armature resistance Ra are kept constant, then the speed is
directly proportional to armature current Ia. Thus, if we add resistance in series with the
armature, Ia decreases and, hence, the speed also decreases. Greater the resistance in series
with the armature, greater the decrease in speed.

2.1.3. Voltage Control Method

Ward-Leonard System

This system is used where very sensitive speed control of motor is required (e.g electric
excavators, elevators etc.). The arrangement of this system is as shown in the figure at right.
M2 is the motor to which speed control is required. M1 may be any AC motor or DC
motor with constant speed. G is a generator directly coupled to M1. In this method, the
output from generator G is fed to the armature of the motor M2 whose speed is to be
controlled. The output voltage of generator G can be varied from zero to its maximum value
by means of its field regulator and, hence, the armature voltage of the motor M 2 is varied
very smoothly. Hence, very smooth speed control of the dc motor can be obtained by this
method.

4
Fig. 3. Voltage control method

2.2 Speed Control Of Series Motor

2.2.1 Flux Control Method

Field diverter: A variable resistance is connected parallel to the series field as shown in fig 4.
This variable resistor is called as a diverter, as the desired amount of current can be diverted
through this resistor and, hence, current through field coil can be decreased. Thus, flux can be
decreased to the desired amount and speed can be increased.
Armature diverter: Diverter is connected across the armature as shown in fig 4.
For a given constant load torque, if armature current is reduced then the flux must increase, as
Ta ∝ ØIa. This will result in an increase in current taken from the supply and hence flux Ø
will increase and subsequently speed of the motor will decrease.
Tapped field control: As shown in fig 5 field coil is tapped dividing number of turns. Thus we
can select different value of Ø by selecting different number of turns.

5
Fig. 4. Field diverter

Fig. 5. Tapped field control

6
CHAPTER 3- METHODLOGY
3.1 D.C. MOTOR

Fig. 6. DC Motor block diagram

DC permanent magnet motors are known for delivering high power in a compact,
portable package. These motors feature high starting torque with constant torque throughout
the speed range for consistency and dependability. Ideal for applications requiring motor
speed adjustment and reversing capabilities, such as: pumps, turntables, textile machinery,
treadmills, reeling equipment, sports equipment, and medical equipment.

Construction

In a PMDC motor, permanent magnets (located in stator) provide magnetic field, instead of
stator winding. The stator is usually made from steel in cylindrical form. Permanent magnets
are usually made from rare earth materials or neodymium.

The rotor is slotted armature which carries armature winding. Rotor is made from layers of
laminated silicon steel to reduce eddy current losses. Ends of armature winding are connected
to commutator segments on which the brushes rest. Commutator is made from copper and
brushes are usually made from carbon or graphite. DC supply is applied across these brushes.
The commutator is in segmented form to achieve unidirectional torque. The reversal of
direction can be easily achieved by reversing polarity of the applied voltage.

7
Characteristics

Characteristics of PMDC motors are similar to the characteristics of dc shunt motor in terms
of torque, speed and armature current. However, speed-torque characteristics are more linear
and predictable in PMDC motors.

Fig. 7. Characteristics of PMDC motor

The advantages of a PMDC motor are:

1. No need of field excitation arrangement.


2. No input power in consumed for excitation which improve efficiency of DC motor.
3. No field coil hence space for field coil is saved which reduces the overall size of the
motor.
4. Cheaper and economical for fractional kW rated applications.
The disadvantages of a PMDC motor are:

1. The armature reaction of DC motor cannot be compensated hence the magnetic


strength of the field may get weak due to the demagnetizing effect of the armature
reaction.
2. There is a chance of getting the poles permanently demagnetized (partial) due to
excessive armature current during the starting, reversal, and overloading conditions of
the motor.
3. The field in the air gap is fixed and limited – it cannot be controlled externally. This
makes it difficult for this type of motor to achieve efficient speed control of DC
motor in this type of motor is difficult.

8
Applications of Permanent Magnet DC Motor or PMDC Motor

1. PMDC motor is extensively used where small DC motors are required and also very
effective control is not required, such as in automobiles starter, toys, wipers, washers,
hot blowers, air conditioners, computer disc drives and in many more.

3.2 SUPPLY

3.2.1. STEP DOWN TRANSFORMER

A step-down transformer converts the high voltage (HV) and low current from the primary
side to the low voltage (LV) and high current value on the secondary side. This transformer
type has a wide application in electronic devices and electrical systems. When it comes to the
operation voltage, the step-up transformer application can be roughly divided in two groups:
LV (voltages up to 1 kV) and HV application (voltages above 1 kV). The first LV application
refers to the transformers in electronic devices. Supplying the electronic circuits requires a
low voltage value (e.g. 5V, even lower values nowadays).
A step down transformer is used to provide this low voltage value which is suitable for
electronics supplying. It transforms home voltage (230/120 V) from primary to a low voltage
on the secondary side which is used for the electronic supplying. If electronic devices are
designed to have higher nominal power, transformers with high operating frequency are used
(kHz-s). The transformers with higher nominal power value and 50/60 Hz nominal frequency
would be too large and heavy. Also, the daily used battery chargers use the step-down
transformer in its design.

9
Fig. 8. Step Up Transformer.

The step-down transformers have a very important function in power system. They lower the
voltage level and adapt it for energy consumers. It is performed in several steps described
below:

 The next voltage level transformation step is adapting transmission voltage to the
distribution level. The characteristic voltage ratios in this case are 220/20 kV, 110/20
kV (also the LV secondary voltages 35 kV and 10 kV can be found). The nominal
power of those transformers is up to 60 MVA (usually 20 MVA). The on-load tap
changer is almost always installed in these transformers. A voltage regulation is the
main function of tap changer. In USA the tap changer is based on LV side, and in rest
of the world mostly on the HV transformer side.
 The final voltage transformation step is adapting the voltage to the home voltage level

These transformers are known as small distribution transformers with nominal power
up to 5 MVA (mostly below of 1 MVA) and with nominal voltage values 35, 20, 10
kV on HV side and 400/200 V on LV side. It is noticeable that those transformers
have high turns ratio. They usually have de-energized tap changer with 5 tap position
(+/- 2 tap position) and do not have on load tap changer.

10
3.2.2. BRIDGE RECTIFIER

The Full Wave Bridge Rectifier Another type of circuit that produces the same output
waveform as the full wave rectifier circuit above, is that of the Full Wave Bridge Rectifier.
This type of single phase rectifier uses four individual rectifying diodes connected in a closed
loop “bridge” configuration to produce the desired output. The main advantage of this bridge
circuit is that it does not require a special centre tapped transformer, thereby reducing its size
and cost. The single secondary winding is connected to one side of the diode bridge network
and the load to the other side as shown below.

The Diode Bridge Rectifier

Fig.9.Bridge Rectifier.

The four diodes labelled D1 to D4 are arranged in “series pairs” with only two diodes
conducting current during each half cycle. During the positive half cycle of the supply,
diodes D1 and D2 conduct in series while diodes D3 and D4 are reverse biased and the
current flows through the load as shown below.

11
The Positive Half-cycle

Fig. 10 Positive Half of Bridge Rectifier.

During the negative half cycle of the supply, diodes D3 and D4 conduct in series, but
diodes D1 and D2 switch “OFF” as they are now reverse biased. The current flowing through
the load is the same direction as before.

The Negative Half-cycle

Fig. 11. Negative Half of Bridge Rectifier.

As the current flowing through the load is unidirectional, so the voltage developed across the
load is also unidirectional the same as for the previous two diode full-wave rectifier, therefore
the average DC voltage across the load is 0.637Vmax.

However in reality, during each half cycle the current flows through two diodes instead of
just one so the amplitude of the output voltage is two voltage drops ( 2*0.7 = 1.4V ) less than
the input VMAX amplitude. The ripple frequency is now twice the supply frequency (e.g.
100Hz for a 50Hz supply or 120Hz for a 60Hz supply.)

12
Although we can use four individual power diodes to make a full wave bridge rectifier, pre-
made bridge rectifier components are available “off-the-shelf” in a range of different voltage
and current sizes that can be soldered directly into a PCB circuit board or be connected by
spade connectors.

The image to the right shows a typical single phase bridge rectifier with one corner cut off.
This cut-off corner indicates that the terminal nearest to the corner is the positive or +ve
output terminal or lead with the opposite (diagonal) lead being the negative or -ve output
lead. The other two connecting leads are for the input alternating voltage from a transformer
secondary winding.

The Smoothing Capacitor

We saw in the previous section that the single phase half-wave rectifier produces an output
wave every half cycle and that it was not practical to use this type of circuit to produce a
steady DC supply. The full-wave bridge rectifier however, gives us a greater mean DC value
(0.637 V max) with less superimposed ripple while the output waveform is twice that of the
frequency of the input supply frequency.

We can improve the average DC output of the rectifier while at the same time reducing the
AC variation of the rectified output by using smoothing capacitors to filter the output
waveform. Smoothing or reservoir capacitors connected in parallel with the load across the
output of the full wave bridge rectifier circuit increases the average DC output level even
higher as the capacitor acts like a storage device as shown below.

3.2.3. CAPACITOR

The capacitor is a component which has the ability or “capacity” to store energy in the form
of an electrical charge producing a potential difference (Static Voltage) across its plates,
much like a small rechargeable battery.

There are many different kinds of capacitors available from very small capacitor beads used
in resonance circuits to large power factor correction capacitors, but they all do the same
thing, they store charge.

13
In its basic form, a capacitor consists of two or more parallel conductive (metal) plates which
are not connected or touching each other, but are electrically separated either by air or by
some form of a good insulating material such as waxed paper, mica, ceramic, plastic or some
form of a liquid gel as used in electrolytic capacitors. The insulating layer between a
capacitors plates is commonly called the Dielectric. Due to this insulating layer, DC current
cannot flow through the capacitor as it blocks it allowing instead a voltage to be present
across the plates in the form of an electrical charge.

The conductive metal plates of a capacitor can be either square, circular or rectangular, or
they can be of a cylindrical or spherical shape with the general shape, size and construction of
a parallel plate capacitor depending on its application and voltage rating.

When used in a direct current or DC circuit, a capacitor charges up to its supply voltage but
blocks the flow of current through it because the dielectric of a capacitor is non-conductive
and basically an insulator. However, when a capacitor is connected to an alternating current
or AC circuit, the flow of the current appears to pass straight through the capacitor with little
or no resistance.

There are two types of electrical charge, positive charge in the form of Protons and negative
charge in the form of Electrons. When a DC voltage is placed across a capacitor, the positive
(+ve) charge quickly accumulates on one plate while a corresponding and opposite negative
(-ve) charge accumulates on the other plate. For every particle of +ve charge that arrives at
one plate a charge of the same sign will depart from the -ve plate.

Then the plates remain charge neutral and a potential difference due to this charge is
established between the two plates. Once the capacitor reaches its steady state condition an
electrical current is unable to flow through the capacitor itself and around the circuit due to
the insulating properties of the dielectric used to separate the plates.

The flow of electrons onto the plates is known as the capacitors Charging Current which
continues to flow until the voltage across both plates (and hence the capacitor) is equal to the
applied voltage Vc. At this point the capacitor is said to be “fully charged” with electrons.

14
3.2.4. VOLTAGE REGULATOR

A simple voltage/current regulator can be made from a resistor in series with a diode (or
series of diodes). Due to the logarithmic shape of diode V-I curves, the voltage across the
diode changes only slightly due to changes in current drawn or changes in the input. When
precise voltage control and efficiency are not important, this design may be fine. Since the
forward voltage of a diode is small, this kind of voltage regulator is only suitable for low
voltage regulated output. When higher voltage output is needed, a zener diode or series of
zener diodes may be employed. Zener diode regulators make use of the zener diode's fixed
reverse voltage, which can be quite large.

Feedback voltage regulators operate by comparing the actual output voltage to some fixed
reference voltage. Any difference is amplified and used to control the regulation element in
such a way as to reduce the voltage error. This forms a negative feedback control loop
increasing the open-loop gain tends to increase regulation accuracy but reduce stability.
(Stability is avoidance of oscillation, or ringing, during step changes.) There will also be a
trade-off between stability and the speed of the response to changes. If the output voltage is
too low (perhaps due to input voltage reducing or load current increasing), the regulation
element is commanded, up to a point, to produce a higher output voltage–by dropping less of
the input voltage (for linear series regulators and buck switching regulators), or to draw input
current for longer periods (boost-type switching regulators); if the output voltage is too high,
the regulation element will normally be commanded to produce a lower voltage. However,
many regulators have over-current protection, so that they will entirely stop sourcing current
(or limit the current in some way) if the output current is too high, and some regulators may
also shut down if the input voltage is outside a given range.

3.3 PID CONTROLLER

PID controller is universally accepted and most commonly used controller in industrial
application because PID controller is simple, provide good stability and rapid response. PID
stands for proportional, integral, derivative. In each application, coefficient of these three
actions are varied to get optimal response and control. Controller input is error signal and
output is given to the plant/process. Output signal of controller is generated, in such a way
that, output of plant is try to achieve desired value.

15
PID controller is a Close loop system which has feedback control system and it compares the
Process variable (feedback variable) with set Point and generates an error signal and
according to that it adjusts the output of system. This process continues until this error gets to
Zero or process variable value becomes equal to set point.

Fig. 12. Block Diagram of PID Controller.

PID controller gives better results than ON/OFF controller. In ON/OFF controller, only two
states are available to control the system. It can either ON or OFF. It will ON when process
value is less than set point and it will OFF when process value is greater than set point. In this
controller, output will never be stable, it will always oscillate around the set point. But PID
controller is more stable and precise compare to ON/OFF controller.

PID controller is a combination of three terms; Proportional, Integral and Derivative. Let us
understand these three terms individually.

PID Modes of Control:

Proportional (P) response:

Term ‘P’ is proportional to the actual value of the error. If the error is large, control output is
also large and if the error is small control output is also small, but gain factor (Kp).

16
Also taking in to account. Speed of response is also directly proportional to proportional gain
factor (Kp). So, the speed of response is increased by increasing the value of Kp but if Kp is
increased beyond normal range, process variable starts oscillating at high rate and make
system unstable.

Fig. 13. Proportional Response.

Here, the resulting error is multiplied with proportionality gain factor (proportional constant)
as shown in above equation. If only P controller is used, at that time, it requires manual reset
because it maintain steady state error (offset).

Integral (I) response:

Integral controller is generally used to decrease the steady state error. Term ‘I’ is integrate
(with respect to time) to the actual value of the error. Because of integration, very small value
of error, results very high integral response. Integral controller action continues to change
until error becomes zero. Integral gain is inversely proportional to the speed of response,
increasing Ki, decrease the speed of response. Proportional and Integral controllers are used
combined (PI controller) for good speed of response and steady state response.

Derivative (D) response:

Derivative controller is used to with combination of PD or PID. It never used alone, because
if error is constant (non-zero), output of the controller will be zero. In this situation, controller

17
behave life zero error, but in actual there are some error (constant). Output of derivative
controller is directly proportional to the rate of change of error with respect to time as shown
in equation. By removing sign of proportionality, we get derivative gain constant (kd).
Generally, Derivative controller is used when processor variables starts oscillating or changes
at a very high rate of speed. D-controller is also used to anticipates the future behavior of the
error by error curve.

Proportional and Integral controller:

This is a combination of P and I controller. Output of the controller is summation of both


(proportional and integral) responses. Mathematical equation is as shown in below;

Proportional and Derivative controller: This is a combination of P and D controller.


Output of controller is summation of proportional and derivative responses. Mathematical
equation of PD controller is as shown below;

Proportional, Integral and Derivative controller: This is a combination of P, I and D


controller.Output of controller is summation of proportional, integral and derivative
responses Thus, by combining this proportional, integral and derivative control response,
formPIDcontroller.

Fig.14.PID Response.

18
3.3.1 ARDUINO NANO

The Arduino Nano is a small, complete, and breadboard -friendly board based on
the ATmega328P (Arduino Nano 3.x). It has more or less the same functionality of
the Arduino Duemilanove, but in a different package. It lacks only a DC power
jack, and works with a Mini-B USB cable instead of a standard one.

Fig. 14. Arduino Nano

19
MICROCONTROLLER ATmega328

Architecture AVR

Operating voltage 5V

Flash memory 32kb of which 2kb used by boot loader

SRAM 2kb

Clock speed 16MHz

Analog in pins 8

EEPROM 1kb

DC Current per I/O pins 40mA (I/O pins)

Input voltage 7-12V

Digital I/O pins 22(6 of which are PWM)

PWM output 6

Power consumption 19mA

PCB size 18*45 mm

Weight 7gm

Product code A000005

Table 1. Arduino technical specification

20
3.3.2 POTENTIOMETER

A potentiometer is a manually adjustable variable resistor with 3 terminals. Two terminals are
connected to both ends of a resistive element, and the third terminal connects to a sliding
contact, called a wiper, moving over the resistive element. The position of the wiper
determines the output voltage of the potentiometer. The potentiometer essentially functions as
a variable voltage divider. The resistive element can be seen as two resistors in series
(potentiometer resistance), where the wiper position determines the resistance ratio of the
first resistor to the second resistor.

A potentiometer is also commonly known as a potmeter or pot. The most common form of
potmeter is the single turn rotary potmeter. This type of pot is often used in audio volume
control (logarithmic taper) as well as many other applications. Different materials are used to
construct potentiometers, including carbon composition, cermet, wire wound, conductive
plastic or metal film.

3.4 IR SENSOR

An infrared sensor is an electronic device, that emits in order to sense some aspects of the
surroundings. An IR sensor can measure the heat of an object as well as detects the
motion.These types of sensors measures only infrared radiation, rather than emitting it that is
called as a passive IR sensor. Usually in the infrared spectrum, all the objects radiate some
form of thermal radiations. These types of radiations are invisible to our eyes, that can be
detected by an infrared sensor.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, The resistances and
these output voltages, change in proportion to the magnitude of the IR light received.

IR Sensor Circuit Diagram and Working Principle

An infrared sensor circuit is one of the basic and popular sensor module in an electronic
device. This sensor is analogous to human’s visionary senses, which can be used to detect
obstacles and it is one of the common applications in real time.This circuit comprises of the
following components

 LM358 IC 2 IR transmitter and receiver pair

21
 Resistors of the range of kilo ohms.
 Variable resistors.
 LED (Light Emitting Diode).

In this project, the transmitter section includes an IR sensor, which transmits continuous IR
rays to be received by an IR receiver module. An IR output terminal of the receiver varies
depending upon its receiving of IR rays. Since this variation cannot be analyzed as such,
therefore this output can be fed to a comparator circuit. Here an operational amplifier (op-
amp) of LM 339 is used as comparator circuit.

3.5 PROGRAMMING

#include <SimpleKalmanFilter.h>

#include <LiquidCrystal.h>

#include <PID_v1.h>

#define PIN_INPUT 0

#define PIN_OUTPUT 3

double Setpoint, Input, Output;

//Specify the links and initial tuning parameters

double Kp=2, Ki=5, Kd=1;

PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);

// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to

const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

int sensorvalue;

int state1 = HIGH;

22
int state2;

float rps;

float rpm;

long prevMillis = 0;

long interval = 50;

long currentTime;

long prevTime = 1;

long diffTime;

int sensorthreshold = 1;

// this value indicates the limit reading between dark and light,

// it has to be tested as it may change acording to the

// distance the leds are placed.

// to see what number is good, check the sensorvalue variable value

// as printed out in the serial monitor

SimpleKalmanFilter simpleKalmanFilter(5, 1, 0.01);

int setRPM = 150;

void setup()

lcd.begin(16, 2);

pinMode(12, INPUT);

Serial.begin(115200);

pinMode(13,OUTPUT);

pinMode(10,OUTPUT);

23
lcd.print("****WEL_COME****");// assign pin 13 led as indicator because we cannot se
the IR light

Serial.println("START");

digitalWrite(10, 1);

analogWrite(9, 100);

delay(1000);

Setpoint = 200;

Setpoint = map(analogRead(A0), 0, 1023, 120, 250);

myPID.SetMode(AUTOMATIC);

void loop()

// Serial.println("l");

sensorvalue = digitalRead(12); // read from pin 0

if(sensorvalue < sensorthreshold)

state1 = HIGH;

else

state1 = LOW;

digitalWrite(13,state1); // as iR light is invisible for us, the led on pin 13

// indicate the state of the circuit.

if(state2!=state1){ //counts when the state change, thats from (dark to light) or

//from (light to dark), remember that IR light is invisible to us.

if (state2>state1){

24
currentTime = micros(); // Get the arduino time in microseconds

diffTime = currentTime - prevTime; // calculate the time diff from the last meet-up

rps = 1000000/diffTime; // calculate how many rev per second, good to know

rpm = 60000000/diffTime; // calculate how many rev per minute

unsigned long currentMillis = millis();

// print to serial at every interval - defined at the variables declaration

if(currentMillis - prevMillis > interval){ // see if now already an interval long

prevMillis = currentMillis;

float estimated_value = simpleKalmanFilter.updateEstimate(rpm);

Serial.print(rps); Serial.print(',');

Serial.print(rpm);

Serial.print(',');

Serial.println(estimated_value);

lcd.setCursor(0,0);

lcd.print("RPM:" + String(rpm) + " ");

lcd.setCursor(0,1);

lcd.print("SET:" + String(Setpoint) + " ");

/// PID START

Input = estimated_value;

double gap = abs(Setpoint-estimated_value); //distance away from setpoint

Serial.println("gap = " + String(gap));

// if (gap < 10)

// { //we're close to setpoint, use conservative tuning parameters

25
// myPID.SetTunings(consKp, consKi, consKd);

// }

// else

// {

// //we're far from setpoint, use aggressive tuning parameters

// myPID.SetTunings(aggKp, aggKi, aggKd);

// }

myPID.Compute();

Serial.println("OUTPUT = " + String(Output));

analogWrite(9, Output);

Setpoint = map(analogRead(A0), 0, 1023, 120, 250);

// delay(200);

// PID END

prevTime = currentTime;

state2 = state1;

if (Serial.available() > 0)

if (Serial.read() == 'T')

26
// delay(10);

int frq = Serial.parseInt();

lcd.setCursor(0, 1);

lcd.print("Hz:" + String(frq) + " ");

/*

//only for testing to determine the sensorthreshold value

delay(500);

Serial.println(sensorvalue);

*/

3.6 WORKING

1.Working of power supply circuit: - Here we have two transformers one for supply of dc
machine and other for the supply of driver circuit,firstly the 220v is converted to 12v by a
step down transformer. Now the supply is provided to bridge rectifier circuit and converted
into dc supply ,that is required for supply purpose of other elements now a capacitor is
provided for the filtering purpose and then again it is given to voltage regulator (converted to
5v from 12v). There ahead a power led is connected with a 20ohm resistor. similarly the same
supply is provided to the 12 v dc motor directly after bridge rectifier.

2.Working of driver circuit: - the 5v is now further provided to


microcontroller(atmega328) along with a crystal oscillator(16mhz) .it is used for supply
purpose to microcontroller. There is a also a ceramic capacitor (22pico farad) for filtering
purpose. Now there is a reset switch between the reset pin of micro controller along with a
resistor. There is a transistor (TIP122) for the indirect connection with micro controller to the
dc motor for the control signal purpose.

3.Sensing of rotation: -there is a infrared sensor along the dc motor which senses the
rotation per minute. Whenever the load is applied the speed falls and the torque tries to

27
increase it to the constant.the working of IR sensor is that there are two LEDS one reflects the
light from the black part of laod but when the reflection increases from the white part so the
photodiode trips the signal and count increases and so on.

4.Proportional integral display:-when the default speed is set to the eg.150 and when the
load is applied the speed falls and then it tries to increase it by the closed loop operation of
PID in case the speed overshoots the required speed it tries to compensate then by
undershooting itself and tries to come in equilibrium condition which is set by the
potentiometer.

5.Role of potentiometer:-there two methods to set the speed either via potentiometer or by
changing the programming part ,so potentiometer is used for changing the set speed.

28
CHAPTER 4 – RESULT

29
CHAPTER 5 – FUTURE SCOPE
This project is aimed to create a constant RPM closed loop dc motor drive with the help
of static control devices. In this project a small dc machine unit is used to present the
concept and implementation of the drive. This method can also be used to provide
solution for constant speed drive for larger rating dc machine by using high power motor
driver circuit like chopper etc. Following are given some areas where this scheme can
provide cost effective solution for the speed fluctuation problem.

1) Automation Industry.

2) Cooling fans used to cool large machines like alternators etc.

3) Air Compressor.

4) Printing machines

5) Rolling mills

30
CHAPTER 6- REFERENCES
[1] Design of PID controller for DC Motor Speed Control Using Arduino Microcontroller
Thirupathi Allam 1, Matla Raju 2 , S.Sundeep Kumar 3.

[2] Understanding and Design of an Arduino-based PID Controller Dinesh Bista Virginia
Commonwealth University.

[3] Design of a new PID controller based on Arduino Uno R3 with application to
household refrigerator Eddy Erham 1,* , Markus 1 , Ary Surjanto 1 ,and Jaka Rukmana.

[4] Beginning Aurdino Programming-Bria Adams.

[5] Beginning C For Aurdino- Phd Jack Purdum.

[6] Microcontroller performance for DC motor speed control system.1 samsul noor

and 2 mohd khair hassan.

31

You might also like