Shop OBEX P1 Docs P2 Docs Learn Events
Mouse Sensor Module in Development -- Draft documentation posted (8 Mar 2010) — Parallax Forums

Mouse Sensor Module in Development -- Draft documentation posted (8 Mar 2010)

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2011-03-01 19:31 in Accessories
Ken Gracey obtained some sample mouse sensor chips and their associated lenses/lightguides on a recent trip to China. He approached me with a request to help him develop an optical mouse sensor module. The idea was to have something that would interface to BASIC Stamps and Propellers and that would detect X and Y motion from a contact or near-contact surface. The chips and optics are mass produced for computer mice, but they're not terribly user-friendly for experimenters. Although the chip comes in a DIP, it's bottom-looking, requiring a board cutout, and has staggered 2mm-spaced pins. The optics consist of a single, clear injection-molded piece of plastic with no mounting holes. The chip docs show how all the pieces are supposed to fit together using a custom injection-molded base. But this isn't much help for the do-it-yourselfer.

I knew the mechanical part would pose the biggest challenge, and I wan't about to design any injection-molded parts. I was counting on a recently-acquired laser cutter to design an easily-fabricated base assembly when I agreed to work with Ken on his project. It actually turned out to be fun, as most such challenges do. The optics have a very short focal length and about a 0.2mm depth of field. This means that the lens assembly has to be rather precisely positioned over the surface it's looking at to obtain a focused image. But good fortune smiled on me for once. By stacking a couple laser-cut pieces of Plexi (or Delrin) and fastening them together with plastic push-pull snap rivets, I could not only get the right height, but create a base with a pocket for the lens, smooth, slick feet for gliding on the surface, alignment pins for the PCB, and hex-shaped pockets to capture the nuts required to hold the PCB in place. Here are a couple photos of the base:

attachment.php?attachmentid=67472attachment.php?attachmentid=67473

The PCB is attached to the base with #2 screws and nylon spacers. Bivar sells spacers in length increments of 0.005", so it wasn't difficult getting some that set the PCB at just the right height for the chip to be in contact with the lens. The nut pockets in the base not only keep the nuts from protruding, but they also eliminate any need for a wrench during assembly.

So the mechanical part, after much trial and error, came together with more than a little luck and serendipity. The electrical interface proved to be just as "interesting", however. The sensor chip requires +5V, Gnd, and two signal lines: clock and bidirectional data. That's four pins. The easiest-to-interface cables that Parallax offers are are their three-conductor "servo" extension cables. Now, I could have just slapped an AVR on the board to drive the sensor chip and provide a one-pin bidirectional serial interface; but Ken and I both agreed that that would not only add too much to the cost and size of the module but that it would insulate the user too much from the sensor's native interface. I still wanted to use the servo cable, though, so we decided to include a 2x3 header on the board with a configurable pinout and one very interesting option.

It turns out that the sensor chip wants to have a clock that's mostly high but pulses low. This provides an opportunity to supply power to the module on the clock line, reducing the conductor count to three, as shown in the following partial schematic:

attachment.php?attachmentid=67474

I've tested this method, and it works fine. As a bonus, since the input clock is inverted, and since the SHIFTIN/OUT instructions in PBASIC support only positive-going clocking, it allows these instructions to be used with the mouse module, instead of having to bit-bang it. This won't be the only connection option, but it's the one that uses the least amount of cabling.

In order to test everything together before committing to a PCB, I laser-cut a mockup from acrylic, to which I hot-melt-glued the components and underneath which I wired the circuit. Acrylic doesn't make a very nice circuit board, BTW. Its low melting point means you really have to work fast with the soldering iron; and heaven help you if you need to use solder wick! But, despite numerous melt "adventures", I got it to work. Here's what the whole initial proto module looks like:

attachment.php?attachmentid=67477attachment.php?attachmentid=67475

The overall X/Y dimensions are 1.8" x 1.0". The PCB overhangs the base by 1/4" to allow access to the PCB's two mounting holes in the end. You'll notice that the board uses all through-hole components. This is because it will be offered in kit form. Ken and I both agreed that this is the best way to keep costs down and provide the maximum value to the end-user.

Now that I see how everything fits together, I can lay out the PCB and get some protos made. More later!

-Phil

_

