Cody's Robot Optical Motion Sensor #1 (CROMS-1)

This webpage describes an optical motion sensor that I developed for my robotics experiments. It is based on an Agilent/Avago ADNS-2610 Optical Mouse Sensor that was taken from an optical mouse. The sensor was designed to work with a special lens, light guide, and LED to view the surface that the mouse sets upon. This arrangement is not really suitable for my robotics applications (though optical mice have been used successfully on robots as "odometer trailers"). I wanted a compact sensor that could be positioned above the floor so it would not rub against it, yet still be able to optically detect the motion of the robot. Consequently, I developed a printed circuit assembly and an optical assembly that would satisfy these goals.


In order to perform dead reckoning navigation on a robot, some sort of sensor must be installed to relate motion of the robot to a measurable signal. I originally looked at using mechanical encoders taken from a old IBM PS/2 mouse and attaching them to the axels of the drive motors. As the axels rotated, the robot could gain an indication of its rate of movement, hence the distance traveled. Some of the robotics articles that I read pointed out that the use of mechanical encoders for distance measurement were succeptible to error due to slippage of the wheel or track against the surface they were running on.

I happened upon the application note Interface to Optical Mouse Sensor on the Kronos Robotics website. It discusses the use of a sensor from an optical mouse for use as a position-sensing coprocessor on a robot. The idea is that the optical mouse sensor would be pointed at the surface that the robot was running on (A new lens system would be created to allow the sensor to be focused on the surface.). As the sensor is moved, the distance changes would appear as mouse counts in the "x" and "y" directions. With proper calibration, these counts would equate to measures of distance moved by the robot.

Not having access to the GE optical mouse described in the Kronos Robotics application note, I found that the BTC M850 3D Optical Mouse has the same sensor: the Agilent/Avago ADNS-2610. After hacking the BTC M850 mouse to directly access the sensor, I was able to gain experience obtaining motion data (as well as other data) from it. While this demonstrated the feasibility of using the mouse sensor, it did not resolve the issue of creating a new lens system to properly focus the sensor.

I found another very useful source of infomation, related especially to lens system development, in the article "Insect-Inspired Optical-Flow Navigation Sensors" published in the October, 2005 issue of NASA Tech Briefs. The article discusses the feasibility of using a mouse sensor to measure the movement of a Mars probe as it flys a few meters above the terrain. A lot of information is provided to develop a new lens system based on the specifications of the standard mouse lens system. The full article can be obtained from the NASA Tech Briefs website in the Technical Support Packages area, under the Computers/Electronics (Electronic Components and Systems) category. You'll have to register to access the document, but registration is free. Using my experience with the ADNS-2610 and using the NASA document for additional inspiration, I developed a new printed circuit board assembly for the ADNS-2610 and an optical assembly to hold it. The steps for constructing Cody's Robot Optical Motion Sensor #1 (CROMS-1) are described below.

Bringing the Pieces Together

The components list, see Table 1, consists mainly of relatively common items. You may already have them available in your junk box. The exceptions are the optical mouse (due to the optical sensor) and the "Virtual Lenses" device, obtained from BG Micro. Other optical mice will have the ADNS-2610, so if a BTC M850 3D Optical Mouse cannot be found, another optical mouse that uses the same sensor will be acceptable. The "Virtual Lenses" device, though, is a pretty unique item. Fortunately, at the time of this writing, BG Micro has several hundred of these devices in stock!

The items in the component list marked by * can be obtained from other sources besides the BTC M850 Optical Mouse. This may be a necessary recourse, as the leads on some of these compoents can be rather short. Note that any components used must fit within the space provided within the optical assembly, which is rather tight. In addition to the items specified in the component list, solder, two-part epoxy, and double-sided adhesive tape, are needed to assemble the CROMS-1. Tools that were used in the assembly process are a soldering iron, a hobby knife, a rotary tool with cutting disks and drill bits, a file, and scissors. Materials to fabricate a printed circuit board are also needed.

