Author Topic: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)  (Read 104846 times)

0 Members and 2 Guests are viewing this topic.

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #150 on: Fri, 20 November 2015, 00:30:38 »
yeah thanks a lot for offering to help with the code guys.  that's my weakest area here.

at this point, i'm ready to lay all the parts uninstalled from the handset out on a table and wire it all up with a sketch that works.  and then i'm ready to slap it all together for some barely held together test runs :cool:

did some testing today with the handset.  nothing wired, just testing hand mechanics.  i don't have the analog stick or the 3 top buttons from my original design stuck on yet, but i've got all 8 leg keys stuck in place and have finally gotten all the angles right.

So, I was able to run through a bunch of key pressing tests. Good news, the device seems to be effective ^-^

I would say that if someone is young and doesn't have any hand problems, they could just buy an orbweaver and be fine. This device probably doesn't improve on game control at all.  in fact, i'm not sure it could even realistically equal it.  finger dancing is hard to beat. But from what I can see, I really think this device will cause less long-term trauma.

It also appears to allow for some pretty dexterous key pressing and combos, dextrous enough to play anyway.  though, the combos that can be performed fluidly are limited, call them grade 1 combos. There are numerous other possible combos that can be performed with minor effort, something like a grade 2 combo.

Luckily for me, the device allows for enough grade 1 combos to cover the necessary ones in league.

There are so many other important commands in league however. From what I have tested today, it seems this device will allow for a total of around 34 reasonably comfortable commands. It's capable of more, however they require hand movement combinations that the hand just doesn't want to do easily.  34 is definitely enough, so things are looking good :thumb:

Here's some more news, when getting down to business with this thing and testing the mechanics, I have found that it can't be used just held in the air. I was annoyed before about how the outside leg was too long and planned to shorten it. But I have found that it needs to be rested on your leg.  It's not because the body has some flex that allows the outside leg to wiggle in and out a little bit. That actually annoyed me a lot, and I was considering cutting the whole thing apart again and getting much deeper anchor. But I found that flex isn't a problem. But there is a problem with rotation.

The hand rest from my original design was for the purpose of preventing the handset from moving out of the palm when hitting outside keys. But I did some testing, and I'm just not convinced that any kind of hand rest that wraps around the back of the hand will effectively prevent this. And it's pretty pronounced when it happens. The inside leg gets ever so slightly pulled out of position when hitting the outside keys without anchoring the outside leg. Even though the inside leg only gets moved and rotated a tiny bit, because of leverage, there's quite a bit of movement in the outside leg. And it creates a very awkward, loose, undesirable tactile feedback feeling.

But, it's not a problem at all. With the way the outside leg ended up getting cut too long, it turns out to be the perfect length to have butted downward against your thigh while your hand sits on your leg. The pressure isn't uncomfortable at all, and is just enough to prevent the device from moving. With it resting on my lap like that, I was able to hit all the keys with no problem, rapid firing, key combos-it all works really well like that :thumb:




Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #151 on: Sat, 21 November 2015, 10:39:46 »
i've planned out the wireup today. it will result in a very large cable between the handset and the project box.  Based on the current design, there will be 24gauge wires with a total count of 26 coming from the handset.This could be a little bit unwieldy, but I can't think of any alternative way that would be easy and suitable.

Assembling the device like most commercial products which have the board in close proximity to switches would require that I somehow affix the Leonardo and proto-Shield to the handset itself, and I'm just not liking that idea.

Based on what I can guess as an approximation, the cable that will be coming from the handset will be three times the size of Cat5e.

It doesn't really matter. As long as the device works well and isn't too outrageous looking, I'll be happy ;D

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #152 on: Sat, 21 November 2015, 11:00:19 »
You need one wire that connects to each switch plus one that connects to all of them, and then four for the analog - I make that 20 wires.  What are the other six for?  Actually are your switches wired to ground?  If so they can share that wire with the analog...

