Help with project :tongue2:

Well, Ima 1st year student and I've been taught all about resistors and capacitors and inductors. So I decided to use my n00bish skills to change my old saga joystick into a pc one(analog) :P Everything is fine. Learned all about ports and everything I need to make the joypad. Now yesterday, I startted designing the circuts n stuff and came across a problem thats not within my scope to solve :( PC joystick port works by completing/varying resistance of the joystick circuit. E.g. for the x-axis pin 0 ohm implys left is pressed, 50 ohm nutral and 100 ohm indicates right. i.e. I need to come up with a circuit which should have a resistance of 50 ohm at normal state, 0 ohm when left button is pressed and 100 ohm when right button is pressed.

The easiest way to get this problem solved is using 2 way microswitches which allow current to flow one way when the switch is supposed to be open and other way when its closed. But the problem is, my sega kaypad buttons can only act as on and off. It does not have the fancy 2 way stuff.
So I was wondering if there was an easy way to do this without making things too complicated.

Staff: Mentor

Is there any power available from the game port? What is the expected behavior when both switches are pressed at the same time (back to 50 Ohms?)? Can you change the right switch to be a normally-closed switch instead of a normally-open switch?

I think if you can change the R switch to a NC switch, you can make it work the easiest. You would put the left NO switch around a 50 Ohm resistor, and the right NC switch around another 50 Ohm resistor. The two 50 Ohm resistors are connected in series.

Staff: Mentor

complexhuman said:

Exactly. The problem is I can only have a NO switch and no NC. And no, you shouldnot be able to press right and left at once.

Is power available on the port? If so, just use FET switches that are driven by the two buttons. And I think you should plan for both switches being pressed at once, and make the result the 50 Ohm middle position.

power???? you mean the +5 v bit and current supply? Yup :P ANd Nope :P you dont want to go to right and left at the same time. Even if some controlloers allowed that, its not possible with that sega controller I have.

hmmmm....

I have access to some "FET MPF102 N-Ch Junction", I've googled about FET's a bit. All the examples I've come across that i have understood seems to be like "put current thru this to open the switch." Gives me ideas for an analog and gate using 2 of those :) I am still confused :S I dont have much experiance with those transistors :(

Staff: Mentor

complexhuman said:

hmm...Something just came up...How would make an analog not gate:P?

An analog NOT gate would be something like an NPN transistor with its emitter grounded, a resistor from its collector to 5V, and a resistor from its base to your input voltage source. As the input voltage rises, that turns on the NPN transistor, and drives it into saturation which pulls the collector down to a few times 0.1V. As the input voltage comes down to ground, that turns off the transistor, which allows the pullup resistor to raise the collector voltage up to 5V.

Since you have a 5V supply available, you can do your function easily with CMOS switches. For example, check out the MAX4626 CMOS switch:

It will do what you want. Maxim has a pretty broad line of FET switches, so you might be able to find a little cheaper switch that meets your needs. Use two FET switches with the two 50 Ohm resistors that I initially described, and have the left button pull the enable input of the left CMOS switch up when pressed, and have the right button pull the enable of the right CMOS switch down to ground when pressed. Have a default pulldown resistor on the left switch enable input, and a default pullup resistor on the right switch enable input. Use several kOhms for the pullup/pulldown resistors.

Staff: Mentor

complexhuman said:

I was thinking there was any easy way to do this like A transistor which allows current to flow normally and when u put current through its base, it stops??? Is that possible???

It sounds like you need to find out more about what the game port is looking for. I'd assumed that it was 50 Ohms and 100 Ohms differential, but if it is just to ground, then it makes your job easier. And yes, you could do it with transistors then.

Staff: Mentor

He probably means "hfe", which is one measure of the transistor's gain.

hfe = Ic/Ib

But hfe varies with collector current, and it is lower at lower collector currents. The resistor values shown in the example schematic are pretty high, so the collector current is going to be in the 20uA range, where a typical transistor like the 2N3904 doesn't have a great hfe. So the transistor that he lists in the schematic probably has good hfe (100 isn't bad) at low currents. If you are going to use a different transistor, look on its datasheet for its hfe value down in the 10-20uA range, and make sure it is >=100 min. The 2N3904 has an hfe of about 10-20 min at that low of a collecter current.