Wires with diodes? - Page 1
Forum section: electronics / beginners

author: chaebutbae
author_rank: Newbie
timestamp: June 29, 2023, 04:24:42 am
content: Hi, I wanna make a game controller using keyboard switches but I realized that I would need diodes on my keys to prevent key rollover because I'm handwiring it. I know I can just solder diodes onto my wires or arrange them in a matrix but I was just wondering if there are wires sold with diodes built into them. Thank you.

author: DarkMode
author_rank: Contributor
timestamp: June 29, 2023, 07:52:38 am
content: Hey there, I'm no expert, however I haven't seen wires with diodes built in. My assumption is that you are looking for though-hole components, and diodes do have short wires coming out of them.The cleaver way of making keyboard/controller button grids/arrays was to use resisters, by pressing a particular button that resistance value was unique. X and Y grids, X grid may be increase in values of 10Kohms (1Kohm on X 1st line, 10kohm on 2nd line ...) Then Odd number were placed on the Y Grid (1ohm on 1st line, 3ohm on 2nd line). Pressing Key 'A' which is top left, the Resisters combine, X value of the first line is 1Kohm + Y value of first line is 1Ohm) - this would give you the value of 1001Ohms which is unique, no other key can have these value.That's how I've seen it done, making X values Even, and making Y values Odd - increasing in resistance. The values above are not set, you use what values you like.I'm sure the more experienced would have better tricks for you.Good Luck on your project!

author: mariush
author_rank: Super Contributor
timestamp: June 29, 2023, 08:07:11 am
content: You only need diodes if you do some multiplexing to reduce the amount of wires.There's nothing stopping you from having one wire / traces go to each button, it just makes the routing more complex. You could use a microcontroller with a high number of IO pins or you could use a i2c/spi port expander to connect each button to an IO pin.Then your microcontroller or whatever can scan the buttons tens to hundreds of times a second, do software debouncing maybe, then send the actual keys pressed to the system.

author: Terry Bites
author_rank: Super Contributor
timestamp: June 29, 2023, 11:00:22 am
content: Nah....

author: Infraviolet
author_rank: Super Contributor
timestamp: June 29, 2023, 05:11:14 pm
content: Best option is probably to design and order a PCB for it, solder the switches, and as many diodes as you like, as separate components on to the PCB. It will be much more resilient to handling than handwired switches.I doubt wires with integrated diodes are sold because in so many applications the diode could be an utter menace, diodes cause a voltage drop rather than being perfect one-way valves for electricity, so these wires wouldn't be useful in applications where you need the full voltage to emerge at the other end.

author: TimFox
author_rank: Super Contributor
timestamp: June 29, 2023, 05:22:40 pm
content: How long a wire do you need integrated with a diode?The standard leaded-package (DO-35) 1N4148 diode has two 1.00 inch wires on a 0.134 inch long body.If you need insulation, suitable heat-shrink or non-shrink small diameter is available.

author: Nominal Animal
author_rank: Super Contributor
timestamp: June 29, 2023, 06:00:39 pm
content: The diode legs do not take repeated bending, so I would avoid putting them in line with the wires to the buttons.A few years back I designed acarrier board for Teensy LCwith up to 32 buttons (4×8) and nine potentiometers, for an arcade cabinet or some such; Teensyduino (Arduino add-on for programming Teensy microcontrollers) having excellent support for making your own keyboard/joystick combos. Using dual common cathode Schottky diodes (like BAT54C or BAS70-05), the part count is halved, and these are quite cheap. Although small, the SOT-23 footprint is easy to solder by hand.I did also designa complete gamepad using WCH CH551Gin 2020, but LCSC ran out of the chips before I could build the board. (It even exposes I2C for a 128x32 OLED display, as I want mine to be able to choose between a number of different keys/buttons it produces, so displaying the current set would be nice. The idea is to 3D print the shell for it; there are four through-holes to screw the shell halves together, and suitable locations for support struts are marked on the silkscreen. At the center of both 4-button crosses is also a 1.5mm hole.)Today, I'd probably redesign the part placement, so that the microcontroller, supply bypass caps, and the current limiting resistors were on the backside, with only the buttons and I2C pins on the top side. Both of the above have native USB support, and can expose USB HID endpoints, so they are "real" controllers, and do not need any drivers in any OS.My designs are in Public Domain, so if you find them useful, feel free to use them as-is or to design your own.