Monday, April 14, 2008

Robotics Tutorials - Beginner - Hardware - Motors

Motors are one of the most common methods used to move robots around. They can be connected to gears and wheels and are a perfect way of adding mobility to your robot. There are many types of motor, and this tutorial will cover the main ones useful for robotics.

DC Motors:

These are the most common and easy to use motor available. They are connected to a power supply by two wires. The direction of the motor shaft rotates can be changed by reversing the polarity (swap the positive and negative wires) of the motor supply voltage.

Unfortunately motors use quite a bit of current, so you cant just plug them straight into your processor and expect them to work, the processor won't be able to supply the motor with enough current. We need to find a way of turning the motors on and off using the processor. This can be done by many methods, including transistors, relays or a motor driver chip. The Robocore contains two motor driver chips that can control up to 4 DC motors simultaneously. Connecting motors to the Robocore couldn't be simpler. Just connect the 2 wires of each motor to one of the motor outputs on the Robocore and your ready to go. The motor is controlled by 2 output pins on the processor, lets say pin 1 and pin 2. The motors direction can be changed by different outputs of the pins. See table below

Pin 1 Pin 2 Motor Output

Pin 1

Pin 2

Motor Output

On

Off

Clockwise

Off

On

Anti-Clockwise

Off

Off

Motor Off

For help programming the chip to do this have a look at the motor programming guide.

Servo Motors:

Servo motors are perfect control motors, They can be told to rotate to a specific position, making them ideal for anything that requires precision movement. Most servo motors can rotate through about 90 to 180 degrees, some rotate through a full 360 degrees. Servo's however, are unable to continually rotate, meaning they can't be used for driving wheels, but their precision movement makes them ideal for powering legs, controlling rack and pinion steering and much more.

Servo motors are totally self contained. They contain a motor, gearbox and driver electronics, meaning they can be controlled directly from a microcontroller, without the need for interface electronics. The picture to the left shows the inside of a servo. You can see the gears, motor and control circuitry.

Servos have 3 wires connected to them. 2 are for the power supply, usually between about 5 and 7 volts. The third wire is the control wire, which can be connected directly to the processor or micro controller (or an output of the Robocore). The position the servo rotates to can be controlled by sending pulses of electricity to the servo. Changing the delay between pulses directly controls the servos position.

Stepper Motors:

Stepper motors work in a similar way to dc motors, but where dc motors have 1 electromagnetic coil to produce movement, stepper motors contain many. Stepper motors are controlled by turning each coil on and off in a sequence. Every time a new coil is energized, the motor rotates a few degrees, called the step angle. Repeating the sequence causes the motor to move a few more degrees and so on, resulting in a constant rotation of the motor shaft. For example, a stepper motor with a step angle of 7.5 degrees requires 48 pulses for a complete revolution, or 96 pulses for 2 complete revolutions.

The diagram below shows how a stepper motor works. The magnet in the middle of the arrangement is connected to the motor shaft and produces the rotation. The 4 magnets around the outside represent each coil of the stepper motor. As different coils are energized the central magnet is pulled in different directions. By applying the correct sequence of pulses to the coils the motor can be made to rotate.

This design gives stepper motors the upper hand over DC motors. Varying the speed of the input sequence can exactly control the speed of the motor. Also, by keeping count of the sequence the motor can be made to rotate any number of times to any position

No comments: