I made a programmable joystick

Page Splits 123>...4
Share This Topic
Share
Subscribe/Jump Subscribe This Topic
< >
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#1 “Quote” Edit Post
and chances are some people on this board could too.

I was initially motivated after reading KoD's thread on VFDC http://virtuafighter.com/forums/ubb.../242801/fpart/1
which explained how he had made one for testing VF. With SlapperJoe's help I modded my Hori T4 stick and connected it to an arduino, and started programming. We went through a few iterations (dualshock pad, Fighting Stick 3).

Over the holidays (I've had 5 weeks off) I took the time to assemble what i needed to get the setup just as I wanted it.

2xMayflash sticks (from Slagfart)
Arduino Mega (lots of lots of pins, lots of memory)
LCD screen (4x20 characters, blue)
LEDs
My own equipment for soldering etc.

I worked out how to solder for myself finally and went about putting it together. The mayflash sticks are actually extremely easy to use. They have 8 pins which are easy to find and solder too, and the stick itself is easy to solder onto. Grounding is easy as well. I'm sure you could swap bits out to make it a nicer stick, but at this point it serves no purpose to me.

After trying it out, I now have the following

- 2 sticks, controlled by the one PCB. 8 buttons each, 4 directions. Easy to test P1 and P2 stuff at the same time.
- LCD screen showing title, frame rate (NTSC/PAL/Custom) and values which I'm testing (generally frame intervals). Also shows frame elapsed/time elapsed
- Coding is tight. New timing means that it drops about 3/1000 seconds in the first second and is almost 999 or 1000msec per second thereafter. Frames are pretty much accurate. Easy to swap NTSC and PAL.
- I have scripts for testing delays between moves, reading inputs, JF testing/training and combos. Can increase delay for 4 separate moves without having to reupload the script, and it is displayed on the LCD. Can also swap 1P and 2P side as needed.
- Coding is still a bit messy, but works ok. Have tested a few things that I've wanted to know (OTGF input requirements, tech-catch window)
- Works on Wii, PS2, PS3 and PC (note, doesn't work on PS3 backwards compatibility.)

All I really want to do is
- Attach it to a solid base.
- Attach some LEDs for JF timing
- Simplify the code
- Test T6BR.

Might be able to answer some questions with it.
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
Paik4Life
Destroyer
Joined: Apr 2001
Posts: 1417
From: USA Virginia
PSN: Paik4Life
#3 “Quote” Edit Post
Very cool. I've never been into programmable sticks, but since this is a homebrew project, I definitely like the effort and skill involved in creating it. Most importantly, you need to swap out those stock parts for some Sanwa parts!

~Paik
Signature "I'm unstoppable!!!" ~The Juggernaut
"Who OWNZ?!? The Shadow OWNZ!!!" ~Paik

"Smart bomb...*WHAM* haha!" ~ Aspen from RI Tekken Ep 2
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#4 “Quote” Edit Post
So anyway, I thought this deserved a bump. The time is coming when I'll have to give away testing (see the link in my sig to find out what I've been up to) and it would be nice if someone else would take over. I'd be happy to give advice to anyone who wanted to try making one of these for themselves (as if I can do it, anyone can) without taking responsibility if it goes wrong.

You can find my sketch here which loads up in the arduino program found here

Anyone interested?

(Btw, I ended up buying a Hori V3 SA. Will do my real playing on that. The mayflashes remain just for testing).
Spearl236
Virtuoso
Joined: Aug 2005
Posts: 242
From: USA Ohio
#5 “Quote” Edit Post
Can you set it to repeat a move or set of moves. Similar to the in game program functions in previous tekkens?

Also how much did everything end up costing?

thx
Signature A close mouth don't get fed
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#6 “Quote” Edit Post
2xMayflash sticks $27

1xArduino Mega $65

1xLCD Screen $20

And all the soldering kit etc. I had to buy, you may not.

You could do it cheaper with one stick and a cheaper arduino for 1P testing. I wanted to have both sticks programmable.

You can fairly easily set it to do different strings to defend against, you'd just have to enter the commands for the arduino then set it to randomly choose one after an appropriate interval.
Spearl236
Virtuoso
Joined: Aug 2005
Posts: 242
From: USA Ohio
#7 “Quote” Edit Post
Originally posted by noodalls
2xMayflash sticks $27

1xArduino Mega $65

1xLCD Screen $20

And all the soldering kit etc. I had to buy, you may not.

You could do it cheaper with one stick and a cheaper arduino for 1P testing. I wanted to have both sticks programmable.

You can fairly easily set it to do different strings to defend against, you'd just have to enter the commands for the arduino then set it to randomly choose one after an appropriate interval.


could u post the link of the cheaper arduino also. i would like to see its pricing.
Signature A close mouth don't get fed
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#9 “Quote” Edit Post
Going to try making a round 2 stick.

Astrocity panel with Seimitsu Sticks and buttons
2xCthulhuMC PCBs
Arduino Mega
LCD panel
Some wood
Some stickers
Hauppauge HD PVR
PS3Eye
Some microphones perhaps.

We'll see how this one goes. Hopefully it will be good to play on as well as test on (the mayflashes, not so much).
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#10 “Quote” Edit Post
Just a quick update. I got my first generation PStick back having lent it to a friend, and went about revising the code to be neater and simpler to use, as well as testing how accurate the timing was.

The new code
http://www.megaupload.com/?d=EJ1KY0MW

The timing
http://www.megaupload.com/?d=TGZQA8AK
Basically, the code was set up to press 1+2+3+4 on F1, F101, F201, etc. all the way up to F1001. It also releases the buttons after one F.
The video shows that it achieves this with no error. This is mainly thanks to chaning from 16666 (drops 2 frames over 1000) to 16683. Thanks Rufus.

Work is progressing on the Round 2 stick, but waiting for akihabara shop to ship my panel. Stalled until that happens.

The main improvement in this code is you can now input commands as

press (starting frame, finishing frame, button/direction 1, button/direction 2, button/direction 3, button/direction 4)

so to do d+HP on frame 61 is just
press (61,62,D,C)

Makes it a lot easier to type and for other people to understand. If you need more than 4 buttons/directions, just do two press statements.
INFORCER
MR. TEKKEN!!! (LSS)
Joined: Jul 2002
Posts: 1410
From: USA Louisiana
PSN: inforcer23
XBL: inforcer81
#11 “Quote” Edit Post
Noodalls this is amazing man.. Its bad that Namco screwed us over with no command capture/Rec.. I still find it terrible that they havent released a patch to add it as this is an important feature of any home version of a fighting game.. Capcom put it in SF4 for christ sake. We need to not be quiet about this and express our outrage.

NAMCO RELEASE A PATCH FOR COMMAND CAPTURE>> You do have hardcore fans you KNOW..
Signature Get Lost you cant compare with my power. Attack me if you dare, I will crush you.Why is inforcer a beast?

Who's Your Sensei !!!!!!!!??
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#12 “Quote” Edit Post
Originally posted by INFORCER
Noodalls this is amazing man.. Its bad that Namco screwed us over with no command capture/Rec.. I still find it terrible that they havent released a patch to add it as this is an important feature of any home version of a fighting game.. Capcom put it in SF4 for christ sake. We need to not be quiet about this and express our outrage.

NAMCO RELEASE A PATCH FOR COMMAND CAPTURE>> You do have hardcore fans you KNOW..


I can only really half agree with this. I realise it's bad that Namco didn't put command capture in in the first place, however at this point I'd say the chances of them adding it are slim to none. It would cost them thousands of dollars to add it (looked for an article on capcom unity which I've read before where it explains how even simple patches will cost a lot once coding, testing, verification are done). Not to mention, how many people is this really going to benefit? At this point, probably only the really hardcore, and chances are they will buy Tekken 7 regardless. There's a quote in the patch thread where Harada has already said he was under pressure not to put much work into practice mode.

