Essential to our progress now is creating a drive system which has some sort of feedback. Currently we can control the power supplied to each of the motors, but this is not enough to know how fast the they are moving. Factors effecting speed, other than power dissipated in the motor, are friction on the wheels (the wheels may slip) and torque required (e.g. going up hill will be slower than on a flat surface). While it might be possible to measure all of these various factors, feed the data into a mathematical model of the drive system and get it to calculate an estimate for the speed, it's not the easiest or most sensible approach. Measuring the speed directly, however, is much simpler and more effective!
To do this, we are going to build an optical encoder on each of the motors. Information about what encoders are and how they work can be found here:
http://www.societyofrobots.com/sensors_encoder.shtml
The motors we use are from MFA (can be found here - http://www.cornwallmodelboats.co.uk/acatalog/geared_motors.html). The motor output is geared down to give higher torque at a lower speed (our gear ratio is 50:1). Since we want a relatively high resolution encoder, it makes sense to try to measure rotational speed closest to the output of the motor (before the gearbox) since this is where the highest speeds are. So we took off the red cap and had a look inside.
The gear connected to the motor output shaft isn't very accessible to use as an encoder wheel so we found a similar gear and set out mounting it onto the gearbox. This would give us another gear outside of the motor which could be more easily used as an encoder disk. First we cut some holes in a piece of stripboard and cut it to shape, so that it would fit nicely on the gearbox mount.
Then we drilled another hole in the stripboard and used a nut and bolt to attach one of the cogs we had. The fit was perfect! The green cog spun rapidly as the output shaft turned slowly. Plus it already had 4 holes in which meant no modification was necessary to make it into an encoder wheel - the slots were already there. We drilled another hole into the stripboard to allow light to pass to the sensor when we mount it.
The sensors were taken from an old ball mice. These things are invaluable for encoder phototransistors! Here is the datasheet for the ones I found in the mouse - http://www.allproducts.com/ee/kantek/31-dual_phototransistor-l.jpg. Notice it has 2 phototransistors in the one package. This means it can not only measure the speed of the motor, but also the direction (using something called quadrature, see this for more explanation - http://www.eehomepage.com/report.php?report=20080225). The mice also have matching IR LEDs so we took those off to use in our encoder too. See the black package with the blue line (in front of the encoder wheel)?
The leads for on the LED and phototransister were very short, so we soldered some longer wires onto them. The wires were stiff single core ones, so it allowed us to alter the position of the chips with ease - very handy when experimenting. The other end of the wires we soldered onto the strip board.
Here's a pic of the other side. You can see the LED mounted and positioned to shine through a hole on the gear when it passes. Notice that the phototransistor package is black. This black plastic is actually transparent to IR light so it will still hit the phototransistor inside. The light which humans can see however will not get through. This serves to reduce the interference from other light sources.
Another cool trick when working with IR is to use a camera to know if it is actually shining. Our eyes can't see IR, but the CCD sensors in cameras can pick it up. Look at the middle of the LED in this picture, and you can see a bright pink/purple dot. This is IR light!
More coming up in a few days. Stay tuned!