Your other option is to buy an Arduino Micro which is the same but much smaller, then you'd need to solder the wires directly to it's pins.  If you'd asked before ordering the Leonardo that's what anyone here would have told you to do but you were too keen :))
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #153 on: Mon, 23 November 2015, 10:56:57 »
Yeah, each switch connects to a pin 1-13 and ground.  Total wire account is based on 11 buttons and analog stick with 4 pinouts.

I may have gotten the wire account wrong by a little bit. Plus, I realize that I can couple together the grounds for the wires at the handset with solder and heat shrink tubing and then just have one cable for all of the grounds going to the board.  Not sure a 24gauge wire should carry the ground connection for all 11 buttons and the analog stick. I'll probably used to ground wires to divide it up.

yeah, maybe i should look closer at the Micro.  could make for some interesting design options due to its small size :cool:


Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #154 on: Thu, 26 November 2015, 00:24:12 »
Got a question. I see there are 0-5 analog input pins on board. Does that mean I can have a total of three analog sticks in theory?

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #155 on: Fri, 27 November 2015, 17:46:51 »
Just some minor work this evening. I decided to go with electrical tape to house the analog mod to conserve space.
118495-0
118497-1

I've sent a message to Finland asking for another mod. Hopefully he can find the time to do another one, but maybe not.

I've discovered that a second analog stick next to the one for camera control would be vastly superior for additional commands instead of the three cherry switches I planned to affix to the top.

Analog sticks offer 4 available commands instead of three cherry switches. And an analog stick takes up probably 10% of the space :cool:

Oh, and in case anybody is wondering, no need to be concerned about using analog sticks for digital commands.

using xpadder, or probably by using some kind of code in the Arduino sketch, the analog sticks can be configured to only activate a command when they reach a certain percentage of travel. In other words, xpadder allows you to configure the nullzone, or dead zone.  I found in the past that doing so resolves any issues with inadvertent commands due to imperfect movement UDL or R with an analog stick :thumb:


Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #156 on: Sat, 28 November 2015, 10:49:33 »
 i just realized that i can go with the easier and less expensive psp analog stick for the 2nd stick of the controller.

since the 2nd stick won't be used continuous throughout the game like the 1st stick for camera control, the 2nd stick doesn't need to be the absolute best available.

Offline W11cE

  • Posts: 23
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #157 on: Sat, 28 November 2015, 13:48:37 »
If you want to go with a smaller microcontroller, i recommend teensy 3.2 or LC. More everything in a smaller package and cheaper, than in micro.

http://pjrc.com/teensy/teensy31.html
http://pjrc.com/teensy/teensyLC.html

Those are what I use in all of my mods.

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #158 on: Sat, 28 November 2015, 14:10:49 »
is a teensy recognized out-of-the-box by pc as game controller and/or keyboard-mouse like the leonardo?

Offline W11cE

  • Posts: 23
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #159 on: Sat, 28 November 2015, 14:20:11 »
Yes, and it is done much better. It has native mouse + kb + joystick mode. No need to install anything extra except teensyduino.

Here is basic joystick usage: http://pjrc.com/teensy/td_joystick.html
That is a little outdated, but main features are there.

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #160 on: Mon, 30 November 2015, 11:40:52 »
1st step of cabling work is done.  not fun.  have ordered braided cable sleeve and heat shrink tube.

118694-0
118696-1

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #161 on: Mon, 30 November 2015, 15:26:58 »
Yes, and it is done much better. It has native mouse + kb + joystick mode. No need to install anything extra except teensyduino.

Here is basic joystick usage: http://pjrc.com/teensy/td_joystick.html
That is a little outdated, but main features are there.

thanks for letting me know.  is that your webstore at those links to teensy? 

teensy might be useful in future revisions.  for now, i'm going with what i know works to get myself back into league of legends as fast as possible.  thereafter, who knows what i might be able to do with this device :cool:

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #162 on: Mon, 30 November 2015, 23:34:25 »
can teensy have 2 analog sticks?

