Driving 2 DC motor with pic

Thread Starter

Chaabane

Joined Nov 30, 2009
37
Hello,

I'm working on a project that consist to control 2 DC motors (vehicle),i didn't choose them yet,but they will be about 10-20 V

for each motor i have to :

  • use H-dridgefor direction.
  • speed feedback
I'll use a pic to drive this 2 motors,so i need one with 2 separates PWM (not just 2 CCP module).
what i really need here is some advice,links,ideas... before i start
especially about wich pic i should choose.i'm using pic16F876 and i can also go for 18Fxx
 

BMorse

Joined Sep 26, 2009
2,675
why not the Pic16F887, newer than the F876, and it has 2 PWM modules.... then also use the LMD18200T H-Bridge, or the LMD18201T, (the only difference is one has a output pin for current draw, other does not, but both can handle 55 Volts and up to 6 Amps max current draw).... for speed feedback I would use an encoder to determine RPM's....
 

Thread Starter

Chaabane

Joined Nov 30, 2009
37
why not the Pic16F887, newer than the F876, and it has 2 PWM modules.... then also use the LMD18200T H-Bridge, or the LMD18201T, (the only difference is one has a output pin for current draw, other does not, but both can handle 55 Volts and up to 6 Amps max current draw).... for speed feedback I would use an encoder to determine RPM's....
I'll check this pic...and thanks for the details
 

Thread Starter

Chaabane

Joined Nov 30, 2009
37
about Pic16F887 ,this one doesn't have 2 pwm signal
it has just ECCP,and it uses to drive H-bridge
am i wronge ?
 

BMorse

Joined Sep 26, 2009
2,675
about Pic16F887 ,this one doesn't have 2 pwm signal
it has just ECCP,and it uses to drive H-bridge
am i wronge ?
It has the following PWM capabilities:
Capture/Compare/PWM (CCP) module
Enhanced Capture/Compare/PWM (ECCP) module with auto-shutdown and PWM steering
In Single Output mode, pulse steering allows any of the
PWM pins to be the modulated signal. Additionally, the
same PWM signal can be simultaneously available on
multiple pins.
Once the Single Output mode is selected
(CCP1M<3:2> = 11 and P1M<1:0> = 00 of the
CCP1CON register), the user firmware can bring out
the same PWM signal to one, two, three or four output
pins by setting the appropriate STR<D:A> bits of the
PSTRCON register
so If you are going to drive 2 identical motors with the same PWM, PWM steering sounds like a good way to do this....
 

Thread Starter

Chaabane

Joined Nov 30, 2009
37
so If you are going to drive 2 identical motors with the same PWM, PWM steering sounds like a good way to do this....
this mean you can output the same PWM from other pins (up to 4)
but i want to output 2 different PWM for controlling 2 motors.

My Mongoose kit has a schematic that drives a Tamiya dual gearbox. It uses the 18F2525 which is a really nice 28pin PIC.
I'll check this one,thx
 

BMorse

Joined Sep 26, 2009
2,675
this mean you can output the same PWM from other pins (up to 4)
but i want to output 2 different PWM for controlling 2 motors.
Then use each individual PWM output, and don't use the steering module, this Pic HAS 2 PWM modules....

It was just a suggestion since you asked for one. You can also decide this one your own if you take the time and use the resources on the web just like we do, read the datasheets or use Microchips site to find the right uc for your project.
 

Thread Starter

Chaabane

Joined Nov 30, 2009
37
Then use each individual PWM output, and don't use the steering module, this Pic HAS 2 PWM modules....

It was just a suggestion since you asked for one. You can also decide this one your own if you take the time and use the resources on the web just like we do, read the datasheets or use Microchips site to find the right uc for your project.
if you look at the pic16F886 Datasheet.page 126&127

ECCP (CCP1) use timer2 for PWM mode,and
CCP2 use timer2 as well for PWM mode
so you can't generate 2 different PWM signal from this modules

i went into microchip and in the motor control section, i found

http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=55&mid=10&lang=en&pageId=74
(select "Show All Specs" in the top)
but its not really helpful
thanks anyway
 

Thread Starter

Chaabane

Joined Nov 30, 2009
37
My Mongoose kit has a schematic that drives a Tamiya dual gearbox. It uses the 18F2525 which is a really nice 28pin PIC.
i have a question :
this pic (18F2525) can generate 2 pwm ,but they have to be the pwm, coz both use the same timer
(Datasheet :page 142 :"Both PWMs will have the same frequency and update rate (TMR2 interrupt)."
so your "Mongoose" can't go right or left.Am I wrong ?
 

luffy

Joined Dec 27, 2009
1
hi guys , does someone have the circuit and the program to control DC motor bidirictional from the computer? with usb gate
 
i have a question :
this pic (18F2525) can generate 2 pwm ,but they have to be the pwm, coz both use the same timer
(Datasheet :page 142 :"Both PWMs will have the same frequency and update rate (TMR2 interrupt)."
so your "Mongoose" can't go right or left.Am I wrong ?
Both motors get the same period and that's fine, it's the duty that varies the speed (PWM) and that is independent.
 
Top