Electric Circuit Problems

By Jabo, Nov 17, 2011 in Help!!

Posted November 17, 2011

I'm trying to build some circuitry for my switchbox but I don't really know what I'm doing. Any experts out there who'd be prepared to led a dog a paw?

Jabo

new sig copy.jpg

Posted November 18, 2011 · edited Nov 18, 2011 by Mayhem

Well, I do have a degree in Electronics so I guess I'm supposed to be an "expert". I've built my own switchbox like several others so give me a rundown of the problem and maybe we can get together over a cup of joe.

Posted November 18, 2011

Thanks Mayhem. Here's the thing. I want to use standard toggle switches on my new switchbox (spdt type). Problem is that this type of switch changes a state until switched to another state. Obviously this doesn't work for computers as they just see a constant repetition of a keystroke for example. So, what I want is something which will generate a pulse when the switch is flipped and then another when it's flipped back, but nothing inbetween. I've found a circuit design using an opto-isolator which should do the trick, but it won't work for me (can't get an identical component through, so maybe the reason.) Apparently, using an RC circuit is one way to be able to double trigger the isolator, but I'm not sure how to go about it.

The isolator is an ILQ74.

Thanks for any help you can offer

new sig copy.jpg

Posted November 18, 2011 · edited Nov 18, 2011 by Mayhem

