Search This Blog

Friday, July 23, 2010

Robotics Tutorials - Advanced - Hardware - Feedback Motor Control

This tutorial will look at how you can use feedback to control and regulate the speed of motors (or anything else that rotates). Let's say that you want your robot to travel at a steady speed that uses 60% power to the motors. This constant power supply would work fine on flat ground but what would happen if it encountered a hill, would it have enough power to handle a steep incline or would it slow to a crawling speed.

This problem could be overcome with feedback. If you could somehow sense the rotational speed of the wheels you could deliver more power to the motors if they slow down (climbing a hill or overcoming an object) or apply some breaking if they are rotating too fast (travelling down hill), but always maintaining a steady speed.

I'm going to talk about using shaft encoder's record how fast the wheels are turning.

Shaft encoders use infra red emitters and detectors that are placed fairly close to each other (about half an inch or less). When there is a direct line of sight between them the detector is 'on' and produces a voltage (normally around 1 to 3 volts). When the line of sight is blocked the detector doesn't pick up any infra red light so is 'off', producing 0 volts.

For a perfect example of how shaft encoders work take a look inside your mouse. You will see a disk with holes around the edges. On either side of the disk are an infra red emitter and infra red detector. When you move the mouse, the mouse ball's rotation causes the perforated disk to rotate. As the disk rotates the path between the IR emitter and detector is made and broken, causing the detector to create a string of electrical pulses. By monitoring the frequency of the pulses you can deduce how far the wheel has turned and the time it took.

Shaft encoders for robots use exactly the same principle. A card disk similar to the one on the right can attached to the drive shaft of the wheel and used to break an IR beam between the emitter and detector.

The diagram below shows how to connect the shaft encoder available in the components section of the Robologic shop to the Robocore. The disk rotates through the 'U' of the sensor and creates an electrical pulse at the signal line every time the IR beam is made of broken. The only external component needed is a 330 ohm resistor.

A good feature of using shaft encoders to monitor wheel movement is that they are totally friction free, meaning that there is no loss of drive power when they are used.

If the pre-moulded 'U' design does not fit your specifications then the sensor can be constructed from separate emitter and detector components wired in the same was as above and mounted on your own design. The emitter and detector may need to be shielded with some black card or something similar to prevent them from detecting any ambient infra red.

No comments:

Post a Comment