Jump to content

Wiring diagram help


ISantus

Recommended Posts

I am embarking on a (relatively compared to many of the people I see on this forum) task to build a button box. While I believe I can handle the work, I am finding myself confused on the wiring diagram portion of this job. I am reaching out to you fine folks to see if anyone is willing to lend a hand in designing the wiring diagram for me to follow. I have attached a visual of the layout that also includes links to all of the products I intend to use. Is anyone willing to design a wiring diagram that I can follow? 

TYIA

Button Box.docx

Link to comment
Share on other sites

Your layout looks nice and compact. Make sure you leave enough space to operate the switches and dials comfortably and quickly. As for wiring, I took a look at the listed parts and some did not have an obvious way to access the data sheets so a pin-to-pin wiring diagram is not feasible. Here are some general guidelines that may help you (you may already know this):

Each switch and encoder will need one pin connected to ground. You will set the Arduino to pull-up the digital lines you are using and closing the switch will then bring the input pin down to 0V. You need to find out which pin needs to be grounded. For instance, on the two position 6 post switch the two central pins are probably the common and should be connected to ground, while the four outer pins are the contacts that are connected when the switch is closed. To wire this up, you would choose one side of three pins, connect ground (GND) from the Arduino to the center pin and connect each of the two outer pins to a digital input on the Arduino, for instance inputs 2 and 3.

I would avoid Inputs 0 and 1 on the Arduino as they may be used in the USB serial communication and there are plenty of others

The rotary switches work in a similar manner to the DPDT switches. Identify the common and connect to ground, then connect each of the remaining pins to a digital input.

The rotary encoder will require 5V and GND, as well as a digital input for DT, CLK and SW. SW will be the push button switch input, just like all the other switches and DT and CLK will need to be decoded in order to identify the rotation of the dial.

The three position toggle is the most complicated. Looking at the data sheet, you want to connect the ground to pin 5 and your outputs to the Arduino will be on pins 4,1 and 3. You also need to connect pin 2 to pin 6 and pin 8 to pin 12 in order for the connections to work properly for the three positions.

