AddThis

Bookmark and Share

Thursday, 29 July 2010

DC Motor Speed Control using PWM

This project gives a speed control of DC motor through PWM method. The Dc motor is derived by the L298 driver IC.

You can also control the direction of the motor.

There are three buttons to control the motor. Also a bar graph Led display indicate the speed of the motor.

An proteus simulation file is also available at the download so that you can check the code on your PC.

Project from this Link

Circuit Diagram

DC-moto-speed-control

Bascom Code

$regfile = "m16def.dat"
$crystal = 1000000
'============================================================================
Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Down , Prescale = 1024
Config Portb = Input
Config Portc = Output
Config Porta = Output
'============================================================================
Dim A As Word , B As Bit
'============================================================================
Declare Sub Progress(num As Word)
'============================================================================
A
= 100
Pwm1a = A

Portc.0 = 1
Portc.1 = 0
B
= 0
'============================================================================
Do
'////////////////////////////////////////////////////////////////////////////
If Pinb.0 = 1 Then
A
= A + 10
If A >= 250 Then A = 250
Pwm1a = A
Waitms 250
End If
'////////////////////////////////////////////////////////////////////////////
If Pinb.1 = 1 Then
A
= A - 10
If A <= 10 Then A = 10
Pwm1a = A
Waitms 250
End If
'////////////////////////////////////////////////////////////////////////////
If Pinb.2 = 1 Then

If B = 0 Then
B
= 1
Portc.0 = 0
Portc.1 = 1
Elseif B = 1 Then
B
= 0
Portc.0 = 1
Portc.1 = 0
End If
Waitms 250

End If
'////////////////////////////////////////////////////////////////////////////
Call Progress(a)
'////////////////////////////////////////////////////////////////////////////
Loop
'============================================================================
End
'/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

Sub Progress(num As Word)

If Num < 25 Then
Portc.7 = 1
Portc.6 = 0
Porta = 0
End If
If Num < 50 And Num >= 25 Then
Portc.6 = 1
Portc.7 = 1
Porta = 0
End If
If Num < 75 And Num >= 50 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B00000001
End If
If Num < 100 And Num >= 75 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B00000011
End If
If Num < 125 And Num >= 100 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B00000111
End If
If Num < 150 And Num >= 125 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B00001111
End If
If Num < 175 And Num >= 150 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B00011111
End If
If Num < 200 And Num >= 175 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B00111111
End If
If Num < 225 And Num >= 200 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B01111111
End If
If Num < 255 And Num >= 225 Then
Portc.6 = 1
Portc.7 = 1
Porta = &B11111111
End If

End Sub

5 comments:

  1. Sir,
    i am b tech student interested in this project.will u please sent me more details of the project to ancyvarghese1990@yahoo.com

    ReplyDelete
  2. sir,
    i,varun kumar,final year student is curently delaing with this project...can u pls send me te live project details for this project....my id id varunreddypolala@gmail.com

    ReplyDelete
  3. sir,
    i am be student i have interest in electric projects can u please send the recent project details to my id tat is hrshvardhan503@gmail.com plz

    ReplyDelete
  4. give me ur hex file plz!!
    aman.rocks.mnnit@gmail.com

    ReplyDelete
  5. hi, i'm iyanda alaba,i'm interested inthis project particurlarly using an ne556 timer and its pproteus simulation. pls kindly send the details to ma id: labzie@yahoo.com.

    ReplyDelete

There was an error in this gadget