ps3 controller for impaired player

27 Mar 2012

Hello the purpose will be to hack a standard controller to make one more easy for impaired people (this way it will be more universal and console independent)

the buttons/clicks are just a wiring pb

the analog joysticks are more tricky and i would like to control them with the head movement (3 axes)

I would like to use a 3 axe accelerometer or gyroscope to control the up/down, right/left, slide right/left . the forward/back could stay as it is.

does anybody know how to get a value dependent of the position (not of the acceleration) of the head ?

after that there is the pb of the emulation of the potentiometer, the more easy to do is to command modelist servo motor to drive normal pot but i think there is electronic pot I2C drived who could do the trick with a faster response

what do you think of the project ?

I've seen a commercial thing like that but the cost is around 1000$ for the complete system, I think it is possible to do cheaper solution (whit more possibility to adapt to different case

Thank you

27 Mar 2012

That sounds an amazing project,

here are two I made erlier !!

/media/uploads/ceri/_scaled_brs.jpg

/media/uploads/ceri/_scaled_photo-0053.jpg

The Big Red Button, cost me less than £10, comersial version >£200 !!

and the giant keyboard/mouse, wasent too expensive, recycle-reuse :)

Will think about some sensors & interface to body.

Cheers

Ceri

27 Mar 2012

Hello, I am too interested in this. Do You mean re-wire gamepad buttons to mbed Digital inputs, Sticks to Analog inputs and add accelerometer / gyro to controll "look" in games (right stick). It seems not to be so hard. If You use USB Joystick example here http://mbed.org/users/bricklife/programs/USBJoystick/ll8vnv You will have very good starting point.

Then mbed is enumerated by USB host as USB Joystick with 4 axes (two sticks), 12 buttons and DPAD. By modifiing Report descriptor we can get more/less of buttons, axes...

In code in main.cpp You will see actual usage/connection of DigitalIn and AnalogIn pins for buttons, axes and Dpad.

Program reads status of this digital and analog inputs 100 times/s and then sends those values as reports to host. In this case it is not problem to use any kind of input to be mapped as axe or button in report. So to use accelerometer / gyro data and map them to axes isn't problem. Values of axes are betveen 0 - 255 with 127 as center. I didn't use accelerometer / gyro anytime but maybe there will be need for some clever algorithm to convert data form accelerometer / gyro to fit within this range and maybe some kind of "deadzone" will be required.

I will show it on example - If You directly map axes reports from mouse and send them as axes of gamepad to game console, feeling isn't as playing with mouse on pc. Values needs to be recomputed on the go. Say You receive Axe alue "128" and send out "130", receive 129 and send out "132", receive "200" send out "200". This differs game by game so parameters recomputing this values need to be "changeable" and storable. Imagine something like sensitivity, deadzone, acceleration....

I am sorry of my english as it is not my origin language but hope this will help You.

I will also be happy to assist You with this project for impaired gamer.

27 Mar 2012

I love to recycle and reuse, Ceri. My last project was clock based on 7 segment display found in LG tape videorecorder. Also IR receiver. Nice one!!!

28 Mar 2012

little llumpu wrote:

Hello, I am too interested in this. Do You mean re-wire gamepad buttons to mbed Digital inputs, Sticks to Analog inputs and add accelerometer / gyro to controll "look" in games (right stick). It seems not to be so hard. If You use USB Joystick example here http://mbed.org/users/bricklife/programs/USBJoystick/ll8vnv You will have very good starting point.

the point is to avoid the pb of proprietary protocole by hacking the game pad

there is 2 pb

the sensor which must be a 3 axes motion control with absolute positionning. I haven't the expérience of the use of gyroscope or accélerometer so i ask how to do that (it must be a way this feature exist aready on 2axes for the control of camera in immersion remote controled plane)

the second pb is how to emulate a potentiometer to remplace the ones of the game pad

the all button will be hacked to other big button with classic wiring that not a pb nor will be to control them by the mbed (there is a lot of solution from reed relay to simple transistor )