Post Edited (Phil Pilgrim (PhiPi)) : 3/9/2010 3:16:26 AM GMT
370 x 298 - 15K
304 x 298 - 13K
500 x 260 - 3K
452 x 281 - 43K
449 x 281 - 45K
«1

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-06 00:17
    Nice job Phil.
  • kf4ixmkf4ixm Posts: 529
    edited 2010-02-06 00:34
    Nice!,Hats off to Phil and Ken for this new kit. i love the nice, clean design of it and that it will be offered in kit form. Looking forward to seeing the finished kit.
  • WBA ConsultingWBA Consulting Posts: 2,934
    edited 2010-02-07 00:27
    Phil, beautiful work. Thanks for sharing the design/thought progress. I like seeing the steps to get to a product more than seeing the final product usually. I think this will be a really straight forward and useful module.

    I was looking at a similar circuit design to drive an SHT11 sensor from two wires instead of the 4 necessary by using a 3.3v/5v split design. When 5v is applied to the two wires, it charges a cap on the SHT11 board. When less than 5v is seen on the two wires, the SHT11 works as if it's connected to the data and clock lines. The SHT11 draws such little current that I believe it's feasible to power it from a cap while it takes a measurement and sends out the reading.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andrew Williams
    WBA Consulting
    WBA-TH1M Sensirion SHT11 Module
    Special Olympics Polar Bear Plunge, Mar 20, 2010
    Propeller-Based Reverse Geo-Cache Birthday Present Project

    Post Edited (WBA Consulting) : 2/7/2010 12:33:32 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-02-11 00:04
    Thanks, guys! The Mouse Sensor PCB has been sent off for proto fab. Here's a screen capture from my PCB CAD program:

    attachment.php?attachmentid=67621

    -Phil
    1042 x 625 - 51K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-02-20 00:48
    The printed circuit proto boards arrived! Here's what the panel look like, from Advanced Circuits:

    attachment.php?attachmentid=67941

    I had to cut them out with the CNC mill. This is what the mouse sensor board looks like before assembly:

    attachment.php?attachmentid=67942

    ... and after assembly:

    attachment.php?attachmentid=67943

    So far, things seem to work okay...

    -Phil
    600 x 359 - 53K
    470 x 274 - 32K
    466 x 390 - 30K
  • kf4ixmkf4ixm Posts: 529
    edited 2010-02-20 00:58
    These look great Phil! Nice Job!
  • BeanBean Posts: 8,129
    edited 2010-02-21 03:12
    Phil,
    What type of info does the sensor provide ?
    Is it image data ? Or movement data ? Or something else ?

    Detail man....We want details... [noparse];)[/noparse]

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    ·
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-02-21 04:20
    Details? Well, okay, but it's a little complicated so far. You see, I'm using the Unity Opto MCS-12086 mouse sensor chip (datasheet attached). I like it because it doesn't need an external crystal or resonator, thus keeping the board size and bill of materials as small as possible. But you'll notice that the datasheet says nothing about what registers are accessible or what they contain. For that reason, I'm having to rely on a datasheet for a competitor's chip (which, unfortunately, is stamped "Confidential", so I can't post it here) for that information. So far, the competitor's datasheet has provided a good roadmap to the Unity Opto chip's registers, and I've been able to extract dX-dY movement data from it and can turn the chip on and off. But I've seen no evidence that any actual pixel information is available from it.

    -Phil
  • BeanBean Posts: 8,129
    edited 2010-02-22 23:16
    Phil,
    dX-dY is great.
    The image data would probably be of very little practical use anyway.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    ·
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-02-23 01:26
    A minor, but solvable glitch: I went to characterize the current draw of this module for the docs, and it was 50mA! That seemed awfully high, and it had to be from the LED. The MCS-12086 datasheet shows a schematic in which the LED is driven directly from the pin without a series resistor. This isn't a typo either, since the first page indicates that it can run with just three external caps and no other components. So I designed the board that way. But, with that kind of current draw, the datasheet has to be wrong; so I scabbed on a 100R series resistor. It still works fine, and the current consumption has dropped to 35mA, with about 19mA going to the LED. This seems a lot saner. As a consequence, I changed the board layout for the production run to include the series resistor. I guess datasheets should always be viewed with a jaundiced eye.

    I wanted a way for users to see their Mouse Sensor in action graphically, so I wrote a Perl program that tracks the sensor's motion on the screen. Here's what the output looks like:

    attachment.php?attachmentid=68022

    From this program I learned that it's difficult for the BASIC Stamp to keep up with motion at 800 dpi without overflow occurring in the 8-bit DX and DY registers. So I changed the resolution in the default PBASIC demo program to 400 dpi. It tracks much better now. With a Propeller, of course, this would not be an issue.

    One thing that users will have to be aware of is that this is a mouse sensor, not an XY encoder. It's very good at measuring relative motion, but its repeatability in an absolute sense is not perfect. After all, it's optimized to track on just about any random surface, not one with encoder stripes. To illustrate what I mean, place your computer mouse at a known location on the mousepad, so the mouse pointer is near the middle of the screen. Touch your finger to the screen at the mouse pointer's location, then move the mouse around a bit, and return it to its beginning locaton on the mousepad. Is the mouse pointer under your finger? Probably not.

    Now I've got to come up with a Propeller object for this thing and do the docs. More later!

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 2/23/2010 4:15:45 AM GMT
    511 x 560 - 14K
  • Chip CoxChip Cox Posts: 73
    edited 2010-02-23 02:48
    Phil,
    At the risk of sounding really stupid here, other than its' cool, why do I want this? There is already an optical mouse that interfaces nicely with the propeller. At least I am guessing it does since the ps2 plug is there for it to attach to ( haven't tried it yet ).
  • FranklinFranklin Posts: 4,747
    edited 2010-02-23 02:57
    Phil designed it and Parallax will sell it, what else do you need?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Chip CoxChip Cox Posts: 73
    edited 2010-02-23 03:24
    That covers the cool part scool.gifyeah.gif .
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-02-23 03:34
    I have a long, long, long list of things I want to make and build. About three years ago I had a vision of a robot that can transverse in any direction. One of the items I wanted to implement on the robot is accurate feedback of how it was moving. Because of the nature of the wheel design in a omni-direcitional robot standard encoders won't work. I sketched up some designs to use optical feedback modules from computer mice. Phil has completed a design and now I don't have to finish with my design - I can just but the part and use it as is.

    Think of this item not a a mouse replacement, but has an encoder and feedback mechanism.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-02-23 03:54
    Okay, so maybe I'm experiencing a brain fart here... and I really don't know what I'm talking about.... But if you hit certain kinds of surfaces with a laser, you'll see a speckle pattern, and it seems to me that such patterns are fairly fixed in space so long as nothing is vibrating, etc. These speckle patterns remind me of grains of sand seen under a microscope and I'm just guessing it's the kind of randomish light/dark pattern that an optical mouse "sees" when it rolls over the surface of a table, etc. Any chance Phil's latest brain child can utilize such a speckle pattern to measure vibration, motions of an observer in 2 or 3-D, etc? Or am I just out of my mind once again? eyes.gif
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-02-23 04:10
    Calling it a "brainchild" is attributing way too much credit here. I mean, c'mon guys, it's an implementation of existing technology that some may find useful — nothing more. But, yeah, I think you could use it for measuring vibration at frequencies within the unit's sampling range. Mounted on a sufficiently long lever arm and mechanically coupled to the earth, it might even be possible to fabricate a reasonable seismometer from it. Who knows? I guess that's the reason for putting it out there: so people can discover novel applications for it. smile.gif

    -Phil
  • Chip CoxChip Cox Posts: 73
    edited 2010-02-23 04:37
    Ok, the cool factor.·

    I was just wondering if it was something like the new relay board or a gps where there was an obvious use.· Sounds like this is more like some of the other sensors that are there to tweak the immagination.· Those are fun to expiriment with.· Now I'm going to have to think of a fun way to use it.

    Thanks
  • Ken GraceyKen Gracey Posts: 7,390
    edited 2010-02-23 04:53
    Marketing guy just arrived on the scene! Why do you need it? In no particular order:

    Reason #1: Because it's another unique sensor with Parallax support (courtesy of Phil) and code examples for BASIC Stamp and Propellers. Did you see the Mouse Monitor program above to help you visualize the output?

    Reason #2: It's not stuck in a standard mouse package designed for the palm of your hand - giving you the chance to use it for other kinds of unique applications of your choice. Hmm. Think it could be feedback for a robot or a position control device for manufacturing?

    Reason #3: DIY interest - all through-hole design means you get to build it! You will know how it functions and be proud of your soldering work.

    Reason #4: Experimentation and innovation. You aren't buying toilet bowl brushes from us, but interesting tools that develop your innovative and creative interests. Investing in yourself! We have a mission statement about serving innovative and "naturally curious" people. That's you!

    Reason #5: Cost! Okay, this is certainly one of those devices that costs more in this form than it does in the native mouse design. But it'll still be under $20.

    Reason #6: Education and open-source. We'll give you the whole project, from schematic, BOM to gerbers and code. . . for free and without restriction.

    Ken Gracey
    Parallax Inc.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-02-23 04:54
    ....orrrr how about this: measuring the rate of fluid flow in a transparent tube by "observing" the passage of minute bubbles/debris/organisms, etc. ???

    And gosh, Phil, if it's not a brain child then from what part of you has it been begat?

    Post Edited (ElectricAye) : 2/23/2010 5:02:52 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-02-23 05:32
    ElectricAye said...
    And gosh, Phil, if it's not a brain child then from what part of you has it been begat?
    LOL! Do you really want me to answer that here? It's a family site, after all. smile.gif

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 2/23/2010 5:38:15 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-02-25 19:50
    I've updated the Mouse Sensor monitor program to include scrolling charts for velocities in the X and Y directions. This may come in handy for charting things like vibration. Here's a screen capture:

    attachment.php?attachmentid=68094

    -Phil

    _

    Post Edited (Phil Pilgrim (PhiPi)) : 2/25/2010 9:17:18 PM GMT
    819 x 559 - 25K
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-02-25 20:22
    That's really cool smile.gif !
    I'm thinking liquid turbulence detector, aren't you?
  • roboticsrobotics Posts: 90
    edited 2010-03-01 08:04
    Hi,

    When will this sensor be available for sale?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-01 08:19
    It's too soon to say for sure. But since it'll be a kit, there won't be any delay waiting for assembly. To do:

    Me:

    1. Write a Propeller object.
    2. Finish the docs.
    3. Submit protos and docs for Parallax tech and editorial reviews. If necessary, make revisions per the reviews.
    4. Order the first batch of boards.
    5. Make the first batch of bases.

    Parallax:

    6. Create inventory items and purchase components from my bill of materials.
    7. Kit the parts in bags and label.
    8. Take photos.
    9. Set pricing.
    10. Create a product page.
    11. Inform distributors.
    12. Announce it to the world.

    Okay, there's still a lot to do yet, and I probably missed a step or two.

    -Phil
  • Ken GraceyKen Gracey Posts: 7,390
    edited 2010-03-08 23:41
    Hey all,

    Phil is at Step #3 and Parallax is at Step #6, meaning we're within weeks at this stage.

    Had a chance to do an early review on the documentation this morning and this kit is fun, easy to use and rewarding to build.

    Maybe Phil will post the draft documents here.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ken Gracey
    Parallax Inc.

    Follow me at http://twitter.com/ParallaxKen for some insider news.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-09 01:55
    Sure can! Attached.

    -Phil
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-03-09 17:28
    Phil Pilgrim (PhiPi) said...
    Sure can! Attached.

    -Phil

    This device has a lot of potential. But it seems to me that this "Sensor" forum doesn't get much traffic, so perhaps you should also make the announcement in the Propeller Forum and Stamp forums, too, so the great unwashed masses of those forums can get interested, too.

    smile.gif
  • logan996logan996 Posts: 281
    edited 2010-03-09 20:21
    how much money do you think this will be sold for? (approximate)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When the government is afraid of the people there is liberty, when the people are afraid of the government, there is tryanny"

    · Thomas Jefferson
    ·
  • Let's Go!Let's Go! Posts: 124
    edited 2010-03-09 20:40
    I smell a high resolution direction controller mouse!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The smarter I get, the more I understand I don't know!
  • Ken GraceyKen Gracey Posts: 7,390
    edited 2010-03-09 23:28
    @logan996: I'm hoping for $19.99. The idea with this one is to provide a fun project at a reasonable cost. I realize you can get a whole mouse for $5, but the concept here is that you can learn how it works and build it yourself.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ken Gracey
    Parallax Inc.

    Follow me at http://twitter.com/ParallaxKen for some insider news.
Sign In or Register to comment.