Gyroscopes


for my gyroscopes I have gutted a 'GyroPoint GyroDesk' corded PS2 mouse, and attached a PS2-USB converter. this model is ideal because the gyroscopes are on a separate circuit board. however it is a very old piece of kit and very hard to find, even on eBay.

GyroMouse.jpg
here is the main circuit board and the gyros. Perfect!!!

so I chopped off the parts of the board I didn't need, and wired on a PS2 -> USB converter:
GyroBoard.JPG
the 6-wires go off to the gyroscopes
the 4-wires go to USB

here is a picture of the board inserted in the main project, with the gyros attached
( actually there are two boards inserted; one is not being used)
Gyro.JPG

this works very well as a head pointing device when the gyros are attached to a cap
GyroCap.JPG

Software


Catching the signals from the Gyros in XP is hard - windows amalgamates all of the mouse signals, so we had to do some low level coding in C# to isolate signals from each individual mouse, fiddle the signals from the GyroCap, then re combine them.

Liu Yang did all the brainwork here - big thank you!!

Here's a chunk to whet your apetite. Yum Yum.
        public CatchRawMice()
        {
            CreateParams p = new CreateParams();
            p.Width = 0;
            p.Height = 0;
            p.X = 0;
            p.Y = 0;
            p.Style = WS_CHILD;
            p.Caption = Guid.NewGuid().ToString();
            p.Parent = GetDesktopWindow();
            base.CreateHandle(p);
 
            mouseHook = new MouseLibrary.MouseHook(); // does GC.KeepAlive(MouseHookProc)
 
            rawMouseInput = new RawMouseInput();
            // which does: hDevice_GyroMouse = GetGyroMouseHandle();
 
            // insert hook which eats signals from all mice
            mouseHook.DisableMouse(); //[LowLevelMouse.cs]
            //does: MouseHookProcedure = new HookProc(LowLevelMouseProc);
            //      hhkLowLevelMouse = SetWindowsHookEx(WH_MOUSE_LL, MouseHookProcedure, ...
            // so LowLevelMouseProc () gets to intercept all mouse messages, 'eating' all mouse-moves
            // and thus disabling mouse movement
 
            rawMouseInput.RegisterForWM_INPUT(this.Handle);
            //however WM_INPUT signals now get thru into WndProc()
        }
 
        ~CatchRawMice()
        {
            mouseHook.EnableMouse();
        }
 
        protected override void WndProc(ref Message m)
        {
            bool IsGyro;
            int x, y;
 
            //some mouse moved; but which one?  read in new mouse values.
            if (m.Msg == Konst.WM_INPUT)
            {
                rawMouseInput.ProcessRawMouseData(m.LParam, out IsGyro, out x, out y);
                if (fp_SomeMouseMoved != null)
                    fp_SomeMouseMoved(IsGyro, x, y);
            }
 
            base.WndProc(ref m);
        }