On the other hand, I did my second project today, and in an afternoon basically have it up and running. For about $20 you could get a command capture setup going (assuming you have a stick that is easy to add the arduino too, buy an arduino board and have a soldering set up and some wire.) But after close to a year of having this thread, one person has shown any interest.

I realise it's easier to complain on a message board though.

In other news

NollaN
Lone Wolf
Joined: Aug 2005
Posts: 308
From: Sweden
PSN: Crimson_SWE
#13 “Quote” Edit Post
lol.
how did i miss this?
I had about the same id?e a couple of months ago.

I watched this: http://www.youtube.com/user/Crimson...f/3/z9me5045ooY

And thought that a programmable device/stick would be awesome, not just as alternative for the command capture, but for helping the combo video community.

Thought due to the lack of my knowledge of programming I only got as far as to start designing the interface

http://img52.imageshack.us/img52/4388/ps3io.png


Wish you the best of luck..
Signature A wise man does not need advice and a fool won't take it.
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#14 “Quote” Edit Post
Made my round 2 stick, it is working well. Have managed to do a few things I'd be holding off on. The Cthulhu work very well for it.


dietydevil
Master
Joined: Jul 2008
Posts: 184
From: Pakistan
PSN: Diety--Devil
XBL: None
#15 “Quote” Edit Post
noodalls i need that damn programmable arcade stick lol
what does the programmable stick really do, it would be end
of combos era if everyone had programmable stick at their
home lol,
is it like u set commands for the stick and with a single press
u get a like example EWgF?
Can u make a video when u finisehd making one hehe
i really need to see 5 Ewgfs with Prgrammable arcade stick
Signature Tekken Tag 2 DEVILS Combo Act 2
http://www.youtube.com/watch?v=v3FyzjzqdJQ