little llumpu wrote:

Then mbed is enumerated by USB host as USB Joystick with 4 axes (two sticks), 12 buttons and DPAD. By modifiing Report descriptor we can get more/less of buttons, axes...

the pb is SONY use proprietary protocole for the communication and standard gamepad is not functionning on the PS3 so that why i want to hack the ps3 game pad

28 Mar 2012

I am 95% sure you don't need digital pot.

You can use DAC, and fix min - max values

Can you do a sketch of your connections,

So we are all pointing same direction

Ceri

28 Mar 2012

ceri clatworthy wrote:

I am 95% sure you don't need digital pot.

You can use DAC, and fix min - max values

Can you do a sketch of your connections,

So we are all pointing same direction

Ceri

the point is there is no available schematic of the game pad that's why I ask in the hope some body know how to do it

otherwise i must go the hard way to trace back the board

the more probable thing is they use potentiometer with a end to the ground to generate variable tension for a adc but we never know the perversity of the conceptor....

28 Mar 2012

Do you want to 'Modify' a standard controller, and use MBED to get data, Package it for above controller.

OR

Do you want to use MBED to get data, AND emulate a game controller ?

BTW I do not have any game machines, because I am realy rubbish @ games :>

Cheers

Ceri

28 Mar 2012

Hello,

I have PlayStation 3 game console. Fat model with 80gb HDD, not hacked with latest firmware and I can confirm that mbed loaded with joystick example is corectly recognized by PS3 as gamepad and works. I made gamepad program based on new USB mouse, keyboard.... examples from end of last year.

This do not use any hardware inputs and data sent are fake. I used this to check funcionality. But it is very easy to use it.

