Let's Make Robots!

Everything you never wanted to know about two wheel drive.

Platform Drive Control.

This platform is driven by two wheels mounted so that the wheel axis
is just off center. There is a small caster wheel mounted in the 'rear'.

At this time there is no speed control feedback.

Maneuvers are accomplished by independent but coordinated control of
each wheel motor.

The drive motors are servos that have been hacked to continuous rotation.
The servo hack involved pulling the feedback control board and pot as
well as cutting the stop on the main gear. Thus the servos are converted
to basic DC motors.

The drive motors are powered from a bank of 4 C cell batteries. That power
is fed through a L293NE dual H bridge controller IC. Each half of the H
bridge controls one motor. The motor speed is controlled VIA PWM of the
enable pin of the H bridge circuit. Motor direction is controlled using
2 digital outputs for each motor, more details further on.
Note: I have an L293NE, only real info I can find is for the L293D. Not
sure what the difference is. Maybe current limiter diodes???

Two wheel drive maneuvers

As with any drive system you will need to go forward and backward (revers).
With a two wheel system this is accomplished by turning both wheels in one
or the their direction at the same time. When it comes to turning you have
a couple of more options. You can rotate the platform on it's center axis
or you you can rotate by stopping one wheel and turning the other one.
I've decided to divide these various maneuvers into categories. This is
because I'm anal enough that I want to differentiate the various turning
Turning is either Clockwise or Counter clock wise. This removes any
confusion concerning external references.
Rotation or rotating refers to driving both wheels in opposite directions
to go clock wise or counter clock wise.
Turning refers to driving one wheel while the other wheel is stopped to
go either clock wise or counter clock wise.

- Both wheels turning in one direction, at the same speed = forward.
- Both wheels turning in the other direction, at the same speed = reverse.
- Both wheels turning in opposite direction, at the same speed = rotation.
    - Clockwise = right wheel reverse, left wheel forward.
    - Counter clock wise = right wheel forward, left wheel reverse.
- One wheel turning while the other wheel is stopped = turning.
    - Clockwise forward = right wheel stopped, left wheel forward. Front
                          left corner of platform advances.
    - Clockwise reverse = right wheel reverse, left stopped. Front right
                         corner of platform recedes.
    - Counterclockwise forward = right wheel forward, left wheel stopped.
                                 Front right corner of platform advances.
    - Counterclockwise reverse = right wheel stopped, left wheel reverse.
                                 Front left corner of platform recedes.   

Motor Control IC:
L293 wiring.
Right wheel control = 1A, 2A
Right wheel motor   = 1Y, 2Y
Left wheel control    = 3A, 4A
Left wheel motor     = 3Y, 4Y

Arduino, L293 wiring.
Wheel         Ardhino Pins.       L293 Pins.
Right Enable     D6   (PWM)      1  (1,2 EN)
Right(1A)          D7                   2  (1A)
Right(2A)          D8                   7  (2A)
Left Enable       D11 (PWM)      9  (3,4 EN)            
Left (3A)           D12                10 (3A)                                     
Left (3A)           D12                10 (3A)

Motor wiring.
Right wheel        L293 Pin
Positive            3 (1Y)
Negative           6 (2Y)
Left wheel   
Positive            11 (3Y)
Negative           14 (4Y)

Digital Motor control
1A    2A    3A    4A       Maneuver
L    L    L    L                Stop
L    H    H    L               Forward
H    L    L    H               Reverse
L    H    L    H               CW Rotate
H    L    H    L              CCW Rotate
H    L    L    L               CW right Reverse left stop
L    L    H    L              CW right stop, left forward
L    H    L    L              CCW right forward, left stop
L    L    L    H              CCW right stop, left reverse

Issues Encountered:

During controller reset the drive motors would respond erratically.
The recommended method to control this is put 470 ohm resistors on the
motor control outputs to ground. I happen to have 390 ohm resistors and
installing them made a huge difference. One motor still twitches a little
during resets but it's acceptable.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You could save an OUTPUT per motor by using an inverter. Feed the uC OUTPUT to one pin, and, also to the inverter (NOT gate). From the OUTPUT of the NOT gate to the second INPUT for the first motor. Do the same for the second motor, and, now you have saved an OUTPUT pin per motor. Second, what would happen if you pulled the ENABLE lines low instead of the motor INPUT lines?

You are correct about pulling the Enable low. That will perform an All Stop, regardless of the motor control pins states. I had considered trying to reduce the drive control down to one direction output and an Enable pin per motor. I have the hardware, still got all of my discrete ICs from tech school just over 20 ysr ago. But I lack the digital theory memory :)  For the time being I figured I could be 'wasteful' of digital outputs. Plus I'm currently investing my time in improving the obstacle avoidance aspect.

I kinda figured it could be done with transistors. I will make that part of the drive circuit before I commit to vector board.

So how do I delete the ooops posts?

The best you can do is edit them to contain no text. Pretty much what DannyV did below.

think about it.. hack a servo by cutting that nutch and make the potentiometer turn freely just like you did. but let the control print just in place. now you will have an dc gearbox that you can control "with a servo pulse signal" the only con: you will have to generate that servo continuously, what can be difficult to do when reading an sensor at the same time. the pro's: -no need for an l293 or similar motor driver. -1 wire control for both directions and standing still. (calibrate by sending the servo center position let's say 1500 and turn the pot until the servo is (nearly) standing still.) - big 3rd pro is that a servo normally opperates be by correcting its position, and the more further away from that position it is correcting stronger by turning its motor faster. That means that by sending different positions, we can control the speed also :D this eventually ables you to make your robot drive perfectly straight.

You're correct. When I started this project I did not know you could hack a servo to continuous rotation and still use PWM to control it. Iwas following the Lynxmotion instructions when I started the project over ten years ago. This setup has taught me that using servos as drive motors is not optimal. They're noisy and lack torque. I've not really investigated any other drive motors. I'm not ready to spend the money nor am I up to the fabrication required to modify the platform and wheels to accept a new set of drive motors.


By setting enable to low, the motor stops but the robot rolls.

Setting enable to high and  both pins to either low or high, it short circuits the motor, and the robot comes to immediate stop, braking instead of free rolling! A very useful feature that I use when the robot arrives to critical situations (eg very short distance to object to avoid collision). However this mode it cannot be achieve using only two pins and the inverter