Table 1: Components List
U1ADNS-2610 Optical Mouse Sensor1BTC M850
Q12N3906 PNP bipolar transistor1BTC M850*
C110 µF, 10V electrolytic capacitor1BTC M850*
C20.1 µF ceramic capacitor1BTC M850*
C32.2 µF, 10V electrolytic capacitor1BTC M850*
R132 Ω, 1/8 W resistor1BTC M850*
R2100 KΩ, 1/8 W resistor1BTC M850*
R31 KΩ, 1/8 W resistor1BTC M850*
XTAL124 MHz resonator1BTC M850
CONN1Four-conductor ribbon cable1
CONN29V battery snap with two-pin connector1BG Micro BAT1064
n/a1/16" single-sided PC board material1½"x1½"
n/aVirutal Lenses1BG Micro LEN1015
n/a1¾" plastic hex standoffs1BG Micro ACS1178
n/a2.5 millimeter "Fun Foam" sheet1"x5"
n/a2 millimeter-thick cardboard½"x½"
n/aSelf-tapping screws4
n/aMounting brackets2Builder's discression

Electrical Assembly

A schematic was developed for CROMS-1 using the open-source gschem tool, which is part of the gEDA Project. Prior to generating the schematic, though, a device symbol for the ADNS-2610 had to be created. The instructions for using tragesym made it very easy to do this. The schematic for CROMS-1 is quite simple. The main component in the schematic is the optical sensor, with resistors, capacitors, resonator, and transistor providing voltage conditioning, timing, and LED driver functions. The power and control signals are provided to CROMS-1 via CONN1. Pin 1 is +5 Volts, pin 2 is the serial clock (SCLK), pin 3 is the serial data input/output (SDIO), and pin 4 is ground. The LED is attached to CONN2 so that it receives power to illuminate the imaged surface. Pin 1 is connected to the anode of the LED. Pin 2 is connected cathode of the LED.

Once the schematic was verified, the artwork for the printed circuit board was created. The gEDA Project came to the rescue again, with a tutorial for using gsch2pcb. It describes how to use the utility to convert gschem schematics to a components footprint data set and a netlist usable by the PCB interactive printed circuit board editor. The gsch2pcb tutorial also describes how to create new device footprints. This was necessary for the ADNS-2610 with its staggered DIP pinout. Once the printed circuit layout was completed, it was replicated so that several CROMS-1 circuit boards could be created during the PCB fabrication process. While the PCB program generated a number of printed circuit layout patterns, I only used the printed circuit back (circuit) layout and the silk screen layout to fabricate the CROMS-1 printed circuit boards.

The printed circuit board was fabricated using the method developed by Thomas P. Gootee; Easy Printed Circuit Board Fabrication Using Laser Printer Toner Transfer. This process is inexpensive and very easy to do as long as you have access to a laser printer or a photocopier and the right glossy printer paper. The Staples brand photo paper described by Gootee is now called "photo basic gloss". Its item number is still 471861, but the UPC barcode for the 30-sheet package is now 7 18103 02856 1.

Using Gootee's instructions, I fabricated two CROMS-1 printed circuit boards. The images to the right show the steps in the process after the toner was ironed onto the single-sided PC board material: a. mask applied, b. etching, c. mask removed, d. holes drilled, e. component placement guide applied, and f. finished PCBs. The most difficult task was drilling the holes. It is recommended that this be done with a drill press. A hand-held rotary tool can be used for this task, but the results can be problematic.