If you are making a USB HID, you don't need to track which pin is connected to which input unless you are very fastidious. Just make sure your are monitoring the correct range of pins in the sketch. When you assign joystick inputs in DCS, you can just press the correct button and the absolute identifier won't matter. If you are using DCS-BIOS, then you do need to keep[ track of which switch pin corresponds to which Arduino input so you can properly code the switch to the function you desire.

You can daisy chain the ground from one switch to the next. You might want to give the rotary encoders their own ground lines to minimize the chances of glitches.

Hopefully this helps. Once you wire up one switch and get it working, I think it will become obvious how to do the others.

Link to comment
Share on other sites

I really appreacite your help. I have another guy that I found on Facebook that has also offerred some input. Between your help, his help, and my neighbor who does electrical work, I feel like I can tackle this, or at least try. I am going to start making all the cuts and get the board and switches in the box. Then I think I might take a stab at one button, test my wiring, make sure all works, and proceed from there. I have thought about replacing the 3 way switch as the post situation seems intense, and the switch actually locks on all three positions. I didn't want that but couldnt find anything else that was on-on-on toggle. Im sure they are out there. 

Thanks again for your help and I will be sure to print out your suggestions when I begin wiring. 

Link to comment
Share on other sites

On 6/10/2022 at 7:10 PM, Spelmann said:

Your layout looks nice and compact. Make sure you leave enough space to operate the switches and dials comfortably and quickly. As for wiring, I took a look at the listed parts and some did not have an obvious way to access the data sheets so a pin-to-pin wiring diagram is not feasible. Here are some general guidelines that may help you (you may already know this):

Each switch and encoder will need one pin connected to ground. You will set the Arduino to pull-up the digital lines you are using and closing the switch will then bring the input pin down to 0V. You need to find out which pin needs to be grounded. For instance, on the two position 6 post switch the two central pins are probably the common and should be connected to ground, while the four outer pins are the contacts that are connected when the switch is closed. To wire this up, you would choose one side of three pins, connect ground (GND) from the Arduino to the center pin and connect each of the two outer pins to a digital input on the Arduino, for instance inputs 2 and 3.

I would avoid Inputs 0 and 1 on the Arduino as they may be used in the USB serial communication and there are plenty of others

The rotary switches work in a similar manner to the DPDT switches. Identify the common and connect to ground, then connect each of the remaining pins to a digital input.

The rotary encoder will require 5V and GND, as well as a digital input for DT, CLK and SW. SW will be the push button switch input, just like all the other switches and DT and CLK will need to be decoded in order to identify the rotation of the dial.

The three position toggle is the most complicated. Looking at the data sheet, you want to connect the ground to pin 5 and your outputs to the Arduino will be on pins 4,1 and 3. You also need to connect pin 2 to pin 6 and pin 8 to pin 12 in order for the connections to work properly for the three positions.

If you are making a USB HID, you don't need to track which pin is connected to which input unless you are very fastidious. Just make sure your are monitoring the correct range of pins in the sketch. When you assign joystick inputs in DCS, you can just press the correct button and the absolute identifier won't matter. If you are using DCS-BIOS, then you do need to keep[ track of which switch pin corresponds to which Arduino input so you can properly code the switch to the function you desire.

You can daisy chain the ground from one switch to the next. You might want to give the rotary encoders their own ground lines to minimize the chances of glitches.

Hopefully this helps. Once you wire up one switch and get it working, I think it will become obvious how to do the others.

I am continuing to struggle on this. I thought that hard part was going to be wiring, after some research, it seems that with the Mega, I have enough connection points to wire everythign direct without a matrix. However, after following as many forums and directions as possible to get my Mega board to function as an HID, I have failed. I am not sure where I am going wrong but I am unable to get it setup as an HID to test a single button. It appears as though I need to use Hoodloader2, but the directions are often more complex than I am able to follow. Do you have any suggestions for how to accomplish getting the Mega setup as an HID?

Link to comment
Share on other sites

Ah, but that image looks like it has the right USB chip - the second 2x3 pin header near the USB and small square chip are the indicators.  That's a 16u2.

Did you try this video: 

It looks simple enough to me.
There's something there about installing and using a special library in the IDE as well.

Link to comment
Share on other sites

5 minutes ago, No1sonuk said:

Ah, but that image looks like it has the right USB chip - the second 2x3 pin header near the USB and small square chip are the indicators.  That's a 16u2.

Did you try this video: 

It looks simple enough to me.
There's something there about installing and using a special library in the IDE as well.

Yes. This was the first video I found and followed. Unfortunately it appears (to me) to be outdated as this is using Hoodloader 1.8 vs the newer Hoodloader2. The instructions for Hoodloader2 feel less clear to me and it fails. Given how new I am to this process, it is hard for me to understand where I am failing. I have been trying to follow this https://github.com/NicoHood/HoodLoader2

Link to comment
Share on other sites

25 minutes ago, ISantus said:

Yes. This was the first video I found and followed. Unfortunately it appears (to me) to be outdated as this is using Hoodloader 1.8 vs the newer Hoodloader2. The instructions for Hoodloader2 feel less clear to me and it fails. Given how new I am to this process, it is hard for me to understand where I am failing. I have been trying to follow this https://github.com/NicoHood/HoodLoader2

I have just attempted this like the 10th time. I was able to get rid of the error at the upload point. However, given that I dont have a 100nf capacitor, I believe there is an error on reboot where it should load the new bootloader. I am going to see if I can get my hands on something locally to try this whole process again. I havent even gotten to the wiring and programming parts that I thought to be the hardest. I am in over my head....

Link to comment
Share on other sites

10 minutes ago, No1sonuk said:

You could theoretically run an 8x8 diode-blocked matrix on a Leonardo.  Then the HID part is taken care of by default.

 

I have ordered a Leonardo in case I am unable to get the Mega functioning prior. My worry about the Leo is the need for a matrix. The majority of my switches are rotary encoders. There are a handful of buttons that I understand how to get in a matrix, but the rotary encoders I do not yet understand how to implement a matrix. Outside of rotary encoders I have a couple 2 way on-on toggles and 5 regular buttons. The Leo has too few connection points to run everything straight in, hence why I went Mega. Unfortunately I was unaware of the difficulties of getting the Mega to function as HID. 

Link to comment
Share on other sites

you can take the easy route and use Bodnar boards. It doesn't need any programming. The ECU on it is recognized as a generic USB Joystick and you can hook up 32 or even 64 buttons to it, it's all plug'n'play really.

Wiring with bodnars is simple. Every button has 2 connectors, so the board provides a plug'n'play way for it, no need to solder anything, just plug the wires in and the board holds the wires in place via plastic tabs.

Encoders are basically button emulators, i.e. with every twist it emulates a button press, so a continuous turning of the knob will result in a subsequent button presses. Turning the knob to the right with emulate buttonX and turning to the left will emulate buttonY. With bodnar board you simply plug it in to 2 slots (one for each button). Encoders have 3 wire connectors, signalY-ground-signalX. With bodnar you'l connect SignalY-ground in to one button slot, and the remaining SignalX in to another button slot..

 

https://www.ricmotech.com/leo-bodnar-32-input-button-box-interface-board


Edited by peachmonkey
Link to comment
Share on other sites

9 minutes ago, peachmonkey said:

you can take the easy route and use Bodnar boards. It doesn't need any programming. The ECU on it is recognized as a generic USB Joystick and you can hook up 32 or even 64 buttons to it, it's all plug'n'play really.

Encoders are basically button emulators, i.e. with every twist it emulates a button press, so you a continuous turning of the knob will result in a consequent button presses. Turning the knob to the right with emulate buttonX and turning to the left will emulate buttonY. With bodnar board you simply plug it in to 2 slots (one for each button). Encoders have 3 wire connectors, signalY-ground-signalX. With bodnar you'l connect SignalY-ground in to one button slot, and the remaining SignalX in to another button slot..

 

https://www.ricmotech.com/leo-bodnar-32-input-button-box-interface-board

Wow! Learning so much. This is a rabbit hole isn't it? Thank you for the recommendation. I have 24 hours to prove to myself I can get the Mega to do what I want. If that fails, I am going to try to get one button to work on the Leonardo. If I still struggle with that by the end of the week, Im sending them both back to Mr. Bezos and switching to Bodnar, since it is all clearly above my head. Thanks for the recommendation

12 minutes ago, peachmonkey said:

you can take the easy route and use Bodnar boards. It doesn't need any programming. The ECU on it is recognized as a generic USB Joystick and you can hook up 32 or even 64 buttons to it, it's all plug'n'play really.

Encoders are basically button emulators, i.e. with every twist it emulates a button press, so you a continuous turning of the knob will result in a consequent button presses. Turning the knob to the right with emulate buttonX and turning to the left will emulate buttonY. With bodnar board you simply plug it in to 2 slots (one for each button). Encoders have 3 wire connectors, signalY-ground-signalX. With bodnar you'l connect SignalY-ground in to one button slot, and the remaining SignalX in to another button slot..

 

https://www.ricmotech.com/leo-bodnar-32-input-button-box-interface-board

Also, the rotary encoders I have are KY-040. They have 5 connection points. There is a 5v power connection and a button push, plus ground SignalX and SignalY. Would these even work with a Bodnar board? 

Link to comment
Share on other sites

8 minutes ago, ISantus said:

Wow! Learning so much. This is a rabbit hole isn't it? Thank you for the recommendation. I have 24 hours to prove to myself I can get the Mega to do what I want. If that fails, I am going to try to get one button to work on the Leonardo. If I still struggle with that by the end of the week, Im sending them both back to Mr. Bezos and switching to Bodnar, since it is all clearly above my head. Thanks for the recommendation

no sweat, it's easy-peasy with bodnars. Check out the pic below, the bottom of it shows the bodnar board with the plastic wire snap-in holder, as you can notice - no soldering 🙂

For me the biggest 'challenge' with building button boxes was to get the proper buttons/toggles, i.e. like in my case below I connected 30 x 2-position toggles to 2 x bodnars (32 button ones). In my case the toggles are "MomentaryON-Off-MomentaryON", i.e. the lever springs back to the center. There are toggles with "ON-Off-ON", meaning that you switch the lever to either side it will stay there until you move to the center (OFF), or to another side (ON).

So in my case, the MomentaryOn-Off-MomentaryOn toggle had 3 wires, 2xsignal and 1 ground. If you look at the board you can see B17/GND, B18/GND, etc. So the one toggle uses two buttons B17 and B18, however only B18 has GND connected.

With a single button you'll just plug 1 wire in to Bx (button) and another wire in to GND.  For 2 position toggles you'll split them, as long as GND is provided via one button the whole toggle will work... etc etc etc..

null

image.png


Edited by peachmonkey
Link to comment
Share on other sites

4 minutes ago, peachmonkey said:

no sweat, it's easy-peasy with bodnars. Check out the pic below, the bottom of it shows the bodnar board with the plastic wire snap-in holder, as you can notice - no soldering 🙂

For me the biggest 'challenge' with building button boxes was to get the proper buttons/toggles, i.e. like in my case below I connected 30 x 2-position toggles to 2 x bodnars (32 button ones). In my case the toggles are "MomentaryON-Off-MomentaryON", i.e. the lever springs back to the center. There are toggles with "ON-Off-ON", meaning that you switch the lever to either side it will stay there until you move to the center (OFF), or to another side (ON).

null

image.png

Looks great. Should I rethink my KY-040 rotary encoders that need power if I go the Bodnar Board route? 

Link to comment
Share on other sites

3 minutes ago, ISantus said:

Looks great. Should I rethink my KY-040 rotary encoders that need power if I go the Bodnar Board route? 

if the manual I found is the correct one then looking at the diagram the KY-040 actually has 3 signals:  2 encoders + 1 button (pushbutton?)

I think the pushbutton function is electrical in nature and you need to use the software to make sense of it. As far as connecting it to Bodnar it'll be similar to Bnumber/GND, i.e. Encoder1/+ goes to B1/GND, and encoder B goes to B2, not sure about encoder C, i think it's some sort of electrical thingie than the actual signal..

You can try them with bodnar, and see if it works, some folks suggest using bodnar configuration software to define the lenght of the electrical 'pulse' so it registers as a button press, but the software is only needed if you want to modify the default behavior, otherwise it works out of the box.

Although, if you're going Bodnar route then I'd recommend you get the encoders from his website, as they'll be tested against the boards/software. Here's a link to one example: http://www.leobodnar.com/shop/index.php?main_page=product_info&products_id=192

null

image.png

Link to comment
Share on other sites

I'd definitely go with the Bodnar for the encoders and simple switches.
The Bodnar encoder config software also helps with encoders that have more than one pulse per detent, so don't immediately dismiss it.

You really only need the arduinos if you want fancy switch functions such as originally discussed - i.e. 3 different outputs for 2 inputs.
If you don't need an output for the centre off, you can also use the Bodnar.

  • Like 1
Link to comment
Share on other sites

Thank you both for your help. This makes me much more comfortable. As much as I know I COULD learn Arduino, I really don't want to at this point. Bodnar seems to make the whole thing easier. Now hopefully Amazon doesn't give me hell for sending back two boards and 6 rotary encoders. 

  • Like 1
Link to comment
Share on other sites

7 minutes ago, ISantus said:

Thank you both for your help. This makes me much more comfortable. As much as I know I COULD learn Arduino, I really don't want to at this point. Bodnar seems to make the whole thing easier. Now hopefully Amazon doesn't give me hell for sending back two boards and 6 rotary encoders. 

I've returned apple juice to Amazon. I'm sure they'll be fine with the return of some electronic components.. 🙂

Link to comment
Share on other sites

8 minutes ago, peachmonkey said:

I've returned apple juice to Amazon. I'm sure they'll be fine with the return of some electronic components.. 🙂

So far they have accepted it and all new parts ordered. Now off to fly

  • Like 1
Link to comment
Share on other sites

Me again! The Bodnar board arrives today and I am ready to get this thing running in the next couple days. The question I have is how do I get 36 buttons to work on a controller that only has 32 inputs? I believe I would need to matrix some of them. If my math is correct I need to build a 3x4 matrix. That would require 7 wires for 12 switches thus reducing my needs to 31 inputs. Does this sound correct? 

Link to comment
Share on other sites

2 minutes ago, ISantus said:

Me again! The Bodnar board arrives today and I am ready to get this thing running in the next couple days. The question I have is how do I get 36 buttons to work on a controller that only has 32 inputs? I believe I would need to matrix some of them. If my math is correct I need to build a 3x4 matrix. That would require 7 wires for 12 switches thus reducing my needs to 31 inputs. Does this sound correct? 

Hi.

Maybe I'm late, but did you knew about this?  https://forum.dcs.world/topic/97434-an-arduino-usb-hid-controller-composite-usb-controller

I did a few of them and can help, if need be...

Saludos.

Saca111

 

Link to comment
Share on other sites

57 minutes ago, Sacarino111 said:

Hi.

Maybe I'm late, but did you knew about this?  https://forum.dcs.world/topic/97434-an-arduino-usb-hid-controller-composite-usb-controller

I did a few of them and can help, if need be...

Saludos.

Saca111

 

Thank you! This was my first route but I didn't get very far as a result of my experience with this type of process. First I bought a generic board and I dont think it had the required 16u2 controller. Second the programming seemed way above my head for my first dip into this type of process. As a result the folks above recommended that Bodnar boards that seemed more in line with my current skillset. 

Link to comment
Share on other sites

1 hour ago, ISantus said:

Thank you! This was my first route but I didn't get very far as a result of my experience with this type of process. First I bought a generic board and I dont think it had the required 16u2 controller. Second the programming seemed way above my head for my first dip into this type of process. As a result the folks above recommended that Bodnar boards that seemed more in line with my current skillset. 

Yes, you need a MEGA with the pins so you can enter DFU mode. Besides that, there is no programming needed at all! it is as simple as conneting to the IDE, loading the already written code, flash the new firmware, unplug, plug it back and done. If I could make it (no knowledge on the matter at all before this) anybody can!

Once flashed, the PC will recognise the MEGA as two Joysticks, each of them with 128 buttons. Depending on the code loaded, you can have 8 axis for the first joystick. The first 64 first buttons of the first JOY are dedicated to rotary encoders, so you could conncet up to 32 encoders or ON-OFF/ON-OFF-ON levers(not bad).

After that, there comes the wiring and there are some tricks to know, but not difficult if some one helps you!

Saludos.

Saca111

Link to comment
Share on other sites

17 minutes ago, Sacarino111 said:

Yes, you need a MEGA with the pins so you can enter DFU mode. Besides that, there is no programming needed at all! it is as simple as conneting to the IDE, loading the already written code, flash the new firmware, unplug, plug it back and done. If I could make it (no knowledge on the matter at all before this) anybody can!

Once flashed, the PC will recognise the MEGA as two Joysticks, each of them with 128 buttons. Depending on the code loaded, you can have 8 axis for the first joystick. The first 64 first buttons of the first JOY are dedicated to rotary encoders, so you could conncet up to 32 encoders or ON-OFF/ON-OFF-ON levers(not bad).

After that, there comes the wiring and there are some tricks to know, but not difficult if some one helps you!

Saludos.

Saca111

Darn it. This is what I was trying to do but gave up after struggling through several attempts at it. I couldnt get Hoodloader2 to work and wasnt sure where I was going wrong. I couldnt tell if it was the generic Elegoo (SP?) board that I chose, or my ignorance. Unfortuatnely I sent it all back to Amazon and moved over to the Bodnar board. I think if I can get this one working, I might revisit Arduino with a name brand board further down the line. Thanks for offerring your help. 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...