Shop OBEX P1 Docs P2 Docs Learn Events
Mouse control with Mesemic 2125 Accelerometer — Parallax Forums

Mouse control with Mesemic 2125 Accelerometer

TechnoRobboTechnoRobbo Posts: 323
edited 2010-06-15 14:29 in Robotics
Recently I picked up the Mesmic·Accelerometer and started to play around with it. Immediately the movie "Minority Report" came to mind. What if I could build a glove so I can manipulate the mouse cursor? Or better yet, do PowerPoint presentations by waving my hand around.


The circuit design was simple and obvious, but I realized that I needed to create a Windows mouse driver.· One that worked without the MSCOMM control so it was universal. (tested on Windows XP , I have not tested Windows 7 or Vista - I am hoping others can post any success).

Here's the Circuit (nothing to brag about):
attachment.php?attachmentid=69322
Here's the BS2 code -

' {$STAMP BS2}
' {$PBASIC 2.5}
LBtn  PIN 9
RBtn  PIN 10
x VAR Word
y VAR Word
DEBUG CLS
DO
PULSIN 6, 1, x
PULSIN 7, 1, y

DEBUG "!",DEC4 x,",",DEC4 y,",", DEC1 RBtn,",", DEC1 LBtn,CR
LOOP



Attached are the Driver and driver source code - feel free to modify since the timing is based on a BS2.

The more you tilt the Accelerometer the faster the mouse moves. When the Driver is active a custom cursor appears to let you know the driver is active. To deactivate Accelerometer control of mouse hold down left and right buttons together for a half second (this is adjustable) and the cursor will change back to normal. Hold down both buttons again to reactivate. hold down the buttons for approx. 7 seconds and the driver shuts down.·

The instructions are easy (these are new instructions so please read):
Run the MoseGlove.exe. You are required to run the Control Panel to set the Comm Port and any other adjustment - run the MouseGloveCP.exe program for the control panel! No command line parameters are required!·As with any mouse,·you need to run the Control Panel·to change the settings only ·- the driver is the only software needed to use the MouseGlove.




The Serial API module was written by· David M. Hitchner slightly modified for my purpose. You can find the Original code here: http://www.thescarms.com/vbasic/CommIO.aspx


Mouse Glove·Construction Details

attachment.php?attachmentid=69321

Accelorometer and pushbuttons ·were embeded in pools of high temp hot glue. Using a cloth glove I glued the controls with a product called Mighty Mendit (Sold on TV by the late Billie Mays)·which adheres to fabric and stays flexible.

·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Have Fun


TR

Post Edited (TechnoRobbo) : 4/24/2010 5:04:38 PM GMT

