Shop OBEX P1 Docs P2 Docs Learn Events
USB mouse for Prop — Parallax Forums

USB mouse for Prop

MightorMightor Posts: 338
edited 2007-08-15 08:31 in Propeller 1
Hey there,

I have an optical mouse (a Logitech) I'd like to use for positioning my robot. However, the mouse is a USB one so I am not sure if I could use the guts of it the same way you'd use a PS2 one. The small PCB in the mouse has a 5-way connector to which the USB cable attaches. Basically I'd like to attach it to the bottom of the robot. Is it possible to just remove the USB cable and hook it up to the board the same I would with a PS2 mouse?

Gr,
Mightor

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
| Any sufficiently advanced technology is indistinguishable from magic.

Comments

  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-08-13 21:51
    The only way to use it would be to use just the encoders inside it and decode them directly, there will be no PS/2 signals kicking around inside.

    Graham

    p.s. mice sound nice for positioning until you turn on the spot, you need 2, well one and a half really. Or do you mean for you to operate in order to position your robot?
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-08-13 22:15
    Most USB mice are done in way thats PS/2 compatible (I can't explain the particulars of how they do it), but if you have one of those USB to PS/2 adapters lying around test the mouse and see if it is recognized as a PS/2 mouse, if so it is the type that is PS/2 compatible, sniff the adapters pins with a continuity checker to figure out how the pins are passed through.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-14 02:47
    I have encountered two types of mice during the past two years:

    (1) PS/2 mice with a small adapter plug enabling a connection into the USB port.
    (2) USB mice with a similar small adapter plug to allow a connection into a miniDIN PS/2 port

    There must be millions of those adapters laying around unused....
  • MightorMightor Posts: 338
    edited 2007-08-14 03:55
    This mouse works fine when I put one of those USB->PS2 adapters on it. I have a big heap of them and this mouse came with one when I got it. Most Logitech USB mice do.

    However, I'd like to hook it up to my prototype board without the actual USB->PS2 adapter and a PS2 socket. I intended to make my own leads for it since I don't really want about a meter of cable inside the bot (I doubt it would even fit).

    I think I can solve the movement detection problem when I spin around the axle. If the mouse sensor is placed off center I don't have that problem. I will need to do some extra calculations but it should be pretty trivial to determine its true center and the offset of the sensor.

    I was wondering what the guts of one of those little adapters was. I thought that maybe some voodoo-magic happened to the signals as they passed through to make them PS2 compatible. If this is not the case and it merely rewires the signals then I should be fine, in theory [noparse]:)[/noparse]

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | Any sufficiently advanced technology is indistinguishable from magic.
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-08-14 10:54
    What was I thinking, I forgot all about those adapters probably because I bought a usb keyboard, took the end off the cable and put a PS/2 connector on just to find out that the mouse in question did not have legacy support for usb. Bad memories of that, why didn't I check!!
    Mightor said...

    I think I can solve the movement detection problem when I spin around the axle. If the mouse sensor is placed off center I don't have that problem. I will need to do some extra calculations but it should be pretty trivial to determine its true center and the offset of the sensor.
    Mightor

    No, that won't do it, the mouse "assumes" that it is being moved perfectly without being rotated, for human user interface this is fine but for tracking robot movement it is not, not unless it points in the same direction all the time.
    Mightor said...

    I was wondering what the guts of one of those little adapters was. I thought that maybe some voodoo-magic happened to the signals as they passed through to make them PS2 compatible. If this is not the case and it merely rewires the signals then I should be fine, in theory [noparse]:)[/noparse]
    Mightor

    As you may have guessed from my first comment, they are just adapters, no smarts. You know it works so just be sure to get the pin-outs right.

    Graham
  • MightorMightor Posts: 338
    edited 2007-08-14 11:51
    Graham Stabler said...

    No, that won't do it, the mouse "assumes" that it is being moved perfectly without being rotated, for human user interface this is fine but for tracking robot movement it is not, not unless it points in the same direction all the time.
    When I turn about on the center of the robot, the mouse will detect movement to the left or to the right, ie, only one axis will change by a certain amount, that is directly proportional to the distance from the center and the angle turned. Since I know which direction I am turning, this should be pretty trivial to calculate, no? This would only work if the bot really only turns about on its center.

    attachment.php?attachmentid=48707

    Or am I mistaken?

    Gr,
    Mightor

    PS: Phear my 133+ MS Paint skillz.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | Any sufficiently advanced technology is indistinguishable from magic.
    191 x 224 - 2K
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-08-14 13:03
    I think with parallel wheels it's probably safe to assume zero lateral movement along their axis. So any right or left movement detected would be the result of pivoting.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-08-14 17:26
    I too once thought there was some translation going on in those adapters, but it turns out they are just pass though, so you should be able to hack the wires and use the PS/2 driver to interface with it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • edited 2007-08-14 17:32
    Hey Mightor... it looks like you are trying to accomplish something similar to this Bot made by Chad:

    http://forums.parallax.com/showthread.php?p=661158


    Notice that he mentions "The only really critical part is holding the bottom of the lense exactly .09 in off the surface being tracked." of course, his robot is intended for a sumo surface.... I wonder if you plan to use your robot on smooth surfaces only... if not... it might pose a reliability reading issue of the sensor...

    you also have the optomechanical mouse option, please look at the bottom of the following discussion:
    http://forums.parallax.com/showthread.php?p=660556


    I hope this helps... happy roboting!..
  • MightorMightor Posts: 338
    edited 2007-08-14 17:46
    Joe 'Bot' Red said...
    Hey Mightor... it looks like you are trying to accomplish something similar to this Bot made by Chad:
    ....
    you also have the optomechanical mouse option, please look at the bottom of the following discussion:
    ....
    I hope this helps... happy roboting!..
    I got my initial inspiration from Chad's mini-sumo. He was the reason I went ahead and bought the Prop proto boards to see if I could figure out how to make a Prop based mini-sumo myself [noparse]:)[/noparse] I am using the Boe-Bot with a Prop proto board mounted on its frame to get the hang of the basic principles of movement, detection and positioning using the Prop. After that I intend to build a somewhat wedge-shaped mini-sumo. It's going to be a challenge to fit the 100x77mm board in it, but I think I have an idea [noparse]:)[/noparse]
    As for optomechanical sensors, I do have the Parallax wheel encoder kit but I'd like to try something I haven't played with before.

    Right now I am just playing around with different ideas, the mouse sensor was just one of them. In the end it might not even be necessary to be able to tell the position so precisely, if nothing else it'll be fun to play with a sensor like that [noparse]:)[/noparse]

    I am still at the "how to make the servos and using the Ping))) sensor" stage, so the actual mini-sumo is still a ways off for now.
    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | Any sufficiently advanced technology is indistinguishable from magic.
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-08-14 21:42
    Mightor,

    I hadn't realized you were doing a two wheeled bot, I should have thought, it limits the motion to back/forth and rotate so you have enough encoders for your degrees of freedom.

    It is possible to calculate the change in position but it is not that trivial as will never just do true rotations and translations, instead you will have mixtures however you can recalculate the position on every encoder pulse much as I did with my dual wheel odometry:

    www.youtube.com/watch?v=VhNhFyN0oHw
  • MightorMightor Posts: 338
    edited 2007-08-15 03:56
    Graham Stabler said...
    Mightor,

    I hadn't realized you were doing a two wheeled bot, I should have thought, it limits the motion to back/forth and rotate so you have enough encoders for your degrees of freedom.

    It is possible to calculate the change in position but it is not that trivial as will never just do true rotations and translations, instead you will have mixtures however you can recalculate the position on every encoder pulse much as I did with my dual wheel odometry:

    www.youtube.com/watch?v=VhNhFyN0oHw
    Graham,

    Nice little video. The animated sprite looks kinda cool [noparse]:)[/noparse] You had no way of knowing about the two wheels until I mentioned it in post #7 or so. As for calculating my position, I thought I would limit my robot's turns to just ones about its axle, therefore limiting the amount of special calculations I need to do to get my position. The encoders from Parallax are only really limited by the wheel that causes them to pulse. The Boe-Bot wheels only have the ability to generate 16 pulses, that seriously limits their usefulness for accurate positioning.

    As you can see, I still have a lot of figuring out to do but it's a fun process along the way.

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | Any sufficiently advanced technology is indistinguishable from magic.
  • bulkheadbulkhead Posts: 405
    edited 2007-08-15 05:12
    Mightor, I've also tried adding the parallax optical mouse sensor to a prop controlled sumobot. My understanding about USB/PS2 mice is that some USB mice work with PS2 ports (with the adapter) but others wont (even with the physical adapter).

    I just used the optical mouse from parallax since it is cheap ($4.95), ps2, and pretty much known to work. If you are going to use it, BE CAREFUL. The letters on the PCB (you will see it after you take the cover off) are very misleading. The "C" wire is actually the Data line and the "D" wire is actually the Clock line. Also, ground is the orange wire and +5v is the blue one. Also, I needed the sensor to fit in a small enclosure so I had to cut off the top part of the PCB that contains the 3 switches and scroll wheel, but doing so disconnects the power to one pin (it loops around the edge of the PCB). If you cut the board you will need to add a jumper for power.

    From my experience, there is actually a small range of heights that the lense can be for the sensor to work. I haven't used it for precision position tracking though, just for detecting direction and speed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm new to the propeller!
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-08-15 08:31
    Mightor, that is probably a good way to do it, although it may not turn exactly on the spot the error may well be small enough for your application. I was trying to develop a low cost 2D ultrasound scanner when I did that stuff and although it worked the simple loss of a few nm on each movement built up to cumulative errors too large for the scanning process, I probably should have guessed.

    Optical mouse have acceleration built in (or it is a function of the technique) so may be tricky to use accurately.

    Graham
Sign In or Register to comment.