can the same sketch be used in leonardo and teensy without changes?

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #163 on: Mon, 30 November 2015, 23:48:44 »
If you want to go with a smaller microcontroller, i recommend teensy 3.2 or LC. More everything in a smaller package and cheaper, than in micro.

http://pjrc.com/teensy/teensy31.html
http://pjrc.com/teensy/teensyLC.html

Those are what I use in all of my mods.

if i get a teensy, is it easier for you and/or other guys here to make a sketch for 8 buttons and 2 analog sticks?

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #164 on: Tue, 01 December 2015, 10:56:11 »
Hey guys, I decided I want to move in the direction of teensy implementation if possible. I at least want to do some testing to see if I can achieve the same results as the Leonardo.

If the teensy will work for this project, I can build the teensy board into the housing of the handset probably positioned on the outside panel of the outside leg of keys. I'm pretty sure this will make the project construction easier because I won't have to deal with a long run of cables that I've recently fashioned which runs between handset and the project box from my original design. Dealing with those cables involves braided wire sleeve, heat shrink tubing, and some manual labor that isn't very elegant or fun.  with a teensy, i could eliminate the project box altogether :cool:

I'd like to order a teensy to run it through the same tests that I did with the Leonardo, but at a minimum I need to get an answer to this question:

Can a teensy have two analog sticks and eight buttons?

If possible, can somebody try to get back to me today or sometime soon on just this question?


Offline GuilleAcoustic

  • Posts: 77
  • Location: France
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #165 on: Tue, 01 December 2015, 12:41:51 »
Teensy can manage up to 6 axis and 16 buttons (32 for the Teensy++)... https://www.pjrc.com/teensy/td_joystick.html

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #166 on: Tue, 01 December 2015, 12:50:35 »
That is a lot of wires, do you not have a sister/gf to braid them prettily for you? :))  Going for a smaller controller sounds a good idea.

The Teensy 2.0 and Arduino Leonardo/Micro use the same chip, the main differences are the bootloader and size (Teensy < Micro < Leonardo) while the Teensy LC is completely different but claims 13 analog inputs (6 1/2 sticks) which would leave another 14 I/O pins for switches - that's plenty :)
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #167 on: Tue, 01 December 2015, 16:58:01 »
got it thanks for answering guys ;D

i'll go ahead and get this one.  it's the same one finland linked in a post above

http://www.amazon.com/gp/product/B015M3K5NG/ref=s9_hps_bw_g328_i1

and yes, that mess of cables is definitely motivating this design change :-X

Offline GuilleAcoustic

  • Posts: 77
  • Location: France
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #168 on: Thu, 03 December 2015, 03:47:14 »
Small controller are the way to go. It is impressive how much space the cables can eat away. Braiding is a good way to organize them. I did that on my trackball conversion project (used PCB holes to attache them too).


Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #169 on: Thu, 03 December 2015, 17:06:36 »
right on, that's some good wiring there.

that's where i live now, wiring world.  did a 50% teardown and wired up one side.  you're right, wires eat up an unexpected amount of space.

118986-0
118988-1

 i want to redo this piece of work by joining all the black wires for ground together near to their origin and then just have one black wire running through the top.
« Last Edit: Thu, 03 December 2015, 17:11:03 by Camineet »

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #170 on: Thu, 03 December 2015, 17:17:12 »
got psp 2000 analog stick.  what a piece of sh*t compared to the vita stick :-X

i even did the research to find out the psp 2000 stick is less of a piece of sh*t than the psp 1000 because the 2000 isn't as stiff.  but still, it's stiff.

anyway, it's fine for now.


same as before, does someone happen to know what the pinouts are for on this stick(1-4)?  need to know the power, ground, x and y.  i scoured the internet and couldn't find any mention of the pinouts.
118991-0

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #171 on: Thu, 03 December 2015, 22:22:15 »


same as before, does someone happen to know what the pinouts are for on this stick(1-4)?  need to know the power, ground, x and y.  i scoured the internet and couldn't find any mention of the pinouts.