Comments

  • TechnoRobboTechnoRobbo Posts: 323
    edited 2010-04-18 16:24
    New Mouse Driver -easier to use - ·more ergonomic

    My original driver scaled the left and right, up and down equally. I realized that didn't coincide with natural wrist motion.

    The MouseGlove Driver

    If your using the mouse glove with your hand laying on a table you needed the center neutral position to be greatly offset in pitch an tilt. I also wanted to standarize the amount of mickeys (.oo5 of an inch in Microsoft Mouse lingo) one can move in opposite wrist motions.

    The GloveMouse Driver has been simplified - just run MouseGlove.exe if the Comm Port is invalid it will tell you to set it via the control panel.

    The Control Panel

    I also needed an easy user interface. ·Any user should be able to operate without worry about numbers and the nuts and bolts of commandline settings.

    This is the results of my concerns ( the drivers and control panels are now available·in the fist of this thread):
    ·attachment.php?attachmentid=69557

    The you need to run the control panel only to change the settings - only the driver is needed to use the MouseGlove

    The Control panel is self documented. It will scan your system for available mouse ports and reads the registry for the current settings ( the mouse driver sets the registry when sent a adjustment command·from the control panel.) If the mouse driver is running when you start the control panel, you can tweek sensitivity and the neutral position. If the mouse driver is not running then you can use the control panel to set the Comm Port.

    Adjusting Sensitivity

    In order to make the sensitivity more ergonomic (this came out of a conversation with a friend of possible applications for the·acclerometer·and the·handicapped or people with limited range of motion), I changed the mouse control algorithm to scale evenly from neutral center (using a normalized quadratic equation) the response curves are illustrated below where the center position has been offset to the left·, right and dead center.

    Center Neutral

    ·
    attachment.php?attachmentid=69558
    Right Offset
    attachment.php?attachmentid=69559
    ·Left Offset
    attachment.php?attachmentid=69560
    Download the New Driver Install Program as well as the Source Code from the first post.
    · ·
    If you have no intention of customizing the driver or control panel - ignore the following - it's not necessary. The driver and control panel work fine as is.

    A Few Notes for Programmers

    The Source Code has a Resource file that includes the mousepointer cursor icon (101) and my logo (APPICON)· those of you who know how to create them can easily modify them.

    The control panel speaks to the driver via subclassing, the driver accepts WM_PASTE messages, therefore it is critical that the control panel finds the driver via the window name "MouseGlove" If you change the name of the exe file make sure you update the control panel to reflect the change (eg. WinWnd = FindWindow(vbNullString, "YourDiverName")).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 4/24/2010 5:01:48 PM GMT
    284 x 490 - 114K
    2200 x 1700 - 269K
    2200 x 1700 - 268K
    2200 x 1700 - 267K
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2010-04-24 18:14
    Mouse Glove Video Demo

    You Tube·- Click This Link

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 4/24/2010 7:26:33 PM GMT
  • silverbacksilverback Posts: 40
    edited 2010-04-27 10:19
    Nice

    I liked the project so much I used it as an excuse to go and get Memsic.

    Have you though of adding a ping distance sensor to give you a Z capability? It would be kind of limited but you could use it to resize windows or something alone those lines.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you convince yourself that something is impossible before you even try; you are sure to prove yourself right.

    Post Edited (silverback) : 4/30/2010 1:55:33 AM GMT
  • legoman132legoman132 Posts: 87
    edited 2010-04-28 21:26
    Impressive. Perhaps you cold make a propeller version that didn't need a special driver (see Micah Dowty's "Working full-speed (12 Mb/s) bit-banging USB Host controller" to send the HID usb data)
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2010-05-04 01:09
    legoman132 said...
    Impressive. Perhaps you cold make a propeller version that didn't need a special driver (see Micah Dowty's "Working full-speed (12 Mb/s) bit-banging USB Host controller" to send the HID usb data)
    I'm working on a lightweight wireless glove so I can loose the annoying umbilical cord·- perhaps after I finish the new hardware I'll make an HID version.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 6/15/2010 2:31:50 PM GMT
    800 x 600 - 383K
    800 x 600 - 397K
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2010-06-15 14:29
    Quick Wireless·Update

    I finished my wireless prototype but significant change were made. First I rewrote the driver in C. With all due respect to Mr. Hitchner I found the VB module a bit of a CPU hog. The new driver and control panel barely take up system resources and do not require runtime library or install programs (vb was my choice for prototyping only).

    I can't publish the wireless project here due to the parts I used were not all from Parallax. I chose the parts based on size and price,·not performance. I have not added USB support - this can be accomplished via an adapter. Here's some pictures with brand names blurred.

    This is the glove mouse - before it's installed in a glove. I placed a quarter on the table for scale.
    attachment.php?attachmentid=71182



    This is the receiver. 315 mHz - that's RKE freq. Used for car entry and garage door openers- works at 2400 baud but the original microsoft mouse only used 1200 baud so that's plenty of speed.

    attachment.php?attachmentid=71183
    http://www.youtube.com/watch?v=hHjvRhXRhUs

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR

    Post Edited (TechnoRobbo) : 6/18/2010 5:14:23 AM GMT
Sign In or Register to comment.