Hi Claude,
Sorry for the delayed reply. We've been doing a fair bit of work behind the scenes to get the Raspberry Pi Camera robot working with encoders, so I wanted to wait until I had some time available to give a complete reply.
There's two aspects of getting encoders to work, the hardware and the software. With regards to the sprocket disks, you're right, they are indeed for encoders. Sparkfun use the same chassis for their
redbot, and I believe that they got Dagu to add more teeth to the wheels for use with this
encoder board. At first glance, this board looks really neat with IR sensors looking down at the encoder disks, but in reality they don't work very well. Firstly, the hardware seems to be a bit tempermental and misses ticks, and secondly they're only single output encoders (as are the encoders in the first link you posted). Single output encoders are probably ok if you just want to control the speed of the motors to drive in a straight line, but I believe that in order to make accurate turns (say 90 degrees etc) then it's much easier to do this with quadrature encoders (the Pololu ones).
Probably the best quadrature encoders I've used so far with the camera robot, have been the
wheel watcher encoders by Nubotics (although two of the holes need to be redrilled slightly to fit on the Dagu motors). These are a bit pricey though, and can be a bit tricky to get working, and so we're planning to produce some lower cost quadrature encoders that use hall effect sensors and a magnetic disk attached to the back of the motors. As these are before the gearbox, they'll benefit from the 48:1 gear ratio and be able to give over 700 counts per revolution. It's probably going to take us at least another month to get them out unfotunately and combined with the postage cost to Canada, you might be better going with the Nubotics encoder if you'd like something quickly.
Once the encoders are attached to the robot, the next thing to consider is the software. The encoders could be connected to the Pi, but writing responsive interrupt code in Python to catch the encoder ticks looks a bit tricky to me so I've decided to connect them to the Mini Driver for now. Using the mini driver solved a number of problems when constructing the robot, but connecting sensors to the mini driver can be a bit tricky, as the mini driver firmware has to be modified to read the sensors, and send the values back to the Raspberry Pi, where Python code needs to be written to receive the sensor values. To ease this process for sensors in general, I've been working on an updated version of the software for the camera robot that should make attaching sensors to the mini driver much more straight forward. This code is currently in the
experimental branch of raspberry_pi_camera_bot, and if you're interested you can get the code by logging onto the Pi and running
- Code: Select all
cd /home/pi/raspberry_pi_camera_bot
git pull
git checkout experimental # type 'git checkout master' to return to the old code
to see the sensor reading in action, first stop the robot_web_server
- Code: Select all
sudo service robot_web_server stop
then run the sensor test script
- Code: Select all
sudo ./robot_sensor_test.py
The experimental mini driver firmware sends sensor readings back to the Pi at a rate of 100Hz. Pins can be configured as either digital, or analog inputs, and one of the digital pins can be configured to read from an
ultrasonic sensor (alhough only at a rate of 2Hz at the moment).
Things are going fairly slowly here unfortunately. But the current plan is to release an upgrade to the software along with a blog post showing people how they can add sensors to their robot, and then to follow that up in about a months time with our encoders, and another software update that uses the encoders to improve the control of the robot. It looks at the moment, as if there is not enough space in the memory of the mini driver to implement a motor control loop on the mini driver itself, but we've conducted some tests that make me confident we can get good results by implementing the control loop in Python code on the Pi.
Anyway, apologies for the long and rather rambling nature of this post, hopefully it gives you some useful information to go on when adding encoders to your robot.
Regards
Alan