Well, I been round the mill with this same thing. The straight answer is its a bit more complicated then it first looks as you've eluded to. The problem with standard toggles is once they are on they will keep sending ascii signals to the computer until you turn them switch off, which you don't want. Therefore you need a pulse generator circuit of some sort to act as a middleman so to speak between the two. If you can stand to compromise, if its even really a compromise (which I don't feel it is personally) you can just get some mom-off-mom toggles. They look just like regular toggles however their normal state is centered and off. Flick them up they do one thing, flick them down they do another. You can even use lights to indicate the states. Either way it is a much less complicated (with means less potential issues too) way of doing it and the can then be wired straight up to a keyboard controller board, BU0836, Arduino or whatever. Don't know if you've seen my switchbox but you keep the same general look, save money and compact your controls. This way I have 10 switches that perform 20 functions. Let me know if you're still hell bent on standard on-off toggles and we'll work something out. I'm using mini toggles hear but you can get them in standard size as well. Check out Jamco they have everything you need regardless of the road you want to go down. If I remember correctly these are what I used. I have a place were you can get free sample project cases as well like the one I have pictured or larger.

Otherwise, the next best thing to do is use capacitors and a power source (typically the +5v from your USB). The BU0836 has a +5v out so that's convenient. It what I used to illuminate my EJECT button. You can have one cap for each switch position. When you flick the switch to either state you can have the cap momentarily discharge, sending a pulse until it charges again. at which point the pulse stops. Remember though that some control have a toggle function in the games and some don't so you need to either think if its going to be gear up/gear down or toggle gear if its available. This goes for everything.

Pardon the poor overlay card, I am making new ones. With them I can just switch out the card for IL-2, FS9, FSX, Race 07 or whatever other application I want to use the box for.

post-591-0-03449700-1321649336_thumb.jpg

Posted November 18, 2011 · edited Nov 18, 2011 by Jabo

Yep, this is the point I've reached. I have purchased some resistors and capacitors to enable the RC circuit to be built and will provide a pulse of approximately 0.5sec which should be short enough.

Personally, I'd rather not use on-off-on switches for two reasons. Firstly, I'd prefer the look of SPDT toggles and secondly I've got several ready to go.

The finished article will use a Bodnar board but at the moment I'm using a controller board from a defunct joystick as a proof-of-concept. The board works fine, it's 'just' a question of how to get the pusle to the board.

My aim here is to finish with a PCB to work in conjunction with the Bodnar board.

I can get the PCB made no prob but apparently I need the circuit first :notfair:

Jabo

P.S. This is the version of the Bodnar board I'm considering - feel free to tell me I'm making a mistake

new sig copy.jpg

Posted November 18, 2011 · edited Nov 18, 2011 by Mayhem

Not to be a smart guy, but the toggles I linked you to ARE SPDT, there are just 2 per switch (basically a 2 in 1), though I know what you are talking about. Technically if you were making a sim pit or a modern fighter you would need both standard and momentary toggles.

Ok enough of me being a smart ass...

It may be better to have DPDT toggles in this situation as they allow for more options regarding your cap discharge circuit. The cap and resistor values would help too. Do you want the switches to do one function in one position and another in the other position. Or one function in one position and in the other off. It would help if you could elaborate a little on what you are making. Is it just a box all On/Off functions or are some of them On/Off while others are On/On? The circuit will change depending on which mode you want. I'll assume for now you are just going for standard On/Off operation. I have a circuit I just came up with, all I need to do is the calculations for the charge/discharge rates and test it. I'm thinking a 100ms charge and as quick a discharge as possible.

Posted November 18, 2011 · edited Nov 18, 2011 by Jabo

Currently I'm just looking at the toggles in IL2, so gear up/down, lights on/off, that sort of thing. I hadn't really considered doing anything much else except maybe trim wheels but that's a whole different ball game.

Funnily enough I've been using momentary toggles (without realising the proper name for them) to avoid having to build additional circuitry but I'd like now to be using switches that model an On (up) and Off (down) sort of thing.

The cap/res values I have are 22uF and 330ohms.

Jabo

P.S. If there's a way of adding a small LED to indicate an 'On' state I'd be interested in that too.

new sig copy.jpg

Posted November 19, 2011 · edited Nov 19, 2011 by Mayhem

Currently I'm just looking at the toggles in IL2, so gear up/down, lights on/off, that sort of thing. I hadn't really considered doing anything much else except maybe trim wheels but that's a whole different ball game.

Funnily enough I've been using momentary toggles (without realising the proper name for them) to avoid having to build additional circuitry but I'd like now to be using switches that model an On (up) and Off (down) sort of thing.

The cap/res values I have are 22uF and 330ohms.

Jabo

P.S. If there's a way of adding a small LED to indicate an 'On' state I'd be interested in that too.

Ok there Jabo, the attached circuits should work fine. The first is for in game toggle assignments the second is for 2 different in game button assignments per switch. For the second circuit you might want to add some much smaller value resistor to the discharge circuit for the caps so that they discharge much faster then the other caps charging. The way I have it drawn now, you are just shorting the leads of the cap to discharge it which can be a little hard on them and may more may not lower the life of the caps. If you use standard electrolytic caps with say a 25v rating I don't think 5 volts or less is going to hurt them. Let me know what you think. As for LED indication you will probably need a separate circuit for sensing the state of the output. Maybe a transistor biased by the the output acting as a current control gate to the LED and you'll need to get something like .7 volts or more from somewhere. This is all off the top of my head so let me stew on it for a few and I'll see what I can come up with.

P.S. Ok I think I am finally done editing this post now.....

Edit. ok maybe I am not done editing. I just re read your last post Jabo and 2 things come to mind. As you said momentary toggles are easy and with the BU0836 trim is a cinch and really couldn't be easier either. Leo Bodnar really outdid himself with this interface board as it is really a work of Geniius, very elegant and well though out. All you have to do is hook up some 100K pots to the analog pins and your done. It senses the pots and calibrates for them automatically. His board requires no drivers as its in the firmware. Any analog or digital inputs that do not have a button or pot attached are automatically disabled so they don't show up in the driver screen thus avoiding clutter and confusion. You can even hook 2 or more of his boards together if I understand correctly. For the price you can't beat them and making them yourself is just masochistic.

post-591-0-58184400-1321726142_thumb.jpg

post-591-0-05431700-1321726165_thumb.jpg

Posted November 20, 2011

Thanks Mayhem. There's a couple of things I don't understand though. Where's the output to the joystick board? And where's the opto?

Jabo

new sig copy.jpg

Posted November 20, 2011 · edited Nov 21, 2011 by Mayhem

I labeled it (v sense) and wrote BU0836 over it where the 1v supply is shown. Its just a general representation of the boards voltage at the digital input pins. I don't know exactly how much voltage the board uses for the switch continuity check but typically its 5v or less for digital. For the sake of argument lets just say its 5v. When the circuit is closed, the 5v pin is shorted to the a ground pin. When the closed condition is detected by the integrated circuit on the BU0836 it sends the computer a signal indicating that a button press has been detected. You can hook the BU0836 up and check the voltage between the 5v sending and ground pins to get the exact value but it doesn't really matter too much as long as some given amount of continuity is detected. As for "the opto" (opto-isolator?), you shouldn't be needing one as we are not adding any voltage to the circuit other then what is native to the BU0836. If your worried about repeat keystrokes or switch debouncing I don't see it being an issue especially not the switch denouncing as the BU0836 doesn't seem to have much of a problem with it on my setup and I have the switches hooked up directly to the board. I'm sure it was thought of when designed.

Looking at the drawing, didn't label the caps C1 and C2 but this should be obvious. You can label them if it makes it easier to follow. One lead of the cap C1 is attached to (through the switch) a resister and then to a 5v digital input pin of the BU0836. This is not to be confused with the 5v source pin on the board for lighting LED and whatnot. The other lead of the C1 cap will be attached to the digital input ground pin of the BU0836. When you latch the switch in the right direction direction, C1 will have voltage applied to it from the 5v pin of the BU0836. The cap will take 5 time constants to fully charge. One time constant will be determined by the value of C1 and the attached resistor. During the time it takes for the cap to fully charge a button press will be detected by the BU0836 as the circuit will effectively be closed. When the cap fully charges, it will have the same voltage potential as that between the 5v and ground pins thus canceling one another out and creating an open circuit at this point. The BU0836 will detect this open state as a release of the button.

The C2 cap circuit will be close with the switch in its current position and any voltage that might have been previously stored on it will be discharged through the attached resistor. It will then be empty and ready for the switch to be throw in the opposite direction at which point the whole system will reverse. C1 as mentioned above will now effectively become C2. While one cap is charging the other will be discharged, back and forth, flip flopping with the toggling of the switch. So for a toggle control in the game, you get one pulse in one switch position and another pulse when the switch is flipped the other way. You can add a much smaller value resistor to the discharge leg if you'd like to accelerate the discharge speed.

Trying to keep the it simple, the BU0836 digital inputs can be hooked up as this

5v digital input pin > to switch > to ground digital input pin

You can hook up 12 buttons this way but frankly its a waste. If you hook it up in matrix form you can have 32 buttons but it requires more wiring and it is a bit more to wrap your mind around. I have mine in matrix form and it wasn't that that big of a deal, you just have to keep thing straight and not get confused. There are optional diodes you can use if you'd like. I forwent the diodes and haven't had a single problem.

Hope this helps, let me know if you run into any problems. :D

post-591-0-43083200-1321842138_thumb.png

post-591-0-58819900-1321842145_thumb.jpeg

Posted November 21, 2011

I see, that makes things clearer, thanks m8. I'd better get that BU0836 ordered and a load more caps, resistors, switches and pots. This'll be fun!!

Jabo

new sig copy.jpg

Posted November 21, 2011 · edited Nov 21, 2011 by Mayhem

Sorry if I wasn't as clear as I should be or if my explanation was confusing. Looking at my schematic again, its a bit rough. I just whipped it up real quick so I'll make you a better one.

Your going to have 8 analog inputs as well so don't let them go to waste. The Bodnar boards are great for converting old flight systems like the old metal thrustmaster HOTAS and pedals to usb while improving performance. I have 5 unused analogs left on my board so I am thinking about making a custom dual throttle and pedals.Bodnar makes a 12 bit version of the board but based on the sensitivity of my trim controls I think the 10 bit version will be enough for any joystick. 10 bits is equal to 1024 steps of resolution across the full range of the axis. So from stick center to full left is 512 steps and from center to full right is 512 steps. Plenty I think.

Posted November 21, 2011

I don't think it was your explanation which was lacking. More likely something to do with me being a bear of very little brain.

I think I have it now though. I've ordered the bodnar board and several of the preterminated leads. I've also ordered switches, caps, resistors and pots from Maplin.

Gonna build a 6x2 matrix to start with and work up from there.

Thanks for your help getting me to this point, I'll keep you posted.

Jabo

new sig copy.jpg

Posted November 21, 2011

Did you get Double Pole Double Throw toggle?

Posted November 22, 2011

Mayhem, I like your switch box, nicely done.

SkyPup

Posted November 22, 2011

Mayhem, I like your switch box, nicely done.

Thanks Skypup. I was almost as fun to make as it is to use. Almost, cause its REALLY fun to use.

Posted November 22, 2011

Did you get Double Pole Double Throw toggle?

Yep, I ordered the DPDT sort - I think the website showed them as 'On(On)'. I've written off the others that I have - they'll go in a box of misc bits and bobs later

Just got to wait for the Bodnar board now.

Jabo

new sig copy.jpg

Posted November 23, 2011 · edited Nov 23, 2011 by Jabo

Well, got the Bodnar board. Two things quickly spring to mind; a) It's really tiny and B) it's frickin awesome...