But there is small number of games like Gran Turismo 5 (I have and confirm that not work), Fallout 3 (not tested) and maybe Ace Combat Assault horizon (because in demo that didn't work). But this mean You can not control gameplay but still works in menus but when You load game save, game do not use values received from gamepad to controll game.

I can confirm that it works in my games like Call of Duty, Battlefield Bad Company 2, Infamous 2 and many others.

For now it does not have PS button but it's easy about editind report descriptor and adding button no. 13 because PS button is button no.13 in Dualshock 3. This is not problem, I made whole device and report descriptor same as Dualshock 3 has and PS3 still understand it in way - Hey this is gamepad - and was working but still without PS button. To get working PS button, there is need to send 8 bytes array after host request and receives HID report.

But I was not able to figure out how to send data to host - but I am sure it is pretty easy for anybody who is more experienced in C++.

When device is getting enumerated, host ask for device, configuration, interface, HID, String and report descriptors.

Those are arrays and are send to host when he requests them. And between Hid and String there is need to send our array to get PS button working.

It was discovered by somebody sniffing comunication between PS3 and Dualshock 3 gamepad.

Please can You post what PS3 model do You have and confirm if USB Joystick example works or not.

In afternoon I will edit my USB gamepad to be publicable and You can try this my too.

In USB Joystick Example are used analog inputs to read data from analog stick that can be found on many many gamepads.

PS3's Dualshock 3 gamepad is different because it do not use potentiometers for each axe with 3 pins but uses contactless Hall effect sensors with 4 pins each axe.

28 Mar 2012

As I understand You mean to connect mbed to those sticks inputs on gamepad PCB and let mbed controll data that are sent out of gamepad. So sticks will be desoldered and wired to mbed. Then You read data from accelerometer/gyro or somthing else and map them to right stick to allow "look" in games be controlled by head movement. In common gamepad it would be as connecting mbeds analog out ti potentiometer inputs on gamepad PCB but here are those Hall effect sensors...

So there is need for understanding what those sensors "produce" to be able to get mbed produced the same signals and send them to those sticks inputs on Dualshock 3 gamepad PCB.

So I still see as easier way to get mbed act as USB gamepad attached to PS3's USB port.

28 Mar 2012

Hi All, this is an interesting post. I'm not sure if you have seen these links, but they might help on the USB comms? http://www.circuitsathome.com/mcu/ps3-and-wiimote-game-controllers-on-the-arduino-host-shield-part-1 there are links to part 2 and 3.

above also has a link to: http://wiki.ps2dev.org/ps3:hardware:sixaxis

28 Mar 2012

Hello Kevin, I studied those docs before but they are meant for USB host for Dualshock Gamepad. So You connect gamepad to it and controll for example robot.

But what is important that USB host for Dualshock 3 gamepad sends array of bytes to get Dualshock send data. If this array is not send to DS3 gamepad, gamepad gets enumerated but does not send any data. Not sure but this array maybe selects second USB Interface on DS3?

Instead it seems it is paired with what I wrote about array that needs to be send from emulated ps3 gamepad to be able to use PS button.

So idea is that Dualshock 3 sends his array to tell host I am DS3 gamepad (VID and PID is also checked I think) then Host knows he must send his array to get DS3 to send data.

28 Mar 2012

little llumpu wrote:

As I understand You mean to connect mbed to those sticks inputs on gamepad PCB and let mbed controll data that are sent out of gamepad. So sticks will be desoldered and wired to mbed. Then You read data from accelerometer/gyro or somthing else and map them to right stick to allow "look" in games be controlled by head movement. In common gamepad it would be as connecting mbeds analog out ti potentiometer inputs on gamepad PCB but here are those Hall effect sensors...

So there is need for understanding what those sensors "produce" to be able to get mbed produced the same signals and send them to those sticks inputs on Dualshock 3 gamepad PCB.

So I still see as easier way to get mbed act as USB gamepad attached to PS3's USB port.

that was exactly the point, not try to re-discover warm water by asking other more seasoned people if they have already done something equivalent.

the pb I have to cope with is only the impossibility to use the two 2axes joystik, the left forward/back could be left so the press button on the 2 joystick but it is to much to have to control 2*2axes plus the press button with only 2 impaired thumb

so I guess i have to look at the opened game pad and go with the multimeter (i didn't know it was hall sensor joystick,

may be some less advanced (non wireles) ps3 gamepad use classic pot joystick.)

to émulate a complete gamepad you will need : 4 analogic input for the joysticks, 17 digital inputs for the switch the 2 mbed could do that.

but there is the pb of the 13 button and the word it send to be identified as a ps3 gamepad that's why i rather prefer to hack a fonctionning gamepad

more the hack could easily be use on the xbox gamepad or other box or pc

28 Mar 2012

pion jean françois wrote:

more the hack could easily be use on the xbox gamepad or other box or pc

and coud be used too for control the movement of electric wheel chair or a lot of device (for impaired or not impaired)

the first thing is to get the motion sensor working on 3 axes to get absolute position (not only acceleration ) from the reference position

I guess the robotics guy know how to do that ( in fact I hope !)

28 Mar 2012

FYI Here is a page I did on how to create a USB Joystick with mbed. http://mbed.org/users/wim/notebook/usb-joystick-device/ There are links to a library and example code on that page.

28 Mar 2012

Wim Huiskamp wrote:

FYI Here is a page I did on how to create a USB Joystick with mbed. http://mbed.org/users/wim/notebook/usb-joystick-device/ There are links to a library and example code on that page.

thank you, an another markpage

but it's not the point

first : the accelerometer/gyroscopic thing and how to get a clear positional motion of the head (accelerometer alone won't be enough when the player want to go on on a lateral movement with a side tilt of the head if you dont move 3 axes accelerometer could give the position but if you modify the tilt there is a parasite acceleration. with the gyroscope it is the contrary, there is a strong answer when you move but if you keep the head still with a tilt the gyroscope won't say anything and if you try to integrate the movement, there will be some shift from the zero position.)

may be with an algorithm who automatically recalibrate the zero when no movement ?

do you think there is an another way to get the absolute position of the head (I've thought about an ir cam an 2 ir diodes on the screen corner it is easy to make the calculation when you have the position of the spot on the screen, but how to get these positions .... and it won't be so universal will need a tv in front of the people no way to controle a wheel chair with only th head

is there some robotics guy who've already done that ? I can't be the first one with this idea, i'm not so an imaginative genius ;-)

thank you

29 Mar 2012

Measuring the orientation of an object is often done in the robotics world. You can find many links to hardware and software when you google for AHRS (attitude, heading reference systems). These systems use gyros and accellerometers to compensate each others weaknesses. Example http://mbed.org/users/BlazeX/libraries/AHRS/m5t0u3

More advanced systems also provide position data, look for IMU (inertial measurement units). Example http://mbed.org/users/Ductapemaster/libraries/IMU/m5h1bf

Measuring position and orientation is also possible with IR cameras and diodes as you say. You could look at the wiimote that has an integrated IR camera module which detects 4 IR sources and provides you x,y coordinates of these 4 sources. You can use the wiimote as is and use bluetooth to connect an mbed with the wiimote or you can take the wiimote apart and extract the sensor which uses an i2c interface. Schematics and code are available on the internet. Examples: http://johnnylee.net/projects/wii/ and http://letsmakerobots.com/node/7752

Another solution could be to use a microsoft kinect that is linked to your PC. The kinect also has an IR camera and provides 3D images that may be converted to motion and gestures. Libraries are available to interface the kinect with your PC applications.

29 Mar 2012

Have you considered a 3 axis compass?

http://www.robotshop.com/ca/sfe-micromag3-magnetometer.html

http://www.pnicorp.com/products/micromag-modules

Obviously you would need to set a zero reference position and calculate relative points from that.

31 Mar 2012

Thank you for the hints, just need the time to dig in the documentation

the pb of the hack of the gamepad will come later

thank you again

11 May 2012

Hi!

There are no reasons, other than going wireless, to use an actual ps3 controller for this project. I've made a revision of the joystick enabled usbhid -library that works perfectly with both PC and PS3. It has all the functions one might need, short of sixaxis motion sensing, including full analog buttons and triggers and a working home-button implementation.

Import libraryUSBHID

Joystick enabled version of USBHID -library. Has full Playstation 3 functionality including button pressures and a working home-button implementation, while maintaining full PC/MAC/linux -compatibility. basic operation of the lib: #include "mbed.h" #include "usbhid.h" USBJoystick joystick; int main() { while(1) { char dpad = 0xf; /*only the rightmost 4 bits matter*/ short button = 0xff; /*only the rightmost 13 bits matter*/ /*buttons are square, cross, circle, triangle, l1, r1, l2, r2, l3, r3, home.*/ char stick1x = 0; char stick1y = 0; char stick2x = 0; char stick2y = 0; joystick.joystick(dpad, buttons, stick1x, stick1y, stick2x, stick2y); wait_ms(5); } }

12 May 2012

Panu Kauppinen wrote:

Hi!

There are no reasons, other than going wireless, to use an actual ps3 controller for this project. I've made a revision of the joystick enabled usbhid -library that works perfectly with both PC and PS3. It has all the functions one might need, short of sixaxis motion sensing, including full analog buttons and triggers and a working home-button implementation.

Import libraryUSBHID

Joystick enabled version of USBHID -library. Has full Playstation 3 functionality including button pressures and a working home-button implementation, while maintaining full PC/MAC/linux -compatibility. basic operation of the lib: #include "mbed.h" #include "usbhid.h" USBJoystick joystick; int main() { while(1) { char dpad = 0xf; /*only the rightmost 4 bits matter*/ short button = 0xff; /*only the rightmost 13 bits matter*/ /*buttons are square, cross, circle, triangle, l1, r1, l2, r2, l3, r3, home.*/ char stick1x = 0; char stick1y = 0; char stick2x = 0; char stick2y = 0; joystick.joystick(dpad, buttons, stick1x, stick1y, stick2x, stick2y); wait_ms(5); } }

thank you a lot

i'm working on the motion sensor pb now but it is a relief to know the ps3 specific communication pb is already solved

thank you