took like an hour to find the answer

http://forums.modretro.com/viewtopic.php?f=36&t=11641

the psp 2000 pinout is different from the 1000

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #172 on: Thu, 03 December 2015, 23:04:17 »
works :thumb:
119054-0

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #173 on: Fri, 04 December 2015, 02:51:55 »
Nice, looks like the hardware is nearly done - you should be back gaming by new year :)
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline GuilleAcoustic

  • Posts: 77
  • Location: France
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #174 on: Fri, 04 December 2015, 03:49:55 »
I appreciate this kind of project as it is a it the opportunity to play to people with a single hand (or single usable hand).

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #175 on: Fri, 04 December 2015, 07:52:49 »
Nice, looks like the hardware is nearly done - you should be back gaming by new year :)

yeah i think you're right.  the end is coming together a lot faster than the early stages ;D

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #176 on: Fri, 04 December 2015, 08:00:10 »
I appreciate this kind of project as it is a it the opportunity to play to people with a single hand (or single usable hand).

right, in my case the latter as i have got multiple RSI in lefty which is why this controller is for right hand.  lefty can't even mouse, and i'm using a Huion 420 pen tablet for mousing. 

if someone only has one hand, this controller could have a mouse integrated into the bottom and the user could slide it around on the desk in a way similar to those vertical oriented mouses.


Offline W11cE

  • Posts: 23
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #177 on: Sat, 05 December 2015, 07:05:47 »
The main differences between leonardo and teensy joystick code are a little different words used and analog stick range. On leonardo its from -127 to 128 and on teensy its from 0 to 1023.
Both are simple to change so no problems there.

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #178 on: Sat, 05 December 2015, 13:42:24 »
The main differences between leonardo and teensy joystick code are a little different words used and analog stick range. On leonardo its from -127 to 128 and on teensy its from 0 to 1023.
Both are simple to change so no problems there.

ok good news ;D

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #179 on: Sat, 05 December 2015, 13:58:03 »
lots of work the past few days.  probably 5 hours or so.  the progress isn't much because i had to do a lot of trial and error.

One cherry switch even died.

Rest in peace switch. Your sacrifice will be remembered.

Shouldn't underestimate the amount of work that goes into wiring. I had to do many redos that required teardown's until I got the wiring layout that I think will be optimal.

The handset has gotten really ugly in the process, but that can be handled later.

Also, before I really put in some work in on wire management, the thing looked like some kind of alien marine invertebrate life-form with some super nasty electric nerve poison :-X  No pics of that, because they would cause nightmares :))

Here is the first leg switches' grounds coupled together with one wire extending across the handset where it will be joined with another ground coupling of the analog sticks.  that coupling will finally go to a teensy ground pin.
119161-0

Here is the outside leg switches' grounds coupled together with one wire which will go to a teensy ground pin.
119163-1

Here is some rotary tool shaping work I did to get a level surface on which the second and possibly third analog sticks will go.
119165-2
119167-3
119169-4
« Last Edit: Sat, 05 December 2015, 14:01:37 by Camineet »

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #180 on: Sat, 05 December 2015, 14:02:43 »
have started pestering finland guy for ps vita mods again.  psp stick is just so laughably inferior :rolleyes:

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #181 on: Sun, 06 December 2015, 11:27:38 »
have just now completed wireup of completed v1 device.  all connections are verified working via testing /w leonardo board.

cosmetics are not a consideration at all yet.  i've just been tearing chunks of clay from source and pasting them onto the device to get things nailed down with no smoothing or other beautification work done at all. 

here you can see
  • a ground routing on top (black)
    a ground routing on the bottom (black)
    power for analog sticks routing on top (red)
    X Y connections from each analog stick (yellow)
    8 switch connections (red)

all connections are functional and are ready to be trimmed and stripped for appropriate distancing adjustments needed to solder to teensy. this is the backside of the outside leg in 1st pic

119286-0

view from back of the device
119288-1

