Thursday 1 September 2011

Computer Mouse Surgery (Motion Tracking)

Having a mouse run around the virtual reality requires tracking movement of the mouse (i.e. the treadmill) and updating the location in the virtual reality accordingly. The cheapest system for motion tracking are optical computer mice, placed stationarily at the equator of the spherical treadmill. Apart from being cheap, computer mice are also very easy to interface with the computer. Hölscher et.al. (2005) have succesfully used this system and so have Harvey et.al. (2009), and so will I.

One of the technical difficulties is that the lens has to be very close to the surface of the treadmill, and even small changes in distance can cause problems in tracking motion. Recently, mice with laser instead of normal light are becoming available which are more precise and also seem to tolerate changes of distance between sensor and surface better. After a few tests I decided to use one of the standard issue Dell mice:

The mouse used for motion tracking. Very cost efficient and shows good performance. Dell calls it almost affectionately "Dell Laser Scroll USB (6 buttons scroll) Black Mouse'

One of the potential downsides of this unit is that it has an inbuilt function to change cursor speed. This might cause problems later on because I need a 1:1 mapping between mouse-movement and input to the computer. I will explain this further in a later post.

First of all I had to remove the housing of the computer mouse and take out the parts that mattered, which is essentially just one PCB board. I would like to show you pictures of the gutting process, but alas I've done that to so many computer mice before this one that I stopped documenting it. My desk is a computer mouse graveyard. Soon enough I will need a second one of these though, at which point I will upload a post with pictures of every step.

After taking out the PCB board I also found out that this mouse has a very handy construction feature: the lens for the laser and camera is directly mounted on the chip (unlike most other mice where it is attached to the housing). So I can just take the PCB out and have a fully functional mouse:

The underside of the computer mouse PCB. In the centre you can see the lens.
To allow the mouse to track the motion of the treadmill we need to bring the bottom surface of the lens as close as possible to the surface of the ball without touching it. To do that we need something that holds the PCB board. I guess it's redundant to say that the combination of 3D-modelling software and 3D-printing came in very handy here.

A 3D model of the mouse holder. The pole at the bottom is 1/2" in diameter so I can mount it like any normal post on the airtable. The other features are easier to explain when you see the finished thing.



The PCB board slots in like this, exposing the lens quite well. I only had to make minor adjustments because apparently my measurements were not 100% correct.
The PCB board is fixed like this. A screw, that just happens to have exaclty the right length, presses down at the board at a point where there are no components. I realise the screw can come lose quite easily, should that become a problem I will just put some Loctite on the thread.
Because 3D printing is neither precise enough nor strong enough to make a thread for a screw I left a slot for a nut. To my surprise it fitted in absolutely beautifully, no need for glue or anything. The cutout on the top right makes space for the USB cable.

You can see a small rectangle cut out in the picture above, this is where the connector for the USB cable is located. Simply plug in the cable and then connect it to the computer like you do with a normal mouse (see picture below).

Results

After putting everything together there wasn't much to do other than to mount it on the airtable and see how it works. The mounting angle turned out to be a problem here. The base of the treadmill didn't leave enough space to mount the mouse straight on the equator. This meant I had to angle the computer mouse a bit and mount it further up which in turn required me to mount it vertically rather than horizontally as I had .planned initally. This means I needed more space for the posts, which is suboptimal because there isn't much space left (micromanipulator) and right (head restraint). The next generation of the 3D-model will resolve this problem, at a price of less than £100,- per 3D-print, one or two protoypes are within budget.

A first test showed that movement along the horizontal axis is picked up very well (i.e. running forward and backward), however, movement across is tracked rather poorly. This means I will need a second mouse mounted 90 degrees to the current mouse to pick up sideways movement, as it has been done in the two setups before me (Hölscher et.al. 2005 and Harvey et.al. 2009).

 
This is how it is mounted right now. Not ideal, but this will be resolved in the next generation of the 3D-model of the holder. The clearance is as small as possible, but small movements of the ball have to be taken into consideration.

Update
Here is the link to the follow up post: http://mousevr.blogspot.com/2011/10/apples-and-oranges-that-look-like.html

References

1. Harvey CD, Collman F, Dombeck DA, Tank DW. Intracellular dynamics of hippocampal place cells during virtual navigation. Nature. 2009;461(7266):941-6. Available at: http://www.ncbi.nlm.nih.gov/pubmed/19829374 [Accessed September 20, 2010].

2. Hölscher C, Schnee A, Dahmen H, Setia L, Mallot H a. Rats are able to navigate in virtual environments. The Journal of experimental biology. 2005;208(Pt 3):561-9. Available at: http://www.ncbi.nlm.nih.gov/pubmed/15671344 [Accessed June 15, 2011].

1 comment:

  1. This is a really good find. My buddies at Electrician Online Course will definitely be awestruck! Thanks.

    ReplyDelete