Tekken Tag 2 DEVILS Combo Act 1
http://www.youtube.com/watch?v=iC8smflPtCk
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#16 “Quote” Edit Post
You mean like this?

That was done about 18 months ago now, when the project was very much in its infancy. The features are better now, although it is still prone to typos, making combos probably the least practical of its functions.
dietydevil
Master
Joined: Jul 2008
Posts: 184
From: Pakistan
PSN: Diety--Devil
XBL: None
#17 “Quote” Edit Post
Originally posted by noodalls
You mean like this?

That was done about 18 months ago now, when the project was very much in its infancy. The features are better now, although it is still prone to typos, making combos probably the least practical of its functions.

Haha noodalls thats what i am talking about,
lolz it was awesome, with a single button lightdashes.
u started working on in 2009?
can u make this thing work on Tekken 6?
Signature Tekken Tag 2 DEVILS Combo Act 2
http://www.youtube.com/watch?v=v3FyzjzqdJQ

Tekken Tag 2 DEVILS Combo Act 1
http://www.youtube.com/watch?v=iC8smflPtCk
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#19 “Quote” Edit Post
Inspired by KoD of www.virtuafighter.com and helped by Slapper Joe of www.ozhadou.net, I went about building a programmable stick. The first prototype was with an old Hori Tekken 4 stick, the first round with two Mayflashes, and now my round 2 is with an Astro city panel. The features have been added and added as I went, but I thought it would probably be a good idea to write down how I made my most recent stick, in case anyone wants to follow.

Warning
A note however, from what I understand it is generally a bad idea to have the arduino connected to a console and a PC at the same time. For whatever reason the battery powering the arduino doesn?t seem to supply enough power to keep things going, so I keep mine connected via USB to power it, and I can also upload sketches repeatedly. If you chose to follow the steps in this guide, you take on responsibility for any damage incurred, whether to your computer, your game console or any other electronics or other involved.
I suspect an axis adapter might avoid this problem, if it still communicates wirelessly with the ps3.
My Materials
Astro-city panel with seimitsu parts
Extra buttons (4x24mm, 4x30mm)
Cthulhu MC x 2
Arduino Mega (duemilanove is enough for 1P, Mega for 2P)
LCD screen
LED lights
PS3 eye
Bare minimum
Arduino
Buttons/joystick
Other equipment
25W soldering iron
Flux
Wire
Header pins
Soldering stand