view from front of the device

119290-2

an action shot to show normal use /w thumb on primary analog (camera control in league along with pings via alt-keymap).
119292-3

an action shot of thumb using 2nd analog stick (summoner spells and other such commands).
119294-4

an action shot of thumb in position where 3rd analog stick will be in v2 of the device (hoping for more ps vita stick mods from finland).  this stick will be for less frequently used commands because we don't want too many commands used in a way such that thumb is brought very far from neutral/at-rest position so we can avoid RSIs.

119296-5

teensy arrives wednesday.  any chance someone can put together the all-important sketch sometime soon?  i would of course be grateful :D

sketch needed is for
8 switches
2 analog sticks
1 analog stick as a digital input (activation upon stick moved 25% from nullzone)

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #182 on: Sun, 06 December 2015, 15:28:02 »
I've made progress, but what do you want the second analog to be controlling?  I can only see X Y and Z axis, plus X Y and Z rotation axis.

Do both the other analogs need to be digitized?
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline sinusoid

  • Posts: 160
  • fd > ESC
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #183 on: Sun, 06 December 2015, 15:51:24 »
Do you find the buttons comfortable to press?

I always had this issue with such handheld designs, that because the fingers essentially rested on the switches all the time, there were problems with grabbing it firmly, and it tended to change position inside of my hand with use. Had to be adjusted often as a result.

Always tried to get such designs strapped to the hand because of that.

('such designs' were mostly keyers in my case, I did a few prototypes).

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #184 on: Sun, 06 December 2015, 16:03:39 »
No arduino here but I think this should work, I've digitised the analogs on pins 2-5 leaving 0 and 1 as the real analog as before.

Whether it's laggy remains to be seen...

Code: [Select]
#define STICK_X 0
#define STICK_Y 1
#define OVERVAL 0

int Xstick;
int Ystick;
int Temp;
int myPins[] = {0,1,2,3,4,5,6,7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup() {
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
    pinMode(myPins[i], INPUT_PULLUP);
  }
 
  Joystick.begin(false);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
 
   buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
 
  if(buttonState[i] != oState[i]) { //check against previous button state, if changed do something
    if(buttonState[i] == LOW) { //button has been pressed
      Joystick.pressButton(i); //press corresponding "joystick" button
    }
    else { //button has been released
      Joystick.releaseButton(i); //release corresponding "joystick" button
    }
  oState[i] = buttonState[i]; //save state to compare next time
  }

  Temp = analogRead(2)
  if (Temp < -30) {
    if buttonState[8] = 0{
      buttonState[8] = 1
    }
  else
    if buttonState[8] = 1{
      buttonState[8] = 0
    }
  }

  if (Temp > 30) {
    if buttonState[9] = 0{
      buttonState[9] = 1
    }
  else
    if buttonState[9] = 1{
      buttonState[9] = 0
    }
  }

  Temp = analogRead(3)
  if (Temp < -30) {
    if buttonState[10] = 0{
      buttonState[10] = 1
    }
  else
    if buttonState[10] = 1{
      buttonState[10] = 0
    }
  }

  if (Temp > 30) {
    if buttonState[11] = 0{
      buttonState[11] = 1
    }
  else
    if buttonState[11] = 1{
      buttonState[11] = 0
    }
  }
 
  Temp = analogRead(4)
  if (Temp < -30) {
    if buttonState[12] = 0{
      buttonState[12] = 1
    }
  else
    if buttonState[12] = 1{
      buttonState[12] = 0
    }
  }

  if (Temp > 30) {
    if buttonState[13] = 0{
      buttonState[13] = 1
    }
  else
    if buttonState[13] = 1{
      buttonState[13] = 0
    }
  }
 
  Temp = analogRead(4)
  if (Temp < -30) {
    if buttonState[14] = 0{
      buttonState[14] = 1
    }
  else
    if buttonState[14] = 1{
      buttonState[14] = 0
    }
  }

  if (Temp > 30) {
    if buttonState[15] = 0{
      buttonState[15] = 1
    }
  else
    if buttonState[15] = 1{
      buttonState[15] = 0
    }
  }
 
Joystick.sendState()
}
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #185 on: Sun, 06 December 2015, 16:19:11 »
I've made progress, but what do you want the second analog to be controlling?  I can only see X Y and Z axis, plus X Y and Z rotation axis.