a. b.
c. d.
e. f.
Now that the PC board is fabricated, the parts need to be harvested from the mouse. The locations of the components on the BTC M850 mouse are indicated in the photo:
  1. ADNS-2610 mouse sensor
  2. HLMP-ED80 LED (unsolder the LED leads, then remove the clip and LED together from the PC board, and then remove the LED from the clip)
  3. 24 MHz resonator
  4. 32 Ω resistor (orange, red, and black bands)
    1000 Ω resistor (brown, black, and red bands)
    100 KΩ resistor (brown, black, and yellow bands)
  5. 2.2 µF, 10V electrolytic capacitor
  6. 10 µF, 10V electrolytic capacitor
  7. 0.1 µF ceramic capacitor (choose capcitor with the longest leads)

Instructions for disassembling the BTC mouse can be found on the BTC M850 Mouse Hack webpage and will not be repeated here. The parts are easily unsoldered from the mouse's printed circuit board. The board does not have plated-trough holes, so the solder is easily cleared with a soldering iron and a solder sucker tool. It is advised that the aperture (hole) on the ADNS-2610 sensor be covered prior to unsoldering to prevent solder splash or other foreign matter from obstructing or damaging the optical sensor.

Photos a. and b. show the component and circuit sides of the populated CROMS-1 electrical assembly. Contrary to standard practice, some components were soldered to the circuit side of the board. This was due to the shortness of the leads of those parts harvested from the mouse. Note that if the capacitors are soldered on the component side of the board, the leads must be long enough to allow these capacitors to be laid over on their sides, like with the other components. The four conductor ribbon cable was soldered to the attachment point for CONN1. Left to right; the red wire connects to 5 Volts, the orange wire connects to SCLK, the yellow wire connects to SDIO, and the green wire connects to ground. The 9-volt battery snap was cut from the wire with the two-pin connector. The pair of wires leading to the two-pin connector are shortened to about four inches in length. The red wire is soldered to the pin 1 on CONN2. Its circuit trace goes to R1. The black wire is soldered to pin 2 on CONN2. Its circuit trace goes to the emitter of transistor Q1.

a. b.

Optical Assembly

The optical assembly designed for CROMS-1 serves two purposes. First, it provides a housing for the printed circuit assembly described above. Second, it provides a new lens assembly that enables the sensor to be placed some distance above the surface that it is imaging. Unlike an optical mouse, CROMS-1 does not make contact with the surface. For robotics applications, this is undesirable as contact with the surface would cause drag during movement. If the imaging surface is not smooth, then it would even be likely that the sensor would snag, causing the robot's movement to be constrained or potential dammage could be inflicted upon the sensor.

The nice thing about the optics in an optical mouse is that all of the hard work has been done. That is, the lens, illuminating LED, and their positioning have already been designed by Agilent/Avago as part of a reference design. Any optical mouse that follows the reference design will work properly. The CROMS-1 optical assembly, of course, does not follow the reference design. Consequently, a lens must be selected and positioned, along with the illuminating LED, to cause the imaged surface to appear on the focal plane of the ADNS-2610 optical sensor.

Fortunately, the NASA Tech Briefs article, mentioned above, goes into some detail about deriving the optical characteristics of the optical mouse reference design. All of the necessary information was found in the Agilent/Avago data sheets. Using some fundamental knowledge of thin lens optics and depth of field equations, it is relatively straightforward to take this information and develop the CROMS-1 lens system, given a lens with the desired optical behavior and a known focal length.

I found that several design issues had to be met to obtain a successful design. Some of those issues were obvious to me, but other were not. First, a usable lens with a reasonably short focal length had to be found. Second, an enclosure had to be found that would hold the lens and the electrical assembly in a compact arrangement. Third, which wasn't immediately obvious to me, the brightness of the image had to be controlled so as not to overload the auto-brightness controls of the mouse sensor. I had the great fortune of finding that the BG Micro Virtual Lenses assembly resolved most of these issues. It has a lens with a focal length of 30 millimeters and its enclosure is just large enough to hold the electronics of the optical sensor. The remaining issues had to be addressed in the details of the optical design.

The following pictorial described the steps taken to fabricate the CROMS-1 optical assembly. None of the steps are particularly difficult to perform. Having a rotary tool is the most useful device for making this easy to do.

