Jump to content
NEW DISCORD SERVER DETAILS - SIGN UP NOW - Dogz Members Only Private Thread ×

Electric Circuit Problems


Jabo

Recommended Posts

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.

Link to comment
Share on other sites

  • 2. Administrators

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 2. Administrators

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2. Administrators

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2. Administrators

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

Link to comment
Share on other sites

  • 2. Administrators

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

Link to comment
Share on other sites

  • 2. Administrators

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2. Administrators

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

Link to comment
Share on other sites

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

No I would use the digital ground pins. While Ground is supposed to be common there can be differences in potential depending on how things are hooked up internally. Leo sent me a reply as well.

Hi Robert,

BU0836 uses high frequency pulses to check resistance of switches connected to its digital inputs. THis is why your analogue RC circuit does not work well.

What are you trying to do? Often it is easier to use external mapping software to create commands based on switch transitions.

Check these:

Autohotkey http://www.autohotkey.com/

SVMapper Link 1 or Link 2

JoyToKey http://www.mehdiplugins.com/herewedown/jtk379en.zip

Alternatively, consider a switch as 1/2 of rotary encoder. COnnect switch to button 1 input and leave button 2 not connected. Use encoder setup utility from BU0836X to setup encoder mode 1:1 on buttons 1&2 and you will have pulse generated on B1 when you close the switch and pulse on B2 when you open it.

If you have three position switch, connect it to buttons 1 and 3 and set up two encoders, etc.

Thanks

Leo

From what he says here you can set up the board in "encoder mode 1:1". Says you can connect a switch to input 1 and leave input 2 unconnected and the board will generate pulses based on the switch position. Not sure if that setup will work with a matrix but if not sounds inefficient.

It seems odd to me that he would be using high frequency pulses to detect buttons states but this is probably how the board is able to detect whether or not a button or switch is actually attached so it shows up in the control panel before you have pushed anything. I'm thinking since the columns are working ok we can find a workaround for the rows but it may require a little bit of experimentation. First off, start using the digital grounds for the digital inputs just to eliminate any issues with that. Test it first on the columns to verify that its working right then switch to the rows. The problem is with the high frequency variations in voltage you essentially have some amount of AC bypassing the capacitor. The cap will block DC when fully charged and that is the principle we're using to generate a single pulse. But if there is a biased high frequency signal on the DC voltage the cap will remove the biasing but the AC will still pass. Its looking like with a steady and solid DC coming from the board the circuit will work fine and is on the columns for whatever reason but with some amount of AC on the row (or at least enough to cause a problem as compared to the columns) the circuit is not able to cope with that. There may very well be some AC signal on on the column voltage as well but its frequency or biasing is such that it is not negatively effecting the capacitive charging circuit. We can probably make a small modification to the rows that will fix the issue but I need to think for a second to come up with something. I think we should use an inductor to smooth out the high frequency AC and see what happens. Inductive components like coils or inductors have a resistance to AC called reactance. Reactance is to AC what resistance is to DC. The inductor will resist the high frequency variations and produce a smoother DC signal. I'm not exactly sure how this the board will respond to this but its worth a shot.

I'll tell you what I am going to do, I have an oscope, so I will open up my switchbox and check the output of the columns and rows to see what difference there is in the voltage sources. This will give us a better insight into how to work around the problem.

For you however in the meantime do this first, using the digital ROW ouput and ground pins, try adding another resistor in series with the resistor in the circuit and see if that helps, if not remove that extra resistor and add it in parallel to the resistor in the circuit. What this will do is increase and decrease respectively the resistance in the circuit and change the charging time of the capacitor. This should change the line voltage and in turn the biasing of the high frequency AC which may have an effect on the output. If that fails to solve the issue you can also try adding another capacitor in series or parallel to the cap in the charging circuit for the rows. This may seem like we are taking shots in the dark here but with your limited testing equipment (pretty sure you don't have an o-scope laying around) and the parts you already have it is worth trying. If you can find a very small inductor you can try placing is in series with the charging circuit as well which should filter out some high frequency AC on the line.Let me know if that helps or not while I stew on the problem for a moment or two. I've contacted Leo again to see if he can be more specific as to why the columns would work but not the rows. Hopefully he will reply shortly.

Link to comment
Share on other sites

  • 2. Administrators

Perhaps I should be looking at the BU0836X instead. That seems to have an individual ground for each switch. And it has 32 discrete inputs so no need for matrix wiring...

Jabo

Link to comment
Share on other sites

Ah, rgr that, yes I see sorry. I thought you would have no problem using both columns and rows but this appears to not be the case. I see what Leo was talking about now. He's scanning the columns and rows in the matrix just like memory, polling for continuity. It may be that the reason the columns seem to be working is that they are oscillating fast enough to fool your eye into thinking the light goes out after the initial pulse when in reality it is just flashing at such a speed and duty cycle that you can't see it blinking. If the rows are strobing slow enough the flickering my become visible to the eye. In this case it may be more of a pain in the tail then it's worth. Before going with the BU0836 though I would run it past Leo and see if it will work properly on that board. Like I said before, not as simple a problem as it first appears. If you do have to go with the X board hopefully you can return your BU0836 or use it for another project. Sorry this doesn't seem to work out on this board but you may be right and hopefully the X board will function in a more co-operative manner but once again I would check first. To my knowledge you can connect several boards together and perhaps have them show up as one USB device though I don't know if they have to be the same model board or not. Hopefully you will have a use for the board you already possess. If not I or some of the other Dogz may be interested in it so you can get your money back.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Who's Online   0 Members, 0 Anonymous, 520 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...