Do both the other analogs need to be digitized?

i'm not completely sure i understand your question, but i think i got it. 

this build only has 2 analogs, but i'm hoping to have 3 in the end.

1st two analogs should just be programmed as analog.  X Axis/Y Axis  for one and for the other one...

probably Z Axis and X Rotation.  that's my best guess as to what xpadder will see as a "2nd analog stick" rather than an analog trigger. 

I tried to answer this question by connecting my x360 controller to see what shows up as present in this kind of screenshot, but the controller won't connect to my pc right now for unknown reason.

119305-0

3rd stick is the one that needs to be digital because xpadder only sees maximum 2 analog sticks. 

let me know if i didn't answer what you're looking for

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #186 on: Sun, 06 December 2015, 16:20:52 »
No arduino here but I think this should work, I've digitised the analogs on pins 2-5 leaving 0 and 1 as the real analog as before.

Whether it's laggy remains to be seen...



great thank you much i'll give it a try  :thumb:

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #187 on: Sun, 06 December 2015, 16:27:39 »
Do you find the buttons comfortable to press?

I always had this issue with such handheld designs, that because the fingers essentially rested on the switches all the time, there were problems with grabbing it firmly, and it tended to change position inside of my hand with use. Had to be adjusted often as a result.

Always tried to get such designs strapped to the hand because of that.

('such designs' were mostly keyers in my case, I did a few prototypes).

extremely comfortable.  goal is to make it so comfortable i can't feel anything there.  probably achieved some percentage of that.  pulling keys is more comfortable than depressing them with extended finger - no doubt from my keypressing tests.

the device wiggles a little bit in use.  with the weight of the clay and friction of it resting on lap, the wiggle doesn't appear to affect usability.  but, a base or the handrest i once thought of, like your straps may be helpful.  straps i will avoid rigorously though 'cause i don't want to be locked in like that.

while it wiggles, i'm not seeing an out-of-position problem.  it can be dislodged when used exaggeratedly, but not otherwise as i can see in tests.

only true game testing will tell about true usability.  but from what i can see, it will work very well.

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #188 on: Sun, 06 December 2015, 17:34:25 »
Made a short video showing a range of actions from what's probably normal gaming intensity all the way up to button mashing.

feature=youtu.be

The device seems to work well enough. It would be nice to have a base which would completely eliminate any wiggling. But any additional physical appendages are a lot of work. Before I set about doing so much work to eliminate the wiggling which appears to be a non-issue, I plan to do some real gaming tests with the hope that no further major design work is necessary ;D

Offline trenzafeeds

  • * Exquisite Elder
  • Posts: 1352
  • Location: vt
  • **** off
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #189 on: Sun, 06 December 2015, 18:05:22 »
This is very cool, really nice work so far. I love to see people using the keyboard-building knowledge from the community to build non-keyboard things, awesome project.
demik will never leave.

Unless he gets banned.

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #190 on: Sun, 06 December 2015, 18:10:04 »

('such designs' were mostly keyers in my case, I did a few prototypes).

forgot to ask, what's a keyer?

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #191 on: Sun, 06 December 2015, 18:15:58 »
This is very cool, really nice work so far. I love to see people using the keyboard-building knowledge from the community to build non-keyboard things, awesome project.

glad you like it. i'm certainly grateful for this community.  what surprises me is how this community's work differs so much from mass consumption commercial products.  maybe that won't be such a difference in a few more years when more people realize how much time they spend at pc and therefore how important the quality of tools are. 

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #192 on: Sun, 06 December 2015, 22:51:06 »
No arduino here but I think this should work, I've digitised the analogs on pins 2-5 leaving 0 and 1 as the real analog as before.

