Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Speed control of DC motor using Keypad and PWM

Status
Not open for further replies.

niranjan23

Member level 5
Joined
Jan 22, 2012
Messages
94
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
2,109
Hello!!

I have problem with my project Speed control of DC motor using KEYPAD and pwm. I have interfaced 4x3 Keypad and 16x2 LCD, I want to control speed of DC motor using keypad input like 25% Duty cycle 50% duty cycle etc.!!!
My problem is in program ..that is I cannot stay in conditional loop after I enter value by keypad. for example when I enter 50% through keypad it goes in while loop for once and only it will never stay in loop!.:-:)-(
I am attaching my Code in keil and Simulation in Proteus! Below with Circuit diagram.
Circuit diagram is general configuration for testing only.!!!

You will know what is the problem after running the simulation and code!! Please tell me whats wrong I am doing!!
Thank you!!

View attachment simu.PDF
View attachment DC Motor control.rar
 

Hi,

simulation or not...
I recommend to draw the circuit in a way that makes it possible to work in reality:
* You need a free wheeling diode across the motor
* you need a base resistor at yout bjt.

****

To your problem:
Many microcontrollers have built in PWM perifieral.
* If you have one with built in PWM, then use it.
* If you have one without built in PWM, then you need to generate the motor PWM using timer within an ISR.

Klaus
 
Hi,

simulation or not...
I recommend to draw the circuit in a way that makes it possible to work in reality:
* You need a free wheeling diode across the motor
* you need a base resistor at yout bjt.

****

To your problem:
Many microcontrollers have built in PWM perifieral.
* If you have one with built in PWM, then use it.
* If you have one without built in PWM, then you need to generate the motor PWM using timer within an ISR.

Klaus

Yes I am using microcontroller that dont have PWM and im generating PWM using Timers...my problem is when I choose duty cycle % using keypad it doesnt stay in concditonal loop!!!
Its my programming problem ...tell me if it is or not!!
Thanks!!
 

Hi,

I don´t see the use of timers (pwm generated in ISR), instead I see the use of busy waits (pwm generated in main loop with delay_ms()).

--> do the PWM in ISR (without delay_function) and the key pad in main loop.

or even better: use a uC with hardware PWM

Klaus
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top