The optical assembly was created from the items illustrated to the right. These items are a. Virtual Lenses assembly, b. flexi-straw, c. small sheet of fun foam, d. mounting bracket for mini-blinds, e. small square of 2 millimeter cardboard, f. self-tapping screws, and g. plastic hex standoffs. The plastic caliper at the top of the photo is there to show the size of the items.

The Virutal Lenses assembly is easily opened by running the blade of a screwdriver or other thin tool between the halves of the case. Start from the middle of the back and working around; separating the halves a little at a time. Eventually, the two halves will separate. Be careful not to let the lens fall out as the halves separate.
Upon opening the case, a treasure trove of lenses and mirrors are found. The Virtual Lenses assembly appears to be some form of right-angle eyepiece for some form of optical system. Could it have come from some medical equipment? Or could it be from some obsolete military hardware? One can only wonder. The good folks at BG Micro only say that it was part of a virtual reality screen.
The optical items within the Virutal Lenses assembly consist of two plano-convex lenses, a concavo-convex lens, a partially-silvered beam-splitting mirror, a concave mirror, and a small, square graticule. The white, plastic insert splits into two pieces once it is removed from the case. It may be part of a focusing mechanism, though that is just a guess. Be careful handling the lenses, as they scratch easily. The lens that will be used is the smallest lens on the lower, righthand side of the photo.
When the halves of the Virtual Lenses assembly are separated, the eyepiece is freed. This eyepiece provided some form of fine focusing ability, as it could rotate withing the Virtual Lenses assembly. This eyepiece will serve as the lens barrel. It already contains some lenses, which need to be removed. Using a hobby knife, cut away the lens retaining tabs on both sides of the lens barrel. The lenses will slip out easily revealing a thick double-convex lens and a concavo-convex lens.
In order to place the lens at the proper position in the lens barrel, a spacer must be constructed. I used some "fun foam" that had been discarded from another project. The idea is to insert a spacer that is about 10 millimeters in length between the bottom of the inside of the barrel to where the lens will be placed. It turns out that four rings of fun foam provide about the right spacing. The outside diameter of the rings is 23/32" and the inside diameter is 1/2". The fifth ring will be used as an aperture stop.
The photo to the right show the spacers after they have been cut out. Don't worry if the holes are not perfectly centered. The positioning is not all that critical, as will be shown. The ring on the far right is the aperture stop. It has a hole 1/4" (6.35 millimeters) in diameter in the center. I used a single-hole punch to create the hole. As you can see, this hole is not perfectly centered either. This will also not be a problem.
The four photos to the right show the steps in the lens barrel assembly process: a. The components gathered together prior to assembly. The spacers are are stacked to show their combined height (about 10 millimeters). b. Using epoxy, glue the spacers into the lense barrel. Make sure that the spacers are sitting level one on top of the other. Before the epoxy sets, move the spacers around inside the barrel center the inner tube formed by the spacers. Now place a thin bead of epoxy on the topmost spacer and carefully set the lens on top of the spacer's opening. Be careful not to get epoxy on the inner area of the lens. Otherwise, the epoxy will distort the focus of the lens. While the epoxy is setting, take a short strip of double-sided adhesive tape and punch a hole 1/4" (6.35 millimeters) in diameter into the tape. Then place the tape onto the aperture ring, making sure that the holes in the tape and the aperture ring are aligned. c. After the epoxy has set, place the aperture ring onto the lens. The tape will secure the aperture ring to the lens. Make sure that the aperture hole is centered on the lens. d. As can be seen, the aperture ring restricts the aperture angle of the light reaching the optical sensor. The misshapened spacer rings don't have that much effect on the light reaching the sensor.
a. b.
c. d.
While the epoxy on the lens barrel is drying, work can start on the body of the optical assembly. The first step is to drill some 1/8" holes into the sides of the body. The photo shows where they should be placed. The holes closest to where the lens barrel sets are for screws that will hold the body halves together. The hole at the back of the right half of the enclosure will allow wires for the illuminating LED to exit the enclosure.
The next step is to cut the hex standoffs to the proper length. The standoffs need to be shortened to 34 millimeters. A rotary tool with a cutoff wheel will make short work of this task. Prior to mounting the standoffs into the optical enclosure, drive the self-tapping screws into the ends of the standoffs. This will make it easier to drive the screws into the standoffs during the actual assembly.
Assemble the standoffs and the halves of the enclosure together to test the fit. At this point it is necessary to remove the unneeded plastic of the enclosure. The photo on the left show what needs to be removed. Disassemble the enclosure and use a rotary tool to cut off the plastic. If desired, the opening that is left can be blocked with two small sheets of plastic, one for each side of the enclosure. The photo on the right shows the enclosure after reassembly.
This photo shows what the inside of the enclosure should look like with the standoffs installed. With the epoxy on the lens barrel dry and the aperture ring installed. The optical assembly can be reassembled for the next step: adding the LED wire conduit.
The LED conduit consists of a flexi-straw cut to the right length and epoxied to the right half of the optical enclosure. One end of the straw needs to be cut down to a length of 16 millimeters from the one end of the straw's "accordion". The other end of the straw needs to be cut down to a length of 31 millimeters from the other end of the "accordion". The total length of the straw should be 58 millimeters. These measurements should be adjusted if the length of the "accordion" is different from what is shown here.
The LED conduit is epoxied to the right side of the optical enclosure. It should be positioned so that it runs parallel to the centerline of the lens barrel. The top end of the conduit should be in line with the 1/8" hole that allows the LED wires to come out of the enclosure. Most likely, the straw is made out of polyethylene. Consequently, epoxy won't stick very well to the tube. To resolve this problem, use enough epoxy to totally cover the bonded area of the straw. The epoxy will harden, forming an enclosing "bracket" around the tube. Note that one of the mounting brackets is attached to the optical enclosure. This was done because the epoxy tends to run a bit. The excess epoxy helps to secures the mounting bracket to the optical enclosure.