Whether it's laggy remains to be seen...


Unfortunately, this doesn't compile in Arduino IDE

This is the error message I got

Code: [Select]
Arduino: 1.6.5 (Windows 7), Board: "Arduino Leonardo"

sketch_dec06a.ino: In function 'void loop()':
sketch_dec06a:47: error: expected ';' before 'if'
sketch_dec06a:131: error: expected '}' at end of input
sketch_dec06a:131: error: expected '}' at end of input
expected ';' before 'if'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Maybe it only works on the teensy after I install teensyduino?

Offline trenzafeeds

  • * Exquisite Elder
  • Posts: 1352
  • Location: vt
  • **** off
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #193 on: Mon, 07 December 2015, 00:54:05 »
No arduino here but I think this should work, I've digitised the analogs on pins 2-5 leaving 0 and 1 as the real analog as before.

Whether it's laggy remains to be seen...


Unfortunately, this doesn't compile in Arduino IDE

This is the error message I got

Code: [Select]
Arduino: 1.6.5 (Windows 7), Board: "Arduino Leonardo"

sketch_dec06a.ino: In function 'void loop()':
sketch_dec06a:47: error: expected ';' before 'if'
sketch_dec06a:131: error: expected '}' at end of input
sketch_dec06a:131: error: expected '}' at end of input
expected ';' before 'if'

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

Maybe it only works on the teensy after I install teensyduino?

I could be wrong, but those just look like formatting errors, not actual problems with the code like variables not existing or something.
demik will never leave.

Unless he gets banned.

Offline GuilleAcoustic

  • Posts: 77
  • Location: France
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #194 on: Mon, 07 December 2015, 01:20:45 »
For the errors, just add a ; at the end of all Temp = analogRead(some pin number) lines.

Offline sinusoid

  • Posts: 160
  • fd > ESC
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #195 on: Mon, 07 December 2015, 12:08:11 »
forgot to ask, what's a keyer?

https://en.wikipedia.org/wiki/Keyer

Essentially, it's what you just made, but used for typing  ;D

glad you like it. i'm certainly grateful for this community.  what surprises me is how this community's work differs so much from mass consumption commercial products.  maybe that won't be such a difference in a few more years when more people realize how much time they spend at pc and therefore how important the quality of tools are. 

Manufacturing tools are easy to access nowadays, and individuals can make products far surpassing mass-production when it comes to technological processes, customization, finish, quality... there are plenty of examples on this forum and elsewhere on the internets.

This market is not very attractive to corporations (yet), because the products that are being sold have relatively high cost, carry a high manufacturing risk and overhead, often need R&D on case-by-case basis... these are a hell to make from a corporate POV. And the market is very small.

This may change with advancements in design automation, 3d printing, 3d scanning, and - primarily - increasing demand. But not very likely to happen in the nearest decade.

Example: if you made a small run of your keyboard for the interested people, it would be more profitable for you to use either hi-grade epoxy resin for casting it, making it very durable (you could hammer nails with it without chipping) or biocompatible or neutral silicone (Sugru is essentially that AFAIK - neutral condensation silicone with a filler, probably talcum).
Both of these are extremely expensive compared to ABS for instance, but you'll save a lot of money, time, risk and effort compared to having a small injection molding run.

But yeah... it's nice to see people whose imaginations are not limited by store-shelf availability.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #196 on: Mon, 07 December 2015, 13:04:50 »
I could be wrong, but those just look like formatting errors, not actual problems with the code like variables not existing or something.

Haha, yeah... Looks like I slipped back into my day job and started writing VB :-[

Should also have pointed out that this code was lazy and assumed you were using digital pins 0-7, if you want to use different ones you need to update myPins at the top.

Does this work?  I really should install Arduino on here so I can test it myself :))

Code: [Select]
#define STICK_X 0
#define STICK_Y 1
#define OVERVAL 0

