hey everyone to start I am completely new to Arduino's and coding, I have been into simulation style gaming for many years and have wanted to build a button box to help both with emersion and just to simplify some things and have to move camera angles as much and so on. I am looking to purchase a Arduino mega for the controller and these are some of the switches I would like to use, but I was curious how would I go about wiring up the LED inside of the switches? any help on this would be greatly appreciated, I do understand how to wire the goggle to function with the Arduino but the LED part of it is throwing me off and google isn't very helpful on this search.
Welcome to the forum.
It seems to have resistors for the led, to use the leds with 12V.
A Arduino Mega can output 5V with a pin, the leds would be very dim at 5V.
If you bring 12V into your circuit, then you need a transistor or mosfet or chip to turn on the leds, and if you make a mistake, then the Arduino board might get damaged and perhaps you computer as well (if it was connected via the USB cable).
Can you find better switches ?
may have solved the wiring aspect on my own correct me if I am wrong.
led positive from the switch to the 5v output on the Arduino
led negative from the switch to a ground on the Arduino
switch positive to analog input on Arduino
switch negative to ground on Arduino
and if I was to need to use the boost converter it would be wired something like this
Arduino 5v to BCM + input, then BCM + output ( set at or around 12V ) to switch LED +
Arduino negative to BCM - input, then BCM - output to switch LED -
And I have spent a good amount of time searching for 5v led switches and IDK if I just am looking in the wrong places but I cant seem to find any I like. I did reach out to the seller and they stated even at lower voltage these do still light up fairly bright, however I was thinking if they do not light up the way I was hoping maybe using a boost converter module would help the issue?
While you can use an analog pin as a digital input, it would be a waste. You might need the analog pin for some other use later. Just use a digital pin for a switch.
This should work, but the led inside the switch will be permanently on, you won't be able to control it. If you want to control it, maybe you can use a digital output pin, but before doing that, measure the current flowing into "BCM+". A digital output can provide only 20~30mA.
Mega is not suitable for building button boxes. You need a board with "Native USB capability" such as Pro Micro (don't confuse with Pro Mini). Leonardo can also be used but is not convenient for constructing your circuit (true for Mega too!).
I just realised the RGB led inside the switch is common cathode. This is quite inconvenient.
How did you want to control the led? If you want full rainbow colour control, and you need the full brightness at 12V, it can be done but extra circuits will need to be built.
ok am I confusing the two? because I was on the understanding that a toggle switch was analog and a decoder would be a digital.
well that really sucks to hear because then I will need to run multiple boards, the whole reason I wanted a mega is cause it had lots of usable digital and analog inputs. basically my box will consist of
6 momentary LED on-off-on toggle switches
3 on-off toggle switches
2 rotary encoders with a push button center click
and 5 LED push button latchable on-off buttons
Not any more.
Decoder? Do you mean rotary encoders? Those are also digital.
A common beginner misconception, and a bad idea. Using multiple boards makes the project much more difficult because of the difficulties getting the boards to communicate with each other.
In effect, 12 momentary switches and 6 LEDs.
Ok
Rotary encoders are, in theory, equivalent to a pair of pushbuttons. However, it's very easy to miss edges when the encoders are turned quickly, so often external interrupt pins are used.
Centre click buttons on rotary encoders are just ordinary pushbuttons.
5 more latching switches and 5 more LEDs.
Total buttons/switches:
12+3+2+5 = 22
These could be organised as a 5x5 matrix. Because some are toggle switches, diodes would be needed in series with each switch to prevent "ghost" readings. 10 digital pins required.
Total LEDs:
6+5 = 11
These could be integrated into the switch matrix so that only 2 additional digital pins would be required.
Total encoders:
4 external interrupt pins
Grand totals:
12 digital pins
4 external interrupt pins
Arduino pro micro has 18 digital pins, of which 5 are also external interrupt pins.
yep that was my phone trying to autocorrect me.
I appreciate your help, I was able to find wiring diagrams online for how to set up a 5x5 matrix, however could you go into more detail on how only 10 pins would be needed? that part is going a bit over my head.
for these all I want to do is when it is in the off position the LED is red, and when I turn it to the on position the LED is blue. on the listing for the switch they actually have a wiring diagram on how to achieve this already. unless it will be different because of the Arduino.
this was also good to learn and I have since ordered a pro micro as I did not know you could wire these in a grid matrix.
and I think I am finally happy with the design of the box, here is what I came up with in fusion I will likely be adding a display or more buttons to the angled part later on.
now I just need to print the box and have the parts show up and it will be build time!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.


