Outcome Based Lab Task Report
Outcome Based Lab Task Report
TASK REPORT
1
SPEED CONTROL OF DC MOTOR USING PIC
MICROCONTROLLER
Submitted by
UMAMAHESWARI M
NOVEMBER 2021
2
DECLARATION
I affirm that the lab task work titled “Speeed control of DC Motor Using PIC
Microcontroller” being submitted as the record of original work done by us under the
guidance of Mr. R. Ashokkumar , Assistant Professor - II, Department of Electrical and
Electronics Engineering.
UMAMAHESWARI M
(201EE232)
3
TABLE OF CONTENTS
1. INTRODUCTION 6
1.1 OBJECTIVE OF TASK 6
2.4 CODE 10
3.1 OUTPUT 12
12
4. CONCLUSION
13
5. REFERENCES
4
OUTCOME BASED LAB TASKS
RUBRICS FORM (*to be filled by the lab handling faculty only)
Experiments mapped:
1.
2.
3.
5
Expt. No.: 2 SPEED CONTROL OF DC MOTOR USING PIC
1.INTRODUCTION
1.1 OBJECTIVE OF TASK
The main objective of the task is to control the speed of the DC motor
along with varying the direction of rotation of the DC motor. In this task it is achieved by using
the pic microcontroller. Here PIC 16F877A type of microcontroller is used for the simulation in
proteus software.
PIC16F877A
DC motor
Push buttons
Resistors
Potentiometer
LEDs
6
2. METHODOLOGY
In this task, the speed of the DC motor can be controlled by controlling the
armature resistance to control the voltage drop across the armature. This method also
When the variable resistor reaches its minimum value, the armature resistance is at a
normal one, and therefore, the armature voltage drops. When the resistance value is
gradually increased, the voltage across the armature decreases. This in turn leads to a
PROCEDURE
7
The circuit connections are made as per the diagram shown below.
● The components we have used here are potentiometer, push button, L293D
motor driver , led and dc motor.
● If we apply +ve to one lead and ground to another , the motor will rotate in
one direction if we reverse the connection motor will rotate in the opposite
direction .
V = Eb + IaRa
V is the supplied voltage, Eb is the back EMF, Ia is the armature current, and Ra is
the armature resistance.
Eb = (PøNZ)/60A.
P – number of poles,
A – constant
Z – number of conductors
V = ((PøNZ)/60A) + IaRa
8
N = K (V – IaRa)/ ø, K is a constant
2.4 CODE
9
#include <16F877A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#device ADC = 10
#use delay(clock = 8000000)
#use fast_io(B)
#use fast_io(C)
unsigned int16 i ;
void main(){
port_b_pullups(TRUE); // Enable PORTB pull-ups
output_b(0); // PORTB initial state
set_tris_b(7); // Configure RB0, RB1 & RB2 as inputs
output_c(0); // PORTC initial state
set_tris_c(0); // Configure PORTC pins as outputs
setup_adc(ADC_CLOCK_DIV_32); // Set ADC conversion time to 32Tosc
setup_adc_ports(AN0); // Configure AN0 as analog
set_adc_channel(0); // Select channel AN0
setup_timer_2(T2_DIV_BY_16, 255, 1); // Set PWM frequency to 488Hz
delay_ms(100); // Wait 100ms
while(TRUE){
i = read_adc(); // Read from AN0 and store in i
if(input(PIN_B3) == 1) // If direction 1 is selected
set_pwm1_duty(i); // Set pwm1 duty cycle
if(input(PIN_B4) == 1) // If direction 2 is selected
set_pwm2_duty(i); // Set pwm2 duty cycle
delay_ms(10); // Wait 10ms
10
if(input(PIN_B0) == 0){ // If RB0 button pressed
if(input(PIN_B3) == 0){ // If direction 1 not already selected
output_b(0); // Both LEDs OFF
setup_ccp1(CCP_OFF); // CCP1 OFF
setup_ccp2(CCP_OFF); // CCP2 OFF
output_c(0); // PORTC pins low
delay_ms(100); // Wait 100ms
setup_ccp1(CCP_PWM); // Configure CCP1 as a PWM
output_high(PIN_B3); // RB3 LED ON
}}
if(input(PIN_B1) == 0){ // If RB1 button pressed
if(input(PIN_B4) == 0){ // If direction 2 not already selected
output_b(0); // Both LEDs OFF
setup_ccp1(CCP_OFF); // CCP1 OFF
setup_ccp2(CCP_OFF); // CCP2 OFF
output_c(0); // PORTC pins low
delay_ms(100); // Wait 100ms
setup_ccp2(CCP_PWM); // Configure CCP2 as a PWM
output_high(PIN_B4); // RB4 LED ON
}}
if(input(PIN_B2) == 0){ // If RB2 button pressed
setup_ccp1(CCP_OFF); // CCP1 OFF
setup_ccp2(CCP_OFF); // CCP2 OFF
output_c(0); // PORTC pins low
output_b(0);} // Both LEDs OFF
}
}
11
3. RESULTS AND DISCUSSION
3.1 OUTPUT
4. CONCLUSION
Electric motor is accomplished in almost every mechanical movement that
we see around us. Electric machines are a means of converting energy. Motors take
electrical energy and produce mechanical energy. Electric motors are used to
power hundreds of devices we use in everyday life. With this very basic concept of
direction and speed control we can move the motor clockwise and anticlockwise as
a result lift can move in forward and backward direction and we can vary the speed
12
of a dc motor.The speed control mechanism is applicable in many cases like
and the movement of motors in elevators where different types of DC motors are
used. Speed control of the DC motor is one of the most useful features of the
motor.
5. REFERENCES
https://www.electrical4u.com/speed-control-of-dc-motor/
https://simple-circuit.com/pic16f877a-l293d-dc-motor-control-proteus-simulation/
13
PROCESS PLAN
Proposed Process Plan Actual Plan Executed
Writing the code for the simulation in Writing the code for the simulation in
mikroC software. – 30 mins mikroC software. – 30 mins
Verification and compiling the code Verification and compiling the code
in the mikroCsoftware. – 15 mins in the mikroCsoftware. – 15 mins
Uploading the compiled mikroC file Uploading the compiled mikroC file
into the PIC microcontroller in into the PIC microcontroller in
proteus software. - 10 mins proteus software. - 10 mins
Simulating the circuit and verifying Simulating the circuit and verifying
the output as control the speed of the the output as control the speed of the
DC motor – 20 mins DC motor – 20 mins
14
Reflection Sheet
S/N Problems Counter measures Status
15
Status Legend :
Self-understood and resolved
Discussed with Trainer and resolved
Yet to discuss / find solution
16