I've built a test circuit to check I've understood things and it all seems to work as expected.

Thanks Mayhem - I definitely owe you a drink.

All I have to do now is try and understand the matrix wiring...

Jabo

<<<EDIT>>>

There's something rather odd happening here. If I plug the v(sense) into any of the 'column' connectors, the switch and circuit works as normal. However, if I plug into any of the 'row' connectors, the corresponding light on the properties panel lights up and sort of flickers - except when the switch is flipped, then it goes steady for a moment then starts flickering again. I've tried a 'reset to default' in the properties window but it doesn't make any difference. Any ideas?

new sig copy.jpg

Posted November 23, 2011 · edited Nov 24, 2011 by Mayhem

I won't suppose you have an o-scope or logic probe? Since you say it works fine hooked up to the columns but not the rows, I am wondering if rows are pulsing. I wouldn't think that was normal. Have you tried hooking up to all the row and experience the same behavior? Also double check to make sure the wiring is correct. Sounds like you got it correct if its working on the columns. Just to make sure you understand that the humps in the red wire in my first drawing indicate that they are not attached to any of the green wires. Other then that it could possibly be something wrong with the board. Try using the ground pin that corresponds to the row pin you are connecting it to. Also try using different ground pins and see if that make any difference. If none of that pans out the best thing to do at this point would be to try and contact Bodnar and run the problem pass him. Perhaps and email with a link to this thread. I don't know how easy he is to get a hold of.

Edit: I've sent Leo Bodnar an email explaining the situation. Hopefully I will hear back from him in the next couple of days. I'll keep you posted but in the meantime see if switching ground pins helps.

Posted November 24, 2011 · edited Nov 24, 2011 by Jabo

Hi mayhem, I've also emailed Leo, and he says it's something to do with the high frequency pulses generated when the pins are scanned interfering with the RC circuit. This strikes me as odd as the circuit works find on all the column inputs but none of the rows. I'm using the gnd from one of the analog inputs. Is this the right thing to do?

Jabo

new sig copy.jpg

Sign in to reply.