After the epoxy has set, disassembled the enclosure again. It is necessary to trim out part of a clip that held the beam-splitting mirror. Do not totally remove the clip! Only remove the portion the curls around to hold the mirror. Leave the portion that extends from the wall of the enclosure. This serves as part of the support structure for the electrical assembly. See the photo for details and compare it to some of the prevous photos of the interior of the enclosure. In addition, a small notch should be cut into the right half of the enclosure near the large opening in the enclosure. This notch is needed to provide some clearance for the four-conductor ribbon cable that comes out of the electrical assembly. The notch should not be cut too deeply, as the compression of the two halves of the enclosure provide a strain relief to the electrical connections of the ribbon cable.

Finally, attach a small square of 2-millimeter thick cardboard to the back of the right half of the enclosure. Double-sided adhesive tape works well for this task. The cardbord duplicates the function of the clip used inside the reference mouse design. It keeps the electrical assembly pressed flat against the support structure of the enclosure. The CROMS-1 is now ready for its final assembly!

Final Assembly

The final assembly consists of inserting the electrical assembly into half of the optical assembly. Prior to this insertion, the shell of the two-wire connector must be removed temporarily. This is to allow the wires to pass through the hole in the enclosure and through the LED conduit. The shell of the connector is removed by using the fine point of a hobby knife to push in two small tabs on the crimp connectors inside the shell. These tabs are visible through two small holes on the side of the shell. Once the crimp connectors are removed, bend the tabs back out so they'll lock back inside the shell when they are reinserted.

