Differencial Drive using one PWM and 4 GPIO

Capture_1.JPG (43110Bytes)
Capture_1.JPG (43110Bytes)

I want to make a differencial drive using only one PWM and 4 GPIO pins, because the motors always move in the same speed irrespective of their direction. So I have designed this H-Bridge Motor Driver, I want to make sure it works, before trying it out practically.

 

 

Okay! Then I will give PWM to the enable pins

As said by bdk6 giving PWM to the enable pins will correct my problem, right?

But, I didn’t really undurstood Maxhirez, will this correct the problem satement given by him? 

As in a differencial drive the two motors move at same rpm, so i want to use only one pwm, can it be done?

Sorry guys but i think your
Sorry guys but i think your missing the point, once he changes the pwm to the enables he will be able to do exactly what he wants. He is connecting his motors to a DIFFERENTIAL like on a vehicle. I had a bot using a similar drive mechanism a few years ago.

Looking at what he typed,

I would imagine differential drive would be what we think of as tank drive, and, not driving a differential like one finds in a vehicle.

**The problem you will have with using a single PWM for **

differential drive means you will only be able to control the speed of the motors in unison (together). Mass produced motors will not offer exactly the same performance with the same power input. Your robot will drive in an arc, no matter how slight. The only way to work with mass produced motors and get reasonably straight line capability is to PWM each motor independently. If you are building a small (50mm on a side for example) robot and you don’t have many uC pins, drive slow (keep the PWM pretty low) and you will drive relatively straight.

If the above doesn’t make sense, put another way, mass produced motors will not move at the same rpm with the same power input.

Thanks Guys! My problem is solved.
The suggestion forwarded by fdk6 solved my problem.

Duane Degn also helped me with the extra information about the use of the “NOT” gate, I can shrink it to 1 PWM and 2 GPIO usage, and the suggestion of using a encoder will also help me in further developing my robot. I was trying hard to realize why my robot was not moving straight, next time i will use some hall sensors to make it straight.

Pic Update

I have updated the pic. :slight_smile:

Your circuit design looks

Your circuit design looks correct and it will work with only one PWM pin. The only problem with using one PWM is that the motors will run at relatively the same speed i.e you can’t change the PWM for each motor. As a result you cannot do differential drive with one PWM. Differential drive is basically the software version of the mechanical differential in cars. In cars both wheels are driven by one motor through a differential which regulates the speed on each wheel depending on whether you are turning left or right or going straight. Since your robot will not be using two motors and not a mechanical differential you use code to basically simulate the mechanical differential and the only way to have different speeds for each motor would be to use two different PWM signals.