More buttons ? -> Custom DS4 snap-on device

Titan Two general support. Questions, firmware update, feature request.

More buttons ? -> Custom DS4 snap-on device

Postby Scachi » Sun Jul 23, 2017 7:34 pm

Hi,

* Update : Added all files for printing, sourcecode and instructions to thingiverse

I always wanted some more buttons on the DS4 controller to use them to trigger special actions in scripts (combos/adjustments/..). Finding out about the teensy boards by another users post I got an idea how to do it.

Finally, here is a first fully working version of my very own snap-on device for the DS4 controller of the PS4.
It features a teensy 3.2 board with a 0.96" oled (i2c) display and 15 additional buttons,
3 around each analog-stick and 4 on the backside to be triggers by flexing/stretching the middle finger (I only use the index fingers for the front buttons L1/L2 R1/R2) and 5 around the oled display.

I've created this design in blender to test the my ideas and produce the needed file for the 3d printer.

I have printed most of the parts with petg and 50% infill (purple). The button caps are printed with pla and 50% infill (black), only the top rear buttons are petg at the moment because I was to lazy to change the material.
I would have used black petg for the buttons but I had none around.
Everything works at the moment, but I will have to use it for some time to be sure the design is stable enough.

ToDo:
- Adding bluetooth support when the T2 bluetooth module is available
- Output of variables/infos by scripts on the screen

Here is a short video with information and the added oled screen:

I can now easily switch between profiles (currently 4, can add a lot more) and edit them:
Changing to output a button as any controller button or key press without having to restart or connect it to a pc.
The profiles and configuration are stored on the teensy's permanent storage.

Here are some screenshots/photos:
Blender3d :
blender_01.png
blender_01.png (146.83 KiB) Viewed 6335 times

blender_02.png
blender_02.png (142.89 KiB) Viewed 6335 times


Photos of the attached device:
P1040313.JPG
P1040313.JPG (101.96 KiB) Viewed 6335 times

P1040314.JPG
P1040314.JPG (91.85 KiB) Viewed 6335 times

live01.JPG
live01.JPG (132.27 KiB) Viewed 6335 times


Here is the T2 code I have used to test if everything works and get recognized correctly be the Titan Two, I was almost shocked that this works like a charm. Meaning the Titan Two is more awesome than I already thought ;-)
Code: Select all
#pragma METAINFO("Snap On - Test", 1, 0, "Scachi")
 
#include <keyboard.gph>
 
#define KEYS_TO_MONITOR     15
 
const uint8 keys_to_monitor[KEYS_TO_MONITOR] = {
   KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
    KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
    KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
};
 
bool monitor_previous[KEYS_TO_MONITOR];
uint32 monitor_time_active[KEYS_TO_MONITOR];
uint32 monitor_time_release[KEYS_TO_MONITOR];
int k;
 
 
main {
     for(k = 0; k < KEYS_TO_MONITOR; ++k) {
      if(key_status(keys_to_monitor[k]) != monitor_previous[k]) {
            if(monitor_previous[k]) {
                 monitor_time_release[k] = system_time();
                printf("key event release : %d : KEY_%C",keys_to_monitor[k],keys_to_monitor[k]+61);
            } else {
                 monitor_time_active[k] = system_time();
                printf("key event active : %d : KEY_%C",keys_to_monitor[k],keys_to_monitor[k]+61);
            }
      }
    }
 
    btn_events();
 
    for(k = 0; k < KEYS_TO_MONITOR; ++k) {
        monitor_previous[k] = key_status(keys_to_monitor[k]);
    }
}
 
void btn_events() {
    uint8 i;
 
    for(i=BUTTON_1; i<=BUTTON_21; ++i) {
        if ( event_active(i) ) mprintf("btn event active : BUTTON_%d",i+1);
        if ( event_release(i) ) mprintf("btn event release : BUTTON_%d",i+1);
    }
}
 
 
uint8 key_idx(uint8 key) {
    for(k = 0; k < KEYS_TO_MONITOR; ++k) {
        if(keys_to_monitor[k] == key) {
            return(k);
        }
    }
    return(0);
}
 
#define key_is_active(k)        key_status(k)
 
#define key_is_release(k)       (!key_status(k))
 
uint32 key_time_active(uint8 key) {
    return(system_time() - monitor_time_active[key_idx(key)]);
}
 
uint32 key_time_release(uint8 key) {
    return(system_time() - monitor_time_release[key_idx(key)]);
}
 
bool key_event_active(uint8 key) {
    return(key_status(key) && !monitor_previous[key_idx(key)]);
}
 
bool key_event_release(uint8 key) {
    return(!key_status(key) && monitor_previous[key_idx(key)]);
}
 
bool key_check_active(uint8 key, uint32 ms) {
    return(key_status(key) && key_time_active(key) >= ms);
}
 
bool key_check_release(uint8 key, uint32 ms) {
    return(!key_status(key) && key_time_release(key) >= ms);
}
 
void mprintf(char *text,uint8 Btn) {
    static uint32 last = 0;
 
    if ( last < system_time() ) {
        printf(text,Btn);
        last = system_time() + 200;
    }
 
}
 
 
 
Attachments
_1_keyboard_joystick_display_011.zip
Teensy Arduino sourcecode of my device.
(11.57 KiB) Downloaded 291 times
Last edited by Scachi on Thu Dec 28, 2017 9:47 am, edited 6 times in total.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: More buttons ? -> Custom DS4 snap-on device

Postby bonefisher » Sun Jul 23, 2017 7:46 pm

Awesome work! :joia:
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: More buttons ? -> Custom DS4 snap-on device

Postby Prototype » Sun Jul 23, 2017 8:40 pm

Cool :joia: Great work! Something like that with a bluetooth module to connect to The Titan Two's bluetooth module as additional controller could be done? To be able to install or remove your device from the DS4 without wires.
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic! :smile0517:
User avatar
Prototype
Major General
Major General
 
Posts: 3250
Joined: Sun Dec 16, 2012 1:43 pm

Re: More buttons ? -> Custom DS4 snap-on device

Postby Scachi » Mon Jul 24, 2017 5:35 am

prototype wrote:Cool :joia: Great work! Something like that with a bluetooth module to connect to The Titan Two's bluetooth module as additional controller could be done? To be able to install or remove your device from the DS4 without wires.

The only wires to my addon controller is the additional micro usb cable to connect it to the T2 at them moment.
There are bluetooth boards available for the teensy or as aduino based standalone boards, so making my device wireless is possible, I just need to add a battery then.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: More buttons ? -> Custom DS4 snap-on device

Postby J2Kbr » Mon Jul 24, 2017 2:32 pm

Amazes me what we can do nowadays with 3D printers ... makes me want get one for me. :) Congrats, awesome work you did here.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: More buttons ? -> Custom DS4 snap-on device

Postby Scachi » Mon Jul 24, 2017 3:09 pm

J2Kbr wrote:Amazes me what we can do nowadays with 3D printers ... makes me want get one for me. :) Congrats, awesome work you did here.

Thank you very much.

I like to improve some things before sharing the files for 3d printing.
Especially adding the paddles (or buttons) to each side is something I like to finish first.
I already tried multiple time but couldn't get the buttons as good to reach or as good to work as I want to.
And I expect the thing to break each time I snap it on or off the controller, I'll have to test how long this will last before it breaks. But it is a tight (and a bit tricky) fit and doesn't snap off during gaming this way ;-)

I was puzzled about the low costs of a working (not high end) 3d printer. I ordered some prints from printing stores before and recognized if I am going to do more printing it is cheaper to get my own (had to assemble it myself).
I use the printer for building fpv racing drones and other RC model building, also.
The prizes dropped recently. A few years ago I was already interested but couldn't afford one for just for fun usage. Now I wouldn't miss this thing :-)
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: More buttons ? -> Custom DS4 snap-on device

Postby Scachi » Fri Aug 04, 2017 2:44 pm

I have updated the design a bit.
It height is now like it is in the blender3d design and I added an oled display to it.
Now I have to figure out what I can do with it. Nice would be on the fly button remapping on the teensy itself and showing the active button mapping on the display.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: More buttons ? -> Custom DS4 snap-on device

Postby J2Kbr » Fri Aug 11, 2017 12:53 pm

Very nice Scachi, if possible, please post more pictures of your progress!! :)
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: More buttons ? -> Custom DS4 snap-on device

Postby Scachi » Wed Aug 23, 2017 7:59 pm

Update:
Completed the teensy code to utilize the oled screen to easily remap buttons to button or key presses.
Added a short video with some details about it and the T2 code I used to test it.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: More buttons ? -> Custom DS4 snap-on device

Postby J2Kbr » Thu Aug 24, 2017 12:06 pm

Very impressive. :joia: :joia:

A Bluetooth connection with the Titan Two to fetch relevante info to display on the OLED display seems the best option. To power the eletronics of your adapter, not sure what would be the best option. But it would be nice avoid the needed of two usb cables, maybe an usb adapter just to get power from the cable connected on the controller.
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Next

Return to Titan Two Device

Who is online

Users browsing this forum: No registered users and 43 guests

cron