The short side of the printed circuit board with the LED wires should be inserted into the right half of the optical enclosure. The LED wires need to exit though the hole in the enclosure. The printed circuit board should then fit between two tabs at the back of the enclosure and the support structure. The top of the ADNS-2610 sensor should fit under the carboard square. The electrical assembly should fit snuggly and not shift around, though it should be easy to remove. It may be necessary to slightly trim the printed circuit board using a file to ensure a proper fit. It would be a good idea to do the trimming of the printed circuit board prior to populating it with components.

The lens barrel needs to be put into its proper location, followed by the other half of the optical assembly. The assembly is then secured with the screws. The halves of the enclosure should fit closely together with little or no gap between them. The lens barrel should be able to rotate easily with a twist. It should not so loose that the tube rotates freely. The other mounting bracket should be attached at this time if one is used.

The LED wires should now be slipped down through the LED conduit to extend out the other end near the lens barrel. Place the crimp connectors back into the connector shell, making sure that they click in place and cannot be pulled back out. Finally, plug the LED into the connector. The flat side of the LED (cathode) should plug into the connector side with the black wire. The connector is then pushed back up into the LED conduit so that only the LED extends out of the conduit. The wire should be pulled up at the other end to form loop. The loop should prevent the connector from dropping back out of the conduit. The "accordion" of the LED conduit can now be adjusted to shine the LED onto the spot observed by CROMS-1.

The photo to the right shows the finished sensor mounted to my robot. I built two of these sensors. One is mounted to the front of the robot and the other is on the rear. The vertical positioning of each sensor is such that the surface underneath the robot is in focus (more or less).


Once the CROMS-1 was attached to my robot, I needed to do some testing to see how well it performed. I decided to use two different test patterns. The first test pattern is the classic USAF Lens Test Chart. I used the Group 3 patterns, as these are what were used in the NASA Tech Brief article mentioned above. The illustration at the right is not to scale, but is only representative of the appearance of the USAF test chart. You can download an actual USAF test chart, in several graphic formats, from here.

The nice thing about the USAF lens test pattern is that it is a long accepted test standard. One problem with it is that it is difficult to find the Group 3 pattern with my sensor. The sensor's field of view is only a bit more than one millimeter square. It takes a bit of careful nudging to place a small portion the Group 3 pattern within the field of view. Another problem is that my copy lens test chart was created with a laser printer, so it does not have the same high-quality of a photographic film or a metal stencil.

The second pattern I used is one that I designed myself. Its purpose is to provide an indication of the sensor orientation relative to the pattern. The left graphic is the actual pattern. The right graphic is the pattern magnified sixty-four times. The pattern forms a repeating set of points and line segments at right angles, providing an unambiguous indication of orientation. Consequently, it is fairly easy to align the field of view to see one of the patterns.

I used the same robot to test the CROMS-1 sensor as was used to test the BTC Mouse Hack. It made sense test the new sensor with a derivative of the Forth code that I used then. The code I used to test the functions of CROMS-1 is listed here. The peculiarities of the Forth code syntax are described on the BTC Mouse Hack web page and won't be repeated here.
The left photo shows the image seen by the optical sensor of the BTC Mouse Hack test device when positioned over the number "3" on the Group 3 USAF Lens Test Chart. The number is clearly seen. The center and right photos are images of the same number "3" as observed by the two CROMS-1 sensors that I contructed for my robot. As can be seen, the focus is not quite there yet. It is fairly close, considering that the depth of field is only about two millimeters. There is also some vignetting, probably due to a combination of the aperture ring and uneven illumination by the LED. In the reference mouse design, the light coming from the LED is focused somewhat by its own lens and prism.
Using my designed test pattern gave similar results. The left photo shows the image seen by the optical sensor of the BTC Mouse Hack test device. The center and right photos are images of my test patten taken by the CROMS-1 sensors. Work will be done to continue with improving the focus of the sensor. As it stands now, CROMS-1 can still be used to detect motion, even with the focus and vignetting problems. It will be useful for robot navigation applications.

© 2006, 2007 Mac A. Cody

Last updated Friday, March 9, 2007