Author Topic: PWM signal for L293D and motor  (Read 9993 times)

0 Members and 1 Guest are viewing this topic.

Offline BatienzaxcoreTopic starter

  • Full Member
  • ***
  • Posts: 58
  • Helpful? 0
  • Just me. Really.
PWM signal for L293D and motor
« on: September 04, 2012, 03:56:59 AM »
Not really sure where to post this... Anyway, would varying the duty cycle of a PWM output of a PIC16F877A change the speed of a high-torque DC motor? The flow of the signal would be lime this:

16F877A uC ---> L293D H-bridge ---> High Torque DC Motor

Could you help me on the programming stuff? I' not really good at it.

And another question. Could you give me advice on how a potentiometer could vary the duty cycle of the PWM? I am planning to connect the potentiometer to the one of the ADC pins of the uC, and have a toggle switch with 3 choices (forward, stop, reverse), then the uC would program the PWM signal depending on the input (My plan is 5V for forward and ground for reverse). Is it possible?

Thank you for your replies.
Music is really my thing. But I am haunted by my fantasies of seeing robots rock out - A literal metal band.

Offline ankitbansal

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: PWM signal for L293D and motor
« Reply #1 on: September 04, 2012, 11:46:36 AM »
To control the speed of dc motor using l293d, feed the pwm wave to enable pin of l293d. You can use the 8/16 bit timer on uC to generate pwm.

To control the direction of spin use any two port pins as output and connect them to  1a and 2a pins of l293d. 1,0 would turn motor in one direction and 0,1 in other.

Based on the adc value of the pin connected to potentiometer, you can vary the timer count so that duty cycle of pwm changes and thus the speed of motor.


Hth.

Ankit

Offline BatienzaxcoreTopic starter

  • Full Member
  • ***
  • Posts: 58
  • Helpful? 0
  • Just me. Really.
Re: PWM signal for L293D and motor
« Reply #2 on: September 04, 2012, 01:28:25 PM »
Did you just say, feed the pwm signal to the enable pin? Not at the input pin of the l293d?
Music is really my thing. But I am haunted by my fantasies of seeing robots rock out - A literal metal band.

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: PWM signal for L293D and motor
« Reply #3 on: September 04, 2012, 06:19:01 PM »
Yes he did. The enable pin is an Input. Check the L293D data sheet for a description of its pins and the truth table for control.

ankit's description is right on.

Now, read the PICs data sheet and google for example projects. What you want to do is very common and there is lots of info on how.
Learn to use the SIMulator in MPLAB to check and debug your code. If you really get stuck post what you have done to get help.
« Last Edit: September 04, 2012, 06:21:55 PM by waltr »

Offline BatienzaxcoreTopic starter

  • Full Member
  • ***
  • Posts: 58
  • Helpful? 0
  • Just me. Really.
Re: PWM signal for L293D and motor
« Reply #4 on: September 05, 2012, 07:06:03 AM »
Alright :D Thanks to the two of you, especially you, Mr. waltr, who has been very helpful in my posts. Currently, I am having problems with the selection of the right motor, so I would focus on that first. Since I had a lot of time a few days ago, I decided to post here about the PWM signal, which is a rather interesting topic for me that concerns the PIC16F877A. I'm getting excited at the thought of it!  ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D.
Music is really my thing. But I am haunted by my fantasies of seeing robots rock out - A literal metal band.

 


data_list