WIRING
The basis of this is straight forward. The arduino has the ability to write or to read through its pins. By connecting the pins to the joystick board, you are able to either read button inputs, or send outputs to the board and then on to the game console. In this way, you can very precisely control what you want your controller to do.



http://img18.imageshack.us/img18/6861/exampleimage.jpg

Here is the basis of it all. This setup involves the arduino, a Cthulhu MC and a button. There are four wires.
Red ? connects the arduino to the Axis adapter. This is the connection that lets the arduino read what is being pressed, and also write to the Axis adapter, which will then go on to the console.
Yellow ? connects the button to the Axis adapter. When the button is pressed, a signal is sent to the axis adapter and then on to the console.
White ? ground wire. Completes the circuit so that when the button is pressed the circuit flows.
Black ? ground wire to the arduino. Also needs to be there to let the arduino send its signals.

My way of connecting these was to braid the yellow and red wires together, then tin them, then solder them onto a header pin, and clamp this into the Cthulhu MC. The yellow wire is soldered onto one pin of the button, and the white wire onto the other. The white and black wire can be braided, tinned and soldered onto a header pin in the same fashion as the yellow and red. At the arduino end, I use header pins again, with the red and black wires tinned and soldered on. I try to cut very close to the end so there is little exposed wire not connected to a header pin to cause shorts.
For the rest of the buttons, the ground section can likely be daisy chained to reduce the amount of work needed. For an Axis adapter you might need to do it by groups, for my setup the astro-city came with groundwires already set up so I used those.
For the remainder of the yellow and red buttons it?s just a matter of repeating the braiding, tinning and soldering for each one.

Once you have connected a button or two, it?s probably worth uploading a simple sketch to test that everything is working. Something like when square is pressed also press triangle would test both the read and write functions fairly easily.
Then once everything is connected, you can program your full sketch, upload that and start doing whatever it is you want to do.
noodalls
Moderator
Joined: May 2003
Posts: 2404
From: Australia
PSN: noodalls
#20 “Quote” Edit Post
//This is the basic sketch for the programmable stick. This is uploaded to the arduino, and from there will send outputs to the MC Cthulhu and on to the PS3, allowing you to send commands
//to the PS3.
// It also has the ability to read what is being pressed on the controller, through the Cthulhu and report this to the Arduino.
//In its current form, it has two sticks attached (four directions), with eight buttons each, as well home, select and start buttons. All of these are available to be send inputs or outputs.
//There are also eight LEDs attached, on pins 54-61. These currently serve very basic functions, but could be set up to do more advanced features.
//There is also an LCD screen connected. This allows for display of the variables beings used.
//The sketch is frame accurate
//At the moment, the way the sketch works is that when you press and release the SELECT button, a value N will be reset to zero (N=0). Then, every time 16.683msec passes (1 frame at 60hz)
//N will be increased by one. So after 1 second, N should equal 60.
//This can then be used to set up the timing for commands. Lets say you want to do something on frame 20 (we will refer to this as F20 from now on). So, you would need to tell the arduino
// something like "If N is 20, press button X."
//Remember also, that the arduino is just a dumb machine, so you also need to remind it to stop pressing the button (it would be easy to program it to release the button after a frame every
//time you tell it to do something, but this could make it harder for holding buttons for logner.

//It's probably worth mentioning the syntax used in this sketch for sending commands to the arduino. If you input the command "press(20,25,A,B); that will press buttons A+B on F20, and release
//them on F25. It used to be a lot longer, this is I feel the ideal balance between typing too much and not having enough control.

//Remember, when you press and release SELECT, it will reset the N value to zero. Therefore, every time you press and release SELECT, it will wait 20 frames and then press A+B for a duration of
// 5 frames.

//Here are some examples of other common moves. Once you get the hang of them, it's not to hard to work out what to type.
//Fireball - press(1,3,D); press(2,4,R); press(3,4,A);
//Shoryuken - press(1,2,R); press(2,4,D); press(3,4,R,A);
//f,F+2 in Tekken - press(1,2,R); press(3,5,R); press(4,5,B);

//You will have probably already worked out, each of the buttons is referred to by a specific name, which is defined at the start of the sketch. My way of doing this is to use capital
//letters for player 1 and lower case for player 2. This means that I can use the same letters in duplicate, but have it obvious to whom it refers.

// The directions are referred to as U,D,L,R. The buttons are
// A B C P
// X Y Z Q
//Why not A,B,C,D? Well, because D is already used by a direction. HOM, SEL and STA are fairly obvious as well.

//Now is probably the right time to introduce the four variables, I,J,i and j. Let's look at an example to explain why we need variables. Let's say we want to do a simple link with Ryu,
//f+HP,d+HP
//You could try inputting
//press(1,2,R,C); press(3,5,D,C); However, as you would quickly appreciate, the timing would be all wrong. This would do the d+HP motion far too soon,
//and the motion would be complete long before the input window occurs. Now, to work out the timing there are a few things you can do. You could retype the sketch, increasing the timing by one
// or a few frames each time, until you find the correct timing. This is fairly labourious, especially if you're going to be making a combo with multiple parts (and other than James Chen,
//no one has made a good 2HIT combo movie.
//You could record the game (preferably at 60fps) and estimate when the window will occur, based on animations finishing. This works quite well for Tekken, as its hit analysis feature
//changes colour when the recovery is finished, making it quite obvious when to input the next command. There is however an easier way.
//What if we could keep f+HP as a constant, so that every time you press and release SELECT it will do it on the first frame, but then vary the timing on the f+HP portion.
//This is exactly how this sketch is set up to work. We assign d+HP a variable I, and instead of press(3,5,D,C); we just input it as "press(I,I+1,D,C);" This means that on frame I,
// it will do the listed command, and after uploading we are free to alter the value of I. For example, if we run this sketch with I equal to 40 it will still be too early, and if
//we run the sketch with I=80 it will be far too late. I believe I=63 or thereabouts is the correct value to have this combo work.

//Now, if we upload the sketch with a variable I, but then have no way to manipulate it once the sketch is uploaded, it's no better than manually editing the sketch each time.

//The way I have it set up at the moment is to have four different variables (I,J,i,j) and control each one with a button, P,Q,p,q respectively. While holding button P, it will increase the
//value of P depending in which direction you press the stick. R will increase it by 1, U will increase it by 5, L will decrease it by 1, D will decrease it by 5, l will increase it by 10,
// u will increase it by 20 and r will increase it by 50. d will decrease it by 100. There are two additional features, holding sel and pressing c will make all the value 0, and holding sel
//and pressing z will make J one above I, i one above J and j one above i (so that they fire off one frame after the other). You can always set the values to less than zero to make
// the sketch ignore them (as it only starts counting at 0.)

//There are lots of other functions that can be programmed in as well. A control capture is not too hard to implement. The simplest way to do this is to have it read when each button
//is pressed and released, nad output this to the serial minitor. If you do this in the same syntax as that used in the normal sketch to instruct the arduino to do commands,
//then it is a simple matter of cutting and pasting into the sketch once you find what you want.

//You can also have the arduino randomly choose between different options to facilitate defense training or throw break training.

// You can also use it to practice timing, so that it will feed back (LCD or serial)
//when inputs are done at the right time (e.g. Just frames.) You can combine this with throw break training as well.

//A quick note on timing. Initially I had the sketch set up so that the arduino would do a move, then I would use the delay function to wait the required number of msec, and then increase
//N by 1. However, the problem with this is that if you want to do a lot on one frame, potentially it can take a few msec, and so if you take say 3msec to do an action, and then delay the
//normal 16msec, you will end up running slow.

//Instead of this, the way it is set up now is to have an interrupt set up, so that it should stop whatever you are doing when time is up, and advance on to the next frame.
//This seems like the more accurate way of doing it.


//What follows is the main sketch itself, with some notes to the side to explain what is going on.

 All times are GMT. The time now is 14:28

Page Splits 123>...4
Moderator Tools
Forum Jump