[WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Talk About Anything Playstation here
Post Reply
LeBrevinois
Posts: 14
Joined: Thu Mar 14, 2019 8:12 am

[WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by LeBrevinois »

Hi,

I'm building a analog handbrake for sim racing on PS4.
Source AMSTUDIO :

So far I've got
- Rpi Zero H
- Compatible Bluetooth dongle (CSR8510 chipset Orico BTA-403)
- Installed gimx (6.11 AMRv6) on Rpi (Linux 9 stretch , Debian 9.4)
- Usb OTG hub (Markerspot)
- Paired dongle with PS4 (using gimx-ps4-helper.sh script as mentioned here : http://gimx.fr/wiki/index.php?title=Command_line) ==> linkkeys created

I've used my PRO MICRO card as a Teensy to get it paired by flashing it with EMUPS4PAIRING atmega32u4.hex file.

Then I reflashed it (Ive got only one PRO MICRO card) to an analog potentiometer (linear) which is know recognized as Throttle axis on Windows as the AMSTUDIO youtube video file described it.

When I plug the controller on the RPI it is detected as an usb device and using "jstest" I can see the axis level moving as I move the linear potentiometer.

Question 1 : once the "linkkeys" are created and as long as I do not change the DS4 pairing (by repaiting with e PS4) I do not have to modify them ? I mean as I flashed my PRO MICRO to an Throttle Axis so I can't re do it each time I wanna play...
[MAJ] : it seems the case as I've got it working

Question 2 : What is the right order to start things up ?
What I do is : Start PS4 > Start Rpi with bluetooth dongle > launch gimx command line > presse the PS buton on the DS4 > DS4 blink then white light stays ON > RPI display message as "can't connect to PSM"
Any tips ?
[MAJ] : I've redone the gimx-ps4-helper.sh and it seems ok now !
Last edited by LeBrevinois on Sun Apr 07, 2019 8:12 pm, edited 2 times in total.
LeBrevinois
Posts: 14
Joined: Thu Mar 14, 2019 8:12 am

Re: [WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by LeBrevinois »

By the way here is my jstest /dev/input/js0 output showing Buton 0 (which I added on PIN2) and Axis 6 is responding correctly (pin A0)

Code: Select all

Axes:  0:     0  1:     0  2:     0  3:-32767  4:-32767  5:-32767  6:  9120  7:-32767  8:     0  9:     0 10:     0 11:     0 
Buttons:  0:on   1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off 13:off 14:off 15:off 16:off 17:off 18:off 19:off 20:off 21:
LeBrevinois
Posts: 14
Joined: Thu Mar 14, 2019 8:12 am

Re: [WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by LeBrevinois »

Ok I got it running, as soon as I press the DS4 PS button the PS4 sees it and ask me to validate the users using the device
Unfortunatly I can't find out how to validate (normally with X 'cross' button)

So far I've tried to map my ProMicro Arduino Button 0 (pin2) with the following :

Code: Select all

<button id="cross" label="PS">
	<device type="joystick" id="0" name="Arduino Micro"/>
	<event type="button" id="0"/>
</button>
or

Code: Select all

<button id="abs_axis_9" label="PS">
	<device type="joystick" id="0" name="Arduino Micro"/>
	<event type="button" id="0"/>
</button>
Any ideas ?
Is it possible to get the DS4 that I used to get BT passtrought to get the X cross buton to work ?
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: [WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by Matlo »

Editing the configuration with a text editor is not recommended. Use gimx-config instead.
GIMX creator
LeBrevinois
Posts: 14
Joined: Thu Mar 14, 2019 8:12 am

Re: [WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by LeBrevinois »

Matlo wrote: Fri Apr 12, 2019 5:52 am Editing the configuration with a text editor is not recommended. Use gimx-config instead.
Hi Matlo thanks for your reply.

I'm on Rpi and in command line only...
I dont't know if I can lauch gimx-config on Rpi...
(EDIT) ... which is on raspian-stretch so no GUI... And if I do it on Windows gimx-config the ID are not the same : Axis is 7 but un Rpi it's 6... (EDIT)

BTW as mentionned in my previous thread I found out that the name of the device was not the right one :

Code: Select all

pi@raspberrypi:~ $ jstest --select /dev/input/js0
Driver version is 2.1.0.
Joystick (Arduino LLC Arduino Micro) has 12 axes (X, Y, Z, Rx, Ry, Rz, Throttle, Rudder, Hat0X, Hat0Y, Hat1X, Hat1Y)
(...)
Event: type 130, time 5688710, number 6, value -32767
==> "Arduino LLC Arduino Micro" is the complete right name (and not just "Arduino Micro") and my axis is the ID 6.

So far now I've got it working but it seems my mapping is not right.

The buttons are recognized but my axis 6 (which goes from -32767 to 32767) and mapped to R2 is not.

Here is my promicro.xml config file :

Code: Select all

<?xml version="1.0" encoding="UTF-8"?> 
<root>
  <controller id="1" dpi="0" type="DS4">
    <configuration id="1">
      <trigger type="" id="" name="" button_id="" switch_back="no" delay="0"/>
      <mouse_options_list/>
      <intensity_list/>
      <button_map>
        <button id="abs_axis_2" label="PS">
          <device type="joystick" id="0" name="Arduino LLC Arduino Micro"/>
          <event type="button" id="1"/>
        </button>
        <button id="abs_axis_9" label="X">
          <device type="joystick" id="0" name="Arduino LLC Arduino Micro"/>
          <event type="button" id="0"/>
        </button>
        <button id="abs_axis_4" label="Right">
          <device type="joystick" id="0" name="Arduino LLC Arduino Micro"/>
          <event type="button" id="2"/>
        </button>
        <button id="abs_axis_6" label="Left">
          <device type="joystick" id="0" name="Arduino LLC Arduino Micro"/>
          <event type="button" id="3"/>
        </button>
      </button_map>
      <axis_map>
        <axis id="rel_axis_14" label="r2">
          <device type="joystick" id="0" name="Arduino LLC Arduino Micro"/>
          <event type="axis" id="6" dead_zone="0" multiplier="0.008" exponent="1.00" shape="" />
        </axis>
      </axis_map>
      <joystick_corrections_list>
        <correction low_value="32767" low_coef="-8191" high_value="0" high_coef="0">
          <device type="joystick" id="0" name="Arduino LLC Arduino Micro"/>
          <event type="axis" id="6"/>
        </correction>
      </joystick_corrections_list>
    </configuration>
  </controller>
</root>
And I've updated to Gimx 7.12 and here is the log :

Code: Select all

pi@raspberrypi:~ $ sudo gimx -t DS4 -c promicro.xml -h 0 -b FC:01:7C:CF:92:CA
controller #1: option -t with value `DS4'
global option -c with value `promicro.xml'
controller #1: option -h with value `0'
controller #1: option -b with value `FC:01:7C:CF:92:CA'
now reading arguments for controller #2
using default refresh period: 10.00ms
Warning: can't open macro directory /root//.gimx//macros/
listening on psm: 0x0001
listening on psm: 0x0011
listening on psm: 0x0013
1555437965.603133 timer fired 2 times...
1555437971.096729 timer fired 2 times...
Any ideas ?
Cheers and good work !
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: [WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by Matlo »

At this step you are supposed to press the PS button on the Dualshock 4, that should have previously been paired with the BT module/dongle.
GIMX creator
LeBrevinois
Posts: 14
Joined: Thu Mar 14, 2019 8:12 am

Re: [WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by LeBrevinois »

Matlo wrote: Thu Apr 18, 2019 8:02 pm At this step you are supposed to press the PS button on the Dualshock 4, that should have previously been paired with the BT module/dongle.
Yeap it does work when I press PS on the DS4, my problem is the axis which I set to R2 is not recognized (but butons are OK).
Maybe something about the multiplier / exponent or the correction (low_value, low_coef, high_value and high_coef) ?
What are the values expected for R2 button ? 0 to 255 ?

Cheers
Fred
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: [WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by Matlo »

  • rest = 32767, full = -32767: low_value = 32767, low_coef = -8192, high_value = 0, high_coef = 0
  • rest = -32767, full = 32767: low_value = -32767, low_coef = 0, high_value = -32767, high_coef = 8192
  • rest = 32767 full = 0: low_value = 32767, low_coef = -16384, high_value = 0, high_coef = 0
  • rest = -32767 full = 0: low_value = -32767, low_coef = 0, high_value = -32767, high_coef = 16384
  • rest = 0 full = 32767: no correction needed
  • rest = 0 full = -32767: set the sensitivity to -0.008 instead of 0.008
GIMX creator
LeBrevinois
Posts: 14
Joined: Thu Mar 14, 2019 8:12 am

Re: [WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by LeBrevinois »

I'm bit confused to be honnest...
Matlo wrote: Fri Apr 19, 2019 6:35 am
  • rest = 32767, full = -32767: low_value = 32767, low_coef = -8192, high_value = 0, high_coef = 0
  • rest = -32767, full = 32767: low_value = -32767, low_coef = 0, high_value = -32767, high_coef = 8192
  • rest = 32767 full = 0: low_value = 32767, low_coef = -16384, high_value = 0, high_coef = 0
  • rest = -32767 full = 0: low_value = -32767, low_coef = 0, high_value = -32767, high_coef = 16384
  • rest = 0 full = 32767: no correction needed
  • rest = 0 full = -32767: set the sensitivity to -0.008 instead of 0.008
So as my range stands from -32676 to 32767 I have to set this settings :
>> low_value = -32767, low_coef = 0, high_value = -32767, high_coef = 8192

Fred
LeBrevinois
Posts: 14
Joined: Thu Mar 14, 2019 8:12 am

Re: [WIP : DIY PS4 Handbrake] Rpi Zero H + Bluetooth + Pro Micro

Post by LeBrevinois »

Yeap it worked !

I did some test using the --status inline command option and it does exactly as planned !
Thank you for your feed back !

Here is the focus on the config XML file :

Code: Select all

       <axis_map>
        <axis id="abs_axis_14" label="throttle">
          <device type="joystick" id="0" name="Arduino LLC Arduino Micro"/>
          <event type="axis" id="6" dead_zone="0" multiplier="0.008" exponent="1.0" shape=""/>
        </axis>
      </axis_map>
      <joystick_corrections_list>
        <correction low_value="-32767" low_coef="0" high_value="-32767" high_coef="8192">
          <device type="joystick" id="0" name="Arduino LLC Arduino Micro"/>
          <event type="axis" id="6"/>
        </correction>
      </joystick_corrections_list>
An PS4 screenshot from Gran Turismo Sport with smoking tires ! :
Image

An WIP hardware setting :
Image

Next step : buy an Hydraulic Handbrake from amazon and fit the linear pot inside !
Image

This is going to be great !
Happy Gimx user :)
Post Reply