Specifications
28
Anything that can control a current is suitable for use as the switches in an H bridge
such as relays, transistors or MOSFETS. In this case, four MOSFETS have been used
with small heat sinks to cater for the 12V motors which are drawing approximately 2.5
amps each at full load.
One excellent advantage of using an H Bridge is that it reduces the voltage and current
spikes that occur from the motors starting, stopping or changing direction quickly. With
the Mobile Manoeuvring Robot the voltage spikes were still higher than the H Bridge
could contain. The cheap motors that were purchased for the drive have very poor
characteristics and were resetting the microcontroller every time that the two motors
turned on simultaneously. There are several procedures that could have been
undertaken to overcome this problem. A more efficient pair of motors may have
produced less voltage spike; a large capacitor could have been implemented to provide a
spike filter; or the chosen method, to use separate power supplies to run the
microcontroller and the motors respectively. A 9 or 10 volt battery is ideal for running
the microcontroller as the voltage passes through a LM7805 voltage regulator. This
method has the added advantage of being able to have a separate, higher voltage battery
to run the motors without having to reduce it significantly to power the microcontroller.
Both power supplies must share a common earth for the robot to function correctly.
To control the motor speed requires more than just a logic high input to the H Bridge.
Motors will always run at slightly different speeds due to the internal friction losses and
other variances in efficiency and so the robot would drive in large circles. Pulse Width
Modulation (PWM) is a very successful method of controlling the speed. By applying a
chosen frequency to both motors and then adjusting the duty cycle, the motors speed
can be controlled. The Motorola HC12 has 4 channels dedicated to pulse width
modulation. Bits 0-3 of PORT P can easily be set to output a controllable pulse. This
provides a perfect environment to control two motors, one channel for each motor in
each direction.
The four PWM pins (PORT P pins 0-3) are connected directly to the H bridge inputs.
Simple software initialisation sets the ports ready for PWM and sets a frequency to base
the duty cycle around. For the Mobile Manoeuvring Robot a pre-scaler divider of 128
is used to divide the 8MHz processor down to create a slower clock that can be used to










