XBox Guitar Button Interface
NosePicker
Posts: 54
I am thinking this will be very simple for anyone with a little experience but unfortunatly I am a noob.
This is what I want to do.
1. Detect when a button is pressed on the guitar.
2. Programmatically press the button by sending the proper voltage to the proper wire.
Here is what I know.
I have disassembled an XBox guitar controller and have taken one of the buttons and traced the wires back to the source.
I have solidered a wire to each of those leads to be long enough to reach my breadboard next to it.
I have hooked my volt-ohm meter to those wire leads and when the button is NOT pressed the voltage seems to vary between 0.9v - 0.4v.
When I press the button the volts drops to 0v. I know my wires are connected correctly because if I touch the two wires together the game responds as if I pressed that button.
I have a Basic Stamp II in a breadboard and everything is hooked up I can write programs on my Windows XP PC and do simple tests like blinking LEDs, so everything is ready for me to test.
Here is what I dont know.
To keep this thread simple I would like to focus just on how to detect when the button is pressed.
Can someone help me figure out the wireing diagram and then point me in the right direction as far as the code goes.
Thanks in advance
NosePicker
This is what I want to do.
1. Detect when a button is pressed on the guitar.
2. Programmatically press the button by sending the proper voltage to the proper wire.
Here is what I know.
I have disassembled an XBox guitar controller and have taken one of the buttons and traced the wires back to the source.
I have solidered a wire to each of those leads to be long enough to reach my breadboard next to it.
I have hooked my volt-ohm meter to those wire leads and when the button is NOT pressed the voltage seems to vary between 0.9v - 0.4v.
When I press the button the volts drops to 0v. I know my wires are connected correctly because if I touch the two wires together the game responds as if I pressed that button.
I have a Basic Stamp II in a breadboard and everything is hooked up I can write programs on my Windows XP PC and do simple tests like blinking LEDs, so everything is ready for me to test.
Here is what I dont know.
To keep this thread simple I would like to focus just on how to detect when the button is pressed.
Can someone help me figure out the wireing diagram and then point me in the right direction as far as the code goes.
Thanks in advance
NosePicker
Comments
sounds like its and active low switch (when switch is pressed sends a low or GND)
as far as wiring diagram your going to have to do some circuit studying (look, follow, measure, write down)
draw up a diagram, something simple as block1(power) connecting to block2(switch)
now to measure an input you first have to have a input pin(IN#), a main (DO...LOOP), (IF...THEN), and an output pin
Dr. Vetter
Thanks anyways.
nosepicker
I don't·want to make assumptions about the electronics and start recommending a semiconductor-based interface on that basis, but I'll just figure that it's OK with shorting wires together as you have.·
So, I wonder how responsive, how fast, all that has to come about: what's fast enough?· It'd be pretty easy to use relays (if it's OK with shorting wires, it's OK with relay contacts), but you'd hear them clinking unless you put the assembly into a muffled-box ("flying leads" out to your x-box device.)·
It wouldn't be pretty or cutting-edge, but it could be effective.
Post Edit -- Possible device:· http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&pa=138431&productId=138431
Post Edited (PJ Allen) : 7/10/2008 1:18:01 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Try connecting the red(+) of the volt meter to one of the button wires and black(-) of the volt meter to the black(-) wire from the guitar controllers battery.
This should give you a better reading. If pushing the button doesn't change the reading on the volt meter then connect the red(+) wire on the volt meter to the other wire from the switch.
This will tell you how the switch works, and will make it easier for us to help you with how to go about doing this.
edit: so why are you wanting to have the basic stamp in the middle of the switch and controller anyway?
Please provide information on what you are wanting to achieve.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
If you like my avatar then check this out Propeller Domed Stickers for sale
Building Blocks To The Propeller Chip
Then I grounded my meter to·my 6v power supply.·[noparse][[/noparse]Test 2] I connected my + wire from the volt meter to one side of the switch/button and I got a reading around 20v. When the button was pressed it dropped to about 2v. [noparse][[/noparse]Test 3] I then connected the + meter lead to the other side of the switch/button and the reading was about 0.3v. Then when the button is pressed there is no change in voltage. [noparse][[/noparse]Test 4] I then connected the two leads from the meter to the two sides of the switch, I get a reading about 0.75v. Then when the button is pressed the voltage drops to 0v.
Project Goal - Record and Playback.
Ultimatlly I will have the stamp talk via serial communication to my pc, which I have done before in other projects. I will then "Record" the button presses with timing on the PC. Once that is complete I will want to do a "Playback" feature where the PC will handle the timing and will read back the recorded actions and send messages back to the stamp and I will want the stamp to "simulate" a button press. Once I learn how to "detect" a single button press and then later "create or simulate" a button press, I know how to do everything else. I will ultimatlly be monitoring 6 buttons and I will use a single byte and let each bit represent if the button is off or on.
Thanks for your help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Post Edited (NosePicker) : 7/10/2008 3:39:06 AM GMT
Connect + on the voltmeter to one side of the button on the controller and - to the black wire on the usb port (not the metal case).
You should get 5v then drop to 0v when button pressed or visa-versa.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
If you like my avatar then check this out Propeller Domed Stickers for sale
Building Blocks To The Propeller Chip
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Then do this
Switch
/\/\/\/
BS2 pin
where /\/\/\/ is a 220ohm resistor.
This should give you what you want as long as the voltage from the button is no more than 5v. (more than 5v will most likely fry your BS2)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
If you like my avatar then check this out Propeller Domed Stickers for sale
Building Blocks To The Propeller Chip
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Here is my problem now, with my power supply turned off to my bread board, if I hook the + wire to a 220ohm resitor and the resitor to a pin on my basic stamp my voltage drops to 2.5v. Then if I connect the wires from my PC to the breadboard inorder for me to talk to the BS and send my program to it, then my voltage drops to 1.5v. Now when I load my program the result is showing that when I press the button it works perfectly ( I am displaying all 0,0,0,0,). However when the button is not pressed it appears the pin / voltage is dropping because when the button is not pressed I will display mostly 0,0,0,0, but occasionally it will do 1,1,1,0,0,1,1,1,0,1,0... So it thinks the button is being pressed. Below is my code, I think there is still a problem with wiring the circuit right.
<Circuit> -wire from switch is connected to the ground on the breadboard. The + wire from the switch is connected via a 220ohm resitor to pin7 on the basic stamp. Other than the required wireing to make the stamp work that is all the wiring there is.
=========== Code =====================
input 7
checkpin:
pause 20
debug DEC IN7
goto checkpin
================
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
It should have an in and an out. When you push it the two wires are connected joining the circuit.
By connecting one of the switch wires to GND you are shorting the circuit this will cause the voltage to drop and if not fixed can cause damage to both the BS2 and the xbox controller.
You should have it wired something like this.
When the switch is pushed the wire with the 220 ohm resistor on it goes from 0v to 5v or something like this.
If you could upload some pictures of the front and back of the xbox controller board then I could draw on the pics to show you where your wires need to go.
Hope this helps
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
If you like my avatar then check this out Propeller Domed Stickers for sale
Building Blocks To The Propeller Chip
Post Edited (computer guy) : 7/13/2008 9:04:22 AM GMT
Neat project! I think once the interface is correct, you may have timing issues since I think you are going to try and stay in sync for a whole song (hard to do open loop). If there was a way to get feedback during the song (maybe by syncing with audio or video), you'll become closed loop and able to stay in sync better.
An optocoupler would be an easy way of isolating the two circuits but I believe it would be beneficial for NosePicker to get how to interface to a switch before we start introducing him to other electronics.
I also agree that it is a great project and would recommend that he looks at my project as it unfolds. robot.tmcp.com.au/buildingblock/projects/guitar.htm
Sorry for the quick plug.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my robot using the propeller RECONAUTOR
If you like my avatar then check this out Propeller Domed Stickers for sale
Building Blocks To The Propeller Chip
As you will see the green and red button share (what I call the ground wire) and the yellow and blue share a ground wire as well.
Here is the wierd thing, if I connect the ground of the orange button to the green and red ground, then if I press the green button then the xbox thinks I have also pressed the orange button but not the red.
I think from what I learned on another project yesterday that I now know how to "playback" by using a transistor. All I think I need to know now is how to build a circuit for "recording" or detecting when a button is pressed. If you could help me with an example of where to connect which wires for just one button then I should be able to reproduce the same for the rest of the buttons.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Press and release each button and record the results.
Like
I know this may look time consuming but it will give me a good idea of how the switches work.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.
Guitar Hero controller using the prop (WIP) --> HERE
Post Edited (computer guy) : 7/15/2008 2:14:37 PM GMT
Corrected pinouts
Color·· +Pin·-Pin
Green·· 8····· 1
Red····· 7···· ·3
Yellow· 6····· 3
Blue···· 2····· 1
Orange·5····· 4
No Buttons Pressed
· 1 = 0.003v··
· 2 = 2.7v··
· 3 = 0.003v··
· 4 = 0.003v··
· 5 = 2.7v··
· 6 = 2.7v··
· 7 = 2.7v··
· 8 = 2.7v··
Button Pressed
Green
· 1 = 0.06v·*
· 2 = 2.5v
· 3 = 0.003v
· 4 = 0.002v
· 5 = 2.2v
· 6 = 2.0v
· 7 = 2.5v
· 8 = 0.06v·*
Red
· 1 = 0.005v
· 2 = 2.2v
· 3 = 0.06v·*
· 4 = 0.005v
· 5 = 2.7v
· 6 = 2.7v
· 7 = 0.06v·*
· 8 = 2.8v
Yellow
· 1 = 0.005v
· 2 = 2.7v
· 3 = 0.06v· *
· 4 = 0.005v
· 5 = 2.2v
· 6 = 0.06v· *
· 7 = 2.5v
· 8 = 2.2v
Blue
· 1 = 0.06v·*
· 2 = 0.06v·*
· 3 = 0.004v
· 4 = 0.003v
· 5 = 2.0v
· 6 = 2.0v
· 7 = 2.0v
· 8 = 2.0v
Orange
· 1 = 0.004v
· 2 = 2.2v
· 3 = 0.007v
· 4 = 0.06v·*
· 5 = 0.06v·*
· 6 = 2.0v
· 7 = 2.0v
· 8 = 2.0v
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
I am assuming that the low reading of 2.7v is because the volt-meter isn't fast enough for the fast switching columns of the matrix.
The only thing I can suggest is to try the below and if it works then we might be able to get something going.
Run your test program that outputs 1's and 0's to the Debug window.
Push the green button and release, see what you get.
If that doesn't work then there is another way of doing it but it would involve desoldering the buttons from the controller.
But the BS2 would not be fast enough for that design and the propeller chip would have to be used.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.
Guitar Hero controller using the prop (WIP) --> HERE
Post Edited (computer guy) : 7/16/2008 5:38:26 AM GMT
I solidered a red wire to the circuit board on pad #8 and made the circuit however after getting such bizar readings I decided to take apart my second guitar to see if that controller did the same thing and it did.
If I check the voltage by connecting my meters ground to the usb ground and my meters + lead to the solider pad for switch pad 8 before connecting the red wire to my breadboard I get anywhere from 3.3v - 2.7v. But after I connect to my breadboard just how you see in the picture I get a reading of anywhere from (get this....)·35v - 60v ( no I didn't forget the decimal and yes I checked about 10 times to verify I was reading it right.)
By the way I connected the resistor to pin 8 on the basic stamp. and the output was 0,0,1,0,0,1,0,1,1,etc... even if I pressed the button it would still flip between 1s and 0s.
Here is the code for the basic stamp:
input 8
MainLoop:
pause 250
if (IN8 = 0) then isoff
debug "1,"
goto MainLoop
isoff:
debug "0,"
goto MainLoop
I also attached a picture of the actual switch board you will see the same cable attached to the end of this board which is what is attached to pads 1 - 8 on the main circuit board. And a picture of the circuit board after I solidered the red wire to pad #8.
As a side note, what are you using to draw your diagrams with?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Post Edited (NosePicker) : 7/16/2008 5:24:45 AM GMT
I have made the change to the diagram so that you have an accurate reference.
I have tested your code and it works fine.
You could simplify your code with this though.
Just a suggestion (will save on code space)
edit:
If that doesn't work then try this.
P.S. I use eagle from www.cadsoft.de for my schematics and boards.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.
Guitar Hero controller using the prop (WIP) --> HERE
Post Edited (computer guy) : 7/16/2008 8:16:31 AM GMT
Your original diagram appears to work. Unfortunatly for me I woke up this morning and connected the BS ground to the USB ground and when I went to boot my PC to run the program my primary harddrive crashed, so I downloaded the BS Editor on another one of my PCs connected it and when I first tried it, my Xbox was locked up so I thought it was not working. After I noticed it locked up I rebooted the xbox and now it appears to work.
The sad part is now I have to go to work for the rest of today so it will be this afternoon before I can finish testing.
Dude if this works then I am going to buy you something from this website and send it to you.
I will post later this afternoon to let you know how it goes. I guess I will be rebuilding another PC this evening :-(
Thanks a million.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker
Helping each other is what the community is for. Who knows one day you may help me.
For testing try this code.
Make sure the pins are the ones you are using.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.
Guitar Hero controller using the prop (WIP) --> HERE
Post Edited (computer guy) : 7/16/2008 12:45:04 PM GMT
The .zip file contains a text file with the code for the BS2 and an application that will show you what buttons are pressed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.
Guitar Hero controller using the prop (WIP) --> HERE
Post Edited (computer guy) : 7/17/2008 1:13:59 AM GMT
edited to add:· ....or in jail· [noparse]:D[/noparse]
Wow you must work long hours. I have been waiting 12 hours for a response, so far.
I really want to know if it all works.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.
Guitar Hero controller using the prop (WIP) --> HERE
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Building Blocks To The Propeller Chip A web site designed to help people who are new to the propeller chip.
Guitar Hero controller using the prop (WIP) --> HERE
I will use a power supply because I have to be close to a computer to do what I have to do anyhow so I am just going to make my circuit reside at the PC. I am about to try to quickly get the 5 main buttons connected to my breadboard before I am back off to work so if I get it done I will let you know, else it will be later on tonight. By the way I am in Georgia so I am going by EST. Wont get home till about 8 or so. Now that I think most of the electrical mystries are out of the way I will begin developing the recorder, editor and playback logic this weekend.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thanks
NosePicker