0

Active Low Switches on the XBox
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Active Low Switches on the XBox

by stinkbutt on Fri Nov 19, 2010 3:17 am

So I'm working on a project to trigger two buttons in quick succession on my friend's XBox. What he wants is that when he pushes, say, the A button, that the LTrigger will fire off about 1/30th of a second later. He actually wants that to happen whenever he pushees A, B, X, or Y.

I did a little research with my multi and I determined that the buttons on this XBox controller are active-lows. What I mean is one end of the switch is pulled (weakly) high and one end is pulled (strongly) low. When you push the button, the whole thing goes low. I assume that somewhere between the switch and Vcc (which is at 3.2V) there's a line that goes to the XBox and the XBox detects the pin change to register the button's been pushed. This has been independently confirmed by Ben Heck when he made a 1-handed xBox controller. (He was helping out a Veteran who'd lost the use of one hand. I'm helping out a guy who wants to kick people's asses in Street Fighter. Ben Heck: 1. Stinkbutt: 0.)

So: I need to basically fire off LTrigger 0.03 seconds after I press one of the other buttons. First I built the circuit to fire off LTrigger immediately by putting a 2N3906 in parallel with the switch:

schematic.1.png
schematic.1.png (16.93 KiB) Viewed 2246 times


This worked, and worked well. It fired off both buttons at the same time. The diodes are there to prevent A, B, X, and Y from pulling each other low, by the way. They can sink current, but they cannot source current. (And I'd have posted this an hour earlier if I hadn't mucked up the diode orientation the first time I made these schematics in Eagle, grr!)

Then I added a capacitor to induce a delay:

schematic.2.png
schematic.2.png (17.75 KiB) Viewed 2246 times


I figured the capacitor (100 uF) would delay the activation of the 2N3906 transistor. Not so much. Instead, the capacitor ended up being a sink for enough current to immediately activate the transistor and never seemed to fill up. The voltage difference between the two terminals ended up at an ugly 1.1V.

The resistor, by the way, was a 10K trimpot (left-most and middle pins.) I also figured I could use the trimpot to tune the amount of delay induced, but it didn't seem to matter whether the pot was at the full 10K or 0, the capacitor just kept on sinking current.

So the delay capacitor didn't work. At least it didn't work the way I intended, inducing a 2-frame delay in the button pushes.

Anybody got any ideas? Have I hooked up the capacitor wrong? I'm fairly sure the trickle current is coming from the 2N3906, but is it possible the diodes are leaking? I don't want to use a microcontroller for such a stupidly easy task as inducing a delay.

[EDIT]
I've left out the line that goes from above the trigger switch to the XBox. I'm assuming that it just leads to a very high impedance input pin, and I'm almost certain it has no impact on the circuit. If you care, it'd be connected above the LTRIGGER switch, lead to the XBox, and you'd also have to include a fairly large pull-up resistor between that junction and Vcc @ 3.2V.
[/EDIT]
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Active Low Switches on the XBox

by zener on Fri Nov 19, 2010 4:01 am

stinkbutt wrote: Have I hooked up the capacitor wrong?


YES!

Put the resistor in series to the base, and the cap from the base to ground. Classic RC filter. And if you are looking for 1/30 sec change the cap to around .1uF

zener
 
Posts: 4558
Joined: Sat Feb 21, 2009 2:38 am

Re: Active Low Switches on the XBox

by stinkbutt on Fri Nov 19, 2010 12:00 pm

That doesn't sound right. In the initial conditions, which are what are broken, all the other switches are high so the diodes are blocking, and all four of those lines can be thought of as shorts. Which means they're all irrelevant, and the resistor IS in series with the base. And I'm still getting the issue.

After I posted it occurred to me: Should I be hooking up the capacitor to Vcc instead? That way the capacitor charges up, and then when one of the switches (ABXY) on the left go low the capacitor SOURCES current for the switch for a tiny amount of time, and then finally runs out at which point the 2N3906 starts sourcing the current from it's base, and the transistor conducts.

That's my latest and greatest theory.

[EDIT]
UNLESS, do you mean there's no resistor between the cap and the base, that the resistor is only between the cap/base junction and the diode array?
[/EDIT]
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Active Low Switches on the XBox

by zener on Fri Nov 19, 2010 2:07 pm

stinkbutt wrote:do you mean there's no resistor between the cap and the base, that the resistor is only between the cap/base junction and the diode array?

YES.

Also, I have an issue with your drawing. You show the "top" of the switch going to VCC but it should go to a pullup resistor.

zener
 
Posts: 4558
Joined: Sat Feb 21, 2009 2:38 am

Re: Active Low Switches on the XBox

by tinsmith on Fri Nov 19, 2010 2:43 pm

Zener wrote:Also, I have an issue with your drawing. You show the "top" of the switch going to VCC but it should go to a pullup resistor.


Man's got a point. Close the switch and you connect VCC to GND through a nominal zero resistance. Breakers trip, fuses blow, magic smoke escapes.
tinsmith
 
Posts: 62
Joined: Thu Nov 18, 2010 9:18 pm

Re: Active Low Switches on the XBox

by stinkbutt on Fri Nov 19, 2010 3:05 pm

Well first of all, I did, in fact, mention in the edit that I left out the pullup resistor. Assuming there is one. I also left out the signal line going to the XBox. However that's hardly the point.

The real point is I don't think your suggestion would work.

If the resistor and the capacitor are layed out like this:

schematic.3.bad.png
schematic.3.bad.png (6.46 KiB) Viewed 2211 times


Then consider both cases.

1. The circuit first starts up. The four switches (ABXY) go high but no current flows because of the diodes. The 2N3906's emitter goes high but no current flows because the base is not low enough, or if it is, it's not flowing fast at all. As a consequence, the capacitor takes a gazillion years to fill up and the voltage across the 2N3906 remains 1.1V, an ugly, nondeterministic, right-in-the-middle-of-the-hysteresis value.

So this doesn't solve that problem.

2. Then when I push a button, (the Y button, in this case) the capacitor is SHORTED to switch! Now there's nothing to stop it from instantly dumping all it's current down the diode. Consequence: No delay. This applies even if the resistor gets moved from between the base & the capacitor to between the capacitor and the diodes, only now the capacitor instantly sinks current from the base.

That's why I think I need to connect the capacitor to HIGH, and then when one of the ABXY switches go low, the capacitor takes time to discharge before allowing the 2N3906 base to go low.
Last edited by stinkbutt on Fri Nov 19, 2010 3:43 pm, edited 1 time in total.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Active Low Switches on the XBox

by stinkbutt on Fri Nov 19, 2010 3:06 pm

tinsmith wrote:
Zener wrote:Also, I have an issue with your drawing. You show the "top" of the switch going to VCC but it should go to a pullup resistor.


Man's got a point. Close the switch and you connect VCC to GND through a nominal zero resistance. Breakers trip, fuses blow, magic smoke escapes.


Not really. That part of the circuit I didn't build. That's part of the XBox controller. Since the XBox controller hasn't melted over the past year I think it's safe to assume they're using some sort of weak pull-up that I didn't bother to display because I'm not looking to build an XBox controller, I'm looking to modify an existing one. Besides, in the [EDIT] at the end of my initial post I'd added that I left out the signal line and the pullups.

I did this in Eagle only because it's how I make schematics. Not because I'm going to print my own PCB.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Active Low Switches on the XBox

by stinkbutt on Fri Nov 19, 2010 3:41 pm

OK, so this is what I'm thinking might work:

schematic.5.png
schematic.5.png (5.59 KiB) Viewed 2209 times


The capacitor's now attached to Vcc @3.2V, so it charges up to 3.2V initially and then when all the switches (ABXY) are high. (I think).

Now, when one of the switches go low, it takes a finite amount of time for the capacitor to discharge through the resistor before the base of the 2N3906 can go low. There's my delay.

Does that make sense?

Oh, I've also included the pull-up. The magnitude of 100M is a brown number.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Active Low Switches on the XBox

by zener on Fri Nov 19, 2010 7:25 pm

Zener wrote:Put the resistor in series to the base, and the cap from the base to ground.

This is what I wrote but not what you drew. You put the cap on the wrong side of the resistor. In your last version you have that fixed, and I don't think it makes any difference if the cap goes to gnd or VCC, so yes that should work.

zener
 
Posts: 4558
Joined: Sat Feb 21, 2009 2:38 am

Re: Active Low Switches on the XBox

by stinkbutt on Fri Nov 19, 2010 11:21 pm

OK, I understand. However, I have one simple question, in the case that the cap goes to ground.

Given that a capacitor needs to charge up to have a voltage across it, and it needs to be charged up to delay the circuit, and given that that charge needs to come from somewhere, if the capacitor is connected like you just said:

schematic.6.png
schematic.6.png (10.42 KiB) Viewed 2185 times


My question is:

Where does that charge come from? Or, more to the point, where does the current come from?

It can't come from the transistor. There's almost no current going through the base. And as the voltage rises in the capacitor, it'll be even less and less as the transistor's base goes up up up.

It can't come from the four switches (ABXY) because the diodes block that.

You cannot accumulate charge without current, and I just cannot see how I get current INTO the capacitor in that diagram.

Indeed, I can't see it in the previous diagram either, but I figured since a cap connected to ground can sink current briefly until it goes high, a cap connected to Vcc can source current briefly until it goes low. I could be wrong on that.
Red M&M, Blue M&M: They all wind up the same color

stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: Active Low Switches on the XBox

by oPossum on Sat Nov 20, 2010 3:02 am

stinkbutt wrote:You cannot accumulate charge without current, and I just cannot see how I get current INTO the capacitor in that diagram.


Thru the base-emitter junction of the 2N3906.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
oPossum
 
Posts: 636
Joined: Fri Oct 26, 2007 12:42 am
Location: Michigan, USA

Please be positive and constructive with your questions and comments.