Project now works with bumble-b too!

bumble-b is a mini usb developpement kit with at90usb162 microcontroller. It has a low price – 15$ – and price is digressive if you buy 5 (14$) or 10 units (13$).

The project now works on that board thanks to small updates of the code:
– port D is used instead of port E, which does not exist with at90usb162
– the mouse is reset (=initialized) in the main function, as a last initialization step (avoids a deadlock which seems to occur more with at90usb162 than at90usb1286)

The only modification that remains to build the project for the bumble-b is located in the Makefile: the MCU value has to be set to “at90usb162”.

What’s next?

I managed to convert ps/2 devices (mouse + keyboard) to a ps3 controller (see older posts, from the oldest one).

Now, I want to use following devices with my PS3:

1- wireless usb keyboard + mouse (Logitech EX100)
2- usb mouse (Logitech G5) + ps/2 keyboard
3- usb joystick (Saitek ST200)

More ideas:
– add a mouse and a keyboard in the same usb hid device (so that mouse and keyboard can be used as mouse and keyboard too)
– control a pc with the same mouse and keyboard
– convert multiple usb devices to a single ps3 controller

=> I’m now planning to convert usb hid devices to a ps3 controller.

A first idea is to:
– use the v-usb framework for the usb device (ps3 controller)
– use the LUFA framework for the usb host (to get data from hid devices)

BUT Teensy++ is based on an AT90USB1286 chip which only supports usb device mode.

Therefore:
– I have to find an AT90USB647- or AT90USB1287-based board such as AT90USBKEY
OR
– I have to work with a software-implemented usb host stack such as that one.

I’m not sure that it will work on a single chip (see discussion there).

Mouse to joystick translation – Call Of Duty Modern Warfare 2

COD MW2 has a totally different behavior regarding the position to rotation speed relation.

Following chart gives the rotation speed (degrees per second) given the absolute position of z.
The joystick sensibility is set to the highest position.


The rotation speed is continuous and goes from low to very high values, so that the mouse to joystick translation is very easy to do: a simple x3 multiplier is sufficient.

The acceleration looks like the mouse acceleration that is performed under windows xp (described there).

Mouse to joystick translation – FARCRY2 – part 2

It was explained in part 1 that absolute positions 1 to 82 give a linear rotation speed (from 0 to about 50°/s), and position 83 a high rotation speed (450°/s for z, 200°/s for rz).

Following chart gives the rotation speed for a given virtual position of z that goes from 0 to 645. That gives a linear speed from 0 to 450°/s. Virtual positions from 83 to 644 have to be created.

Blue dots are speeds that are achieved by real positions with a standard ps3 controller.
Red line is obtained with a simple linear regression.

Each mouse packet applies a rotation speed over a time that is the inverse of the mouse frequency (for ex 100Hz => 10ms).

A rotation speed for a virtual position between 83 and 644 may be generated “in average”.

For example, if a speed of 450°/s is applied (virtual position 645=real position 83) over 5ms, and 0°/s is applied (real position 0) over 5ms, the average speed that is obtained over 10ms is 225°/s (virtual position 321).

0+83 makes crappy movements, that technique actually works great with 82+83

I realized afterward that it is similar to PWM.

Mouse to joystick translation – FARCRY2 – part 1

(x,y) speed of the mouse has to be mapped to a (z,rz) rotation speed.

z and rz are in the range [0..255] with [83..173] as dead zone (128 is the center).

Following chart gives the rotation speed (degrees per second) given the absolute position of z.

This probably may change with the game (values are for Farcry).


This is quite linear except for the max position (83). The max speed that is in the linear area (position 82, about 50°/s) is not fast enough to only use the linear area. The speed of the max position is so fast (about 450°/s) that it shouldn’t be used over a long time.

There is the same behavior for rz, except that the speed of the max position is about 200°/s).

A heuristic has to be found to trigger the max position use.