int Xstick;
int Ystick;
int Temp;
int myPins[] = {0,1,2,3,4,5,6,7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};

void setup() {
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
    pinMode(myPins[i], INPUT_PULLUP);
  }
 
  Joystick.begin(false);
}

void loop() {
 
  Xstick = map(analogRead(STICK_X), OVERVAL, 1024-OVERVAL, -127, 128);
  Xstick = constrain(Xstick, -127 , 128);
  Joystick.setXAxis(Xstick);
  Ystick = map(analogRead(STICK_Y), OVERVAL, 1024-OVERVAL, 128, -127);
  Ystick = constrain(Ystick, -127 , 128);
  Joystick.setYAxis(Ystick);
 
  int i;
  for (i = 0; i < 8; i = i + 1) {
 
   buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
 
  if(buttonState[i] != oState[i]) { //check against previous button state, if changed do something
    if(buttonState[i] == LOW) { //button has been pressed
      Joystick.pressButton(i); //press corresponding "joystick" button
    }
    else { //button has been released
      Joystick.releaseButton(i); //release corresponding "joystick" button
    }
  oState[i] = buttonState[i]; //save state to compare next time
  }

  Temp = analogRead(2)
  if (Temp < -30) {
    if (buttonState[8] == 0){
      buttonState[8] = 1;
    }
  else
    if (buttonState[8] == 1){
      buttonState[8] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[9] == 0){
      buttonState[9] = 1;
    }
  else
    if (buttonState[9] == 1){
      buttonState[9] = 0;
    }
  }

  Temp = analogRead(3)
  if (Temp < -30) {
    if (buttonState[10] == 0){
      buttonState[10] = 1;
    }
  else
    if (buttonState[10] == 1){
      buttonState[10] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[11] == 0){
      buttonState[11] = 1;
    }
  else
    if (buttonState[11] == 1){
      buttonState[11] = 0;
    }
  }
 
  Temp = analogRead(4)
  if (Temp < -30) {
    if (buttonState[12] == 0){
      buttonState[12] = 1;
    }
  else
    if (buttonState[12] == 1){
      buttonState[12] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[13] == 0){
      buttonState[13] = 1;
    }
  else
    if (buttonState[13] == 1){
      buttonState[13] = 0;
    }
  }
 
  Temp = analogRead(4)
  if (Temp < -30) {
    if (buttonState[14] == 0){
      buttonState[14] = 1;
    }
  else
    if (buttonState[14] == 1){
      buttonState[14] = 0;
    }
  }

  if (Temp > 30) {
    if (buttonState[15] == 0){
      buttonState[15] = 1;
    }
  else
    if (buttonState[15] == 1){
      buttonState[15] = 0;
    }
  }
 
Joystick.sendState()
}
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline GuilleAcoustic

  • Posts: 77
  • Location: France
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #197 on: Mon, 07 December 2015, 14:34:31 »
Does this work?  I really should install Arduino on here so I can test it myself :))

Do not have Arduino IDE installed as I'm moving to C code with avr-gcc, but I can still see missing ";". Too lazy to install the IDE, sorry  :p

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #198 on: Mon, 07 December 2015, 14:48:54 »
Does this work?  I really should install Arduino on here so I can test it myself :))

Do not have Arduino IDE installed as I'm moving to C code with avr-gcc, but I can still see missing ";". Too lazy to install the IDE, sorry  :p

Damnit, such a stupid syntax - why oh why can't a newline just be a newline?  It's much more likely than the other way round.

I can't see it but will give Camineet something to fix now that the if's at least work :P
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline Camineet

  • Thread Starter
  • Posts: 287
Re: game controller build thread (PS Vita analog stick, Cherry Red, Leonardo, LoL)
« Reply #199 on: Mon, 07 December 2015, 14:51:53 »
Does this work?  I really should install Arduino on here so I can test it myself :))


nope, still getting same error as before.  i'll see if i can fix it according to what was suggested above when freetime comes :)