Author Topic: Need help, uneven backlight on a QMK converted chinese keyboard  (Read 3281 times)

0 Members and 1 Guest are viewing this topic.

Offline andresteare

  • Thread Starter
  • Posts: 39
Need help, uneven backlight on a QMK converted chinese keyboard
« on: Wed, 20 January 2021, 15:16:29 »
Hi guys!

I got into this which is reviving a dead mech I got for $8 with a Teensy and converting it to QMK. The keys are working flawlessly and it's completely usable but I can't make the backlight to work properly.
 To use the dead PCB to my favor, I desoldered the MCU, took the ends of the rows and the columns wiring them to the Teensy

260099-0

But when it came the time for lighting, nothing is working properly, the backlight is uneven and flickers with keypresses, and the LED lock indicators are on when, for example, Caps Lock is off

260101-1

The keyboard have a color for each row (it's not RGB), so I solder a wire to the side of the row-lighting resistor that have continuity with one of the MCU pins, and solder the other side of the wire to the Teensy

260103-2
260105-3

I don't know what I did wrong, I double checked the pinout and the config.h, here's my config by the way.

Code: [Select]
/* USB Device descriptor parameter */
#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0x0000
#define DEVICE_VER      0x0001
#define MANUFACTURER   teclado
#define PRODUCT         teclado

/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 21

/*
 * Keyboard Matrix Assignments
 *
 * Change this to how you wired your keyboard
 * COLS: AVR pins used for columns, left to right
 * ROWS: AVR pins used for rows, top to bottom
 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
 *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
 *
 */
#define MATRIX_ROW_PINS { C0, B4, F3, F4, F5, F6 }
#define MATRIX_COL_PINS { C2, C1, E0, D4, D5, A4, A0, B2, B0, E7, E6, D6, B1, B3, D3, D2, B6, F7, F0, F1, F2 }

/*Row 0, resistor R132, Pin A1
*Row 1, R131, Pin B5
*Row 2, R130, Pin E4
*Row 3, R129, Pin A2
*Row 4, R128, Pin E5
*Row 5, R127, Pin A7*/

#define DIODE_DIRECTION ROW2COL
#define LED_CAPS_LOCK_PIN C7
#define LED_SCROLL_LOCK_PIN A3
#define LED_NUM_LOCK_PIN C6
#define BACKLIGHT_PINS { B5, E5, E4, A7, A1, A2 }
#define BACKLIGHT_LEVELS 1


And my pinout:

260107-4

Offline nevin

  • Posts: 1646
  • Location: US
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #1 on: Wed, 20 January 2021, 15:32:43 »
... not enough current available from teensy ++2.0?
usually most led circuits have a mosfet or a mosfet array to support the current needed for the LEDs
even if it's segmented into rows, that's still a good bit per pin.

what voltages are you getting on the 1st led closest to the teensy?
then what's the voltage across the last led in the string?
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline andresteare

  • Thread Starter
  • Posts: 39
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #2 on: Wed, 20 January 2021, 16:59:31 »
what voltages are you getting on the 1st led closest to the teensy?
then what's the voltage across the last led in the string?

Do I measure that from the positive side of the LED to ground?

Offline nevin

  • Posts: 1646
  • Location: US
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #3 on: Wed, 20 January 2021, 17:23:08 »
yes. across the led
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline andresteare

  • Thread Starter
  • Posts: 39
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #4 on: Wed, 20 January 2021, 18:09:18 »
yes. across the led

Ok took voltages from positive to negative side of the LED and here are the minimum and maximun voltages in a given row:

R0 (green): 2.14 - 2.53V
R1 (blue): 2.2 - 2.6V
R2 (off): 0,5-1V
R3 (pink):2,2-2,6
R4 (orange): 2,2-2,6V
R5 (red):2 in all of them

Offline nevin

  • Posts: 1646
  • Location: US
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #5 on: Mon, 25 January 2021, 09:15:50 »
without knowing the specs of the leds or the the circuitry in the original pcb... it's a bit of a guessing game.
even though the differences don't seem to be a lot, they are a big difference at these voltages.

you probably need some kind of driver circuit to support all the leds.

there are also a couple ways to connect the leds.
- with pin acting as positive
- with pin acting as ground, driving the positive off of vcc or raw
(again, depends on current draw and the specs of your leds. drive too much current to them and you'll burn them out, not enough and they'll be dim/weak)

do some research into what the teensy is capable of outputting
spec sheet  https://www.pjrc.com/teensy/at90usb1286.pdf

also check the QMK documentation
https://beta.docs.qmk.fm/using-qmk/hardware-features/lighting/feature_backlight
(even through they are on the top, they function as backlight)

example: this is what keeb.io uses to support underglow for their boards (not that this is exactly what you need, just an example)
https://keeb.io/collections/frontpage/products/led-support-components-add-on
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline andresteare

  • Thread Starter
  • Posts: 39
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #6 on: Mon, 25 January 2021, 09:46:34 »
without knowing the specs of the leds or the the circuitry in the original pcb... it's a bit of a guessing game.
even though the differences don't seem to be a lot, they are a big difference at these voltages.

you probably need some kind of driver circuit to support all the leds.

there are also a couple ways to connect the leds.
- with pin acting as positive
- with pin acting as ground, driving the positive off of vcc or raw
(again, depends on current draw and the specs of your leds. drive too much current to them and you'll burn them out, not enough and they'll be dim/weak)

do some research into what the teensy is capable of outputting
spec sheet  https://www.pjrc.com/teensy/at90usb1286.pdf

also check the QMK documentation
https://beta.docs.qmk.fm/using-qmk/hardware-features/lighting/feature_backlight
(even through they are on the top, they function as backlight)

example: this is what keeb.io uses to support underglow for their boards (not that this is exactly what you need, just an example)
https://keeb.io/collections/frontpage/products/led-support-components-add-on

Thank you! I have a lot to research then, can I contact you if I have any doubts in the future? :)

Offline nevin

  • Posts: 1646
  • Location: US
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #7 on: Mon, 25 January 2021, 10:26:18 »
sure.

you probably just need a driver circuit.
might be able to get away with driving them from vcc, through driver circuit, using the pins as the ground to turn the rows on & off
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline andresteare

  • Thread Starter
  • Posts: 39
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #8 on: Tue, 26 January 2021, 15:03:06 »
sure.

you probably just need a driver circuit.
might be able to get away with driving them from vcc, through driver circuit, using the pins as the ground to turn the rows on & off

one of these per row would do the trick?
260567-0

Offline nevin

  • Posts: 1646
  • Location: US
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #9 on: Tue, 26 January 2021, 16:35:18 »
that would be overkill, but on the right track.
...you could probably use that one little board to drive the leds for the whole board.

i wish we knew the specs on the leds that are used in your board... voltage, current draw....
- sometimes different single color leds are driven at different voltages/current.
- i don't think you said.... but what's the brand/model of keyboard you're modifying?

i'll do some digging and see what i can come up with for you.
some info for starters....
https://geekhack.org/index.php?topic=55338.0
from link above:
Quote
Even if you do use PWM, you still need a high current output which a typical microcontroller cannot provide. So again you'd need a buffer or to use some dedicated chip.

and you can read some of komar's explanation of how he was thinking of implementing it in the GH60
http://blog.komar.be/gh60-evolution/
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline andresteare

  • Thread Starter
  • Posts: 39
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #10 on: Thu, 04 February 2021, 21:29:23 »
that would be overkill, but on the right track.
...you could probably use that one little board to drive the leds for the whole board.

i wish we knew the specs on the leds that are used in your board... voltage, current draw....
- sometimes different single color leds are driven at different voltages/current.
- i don't think you said.... but what's the brand/model of keyboard you're modifying?

i'll do some digging and see what i can come up with for you.
some info for starters....
https://geekhack.org/index.php?topic=55338.0
from link above:
Quote
Even if you do use PWM, you still need a high current output which a typical microcontroller cannot provide. So again you'd need a buffer or to use some dedicated chip.

and you can read some of komar's explanation of how he was thinking of implementing it in the GH60
http://blog.komar.be/gh60-evolution/

Ok, I'm going to throw all the info that I think would have a chance of being useful

Brand: Gamdias
Model: Hermes 7 Colors
MCU: Evision VS11K08L, didn't found the manufacturer's datasheet, all I know it's a QFP-48 format MCU (till yesterday my dumbass thought QFP-48 was an IC design and had a datasheet from a Silicon Labs one, I recently realized QFP-48 it's a form factor so I still don't know anything about the MCU lol), I guess I can try contacting the seller to ask for the datasheet.

After hours with the multimeter I identified most pins on the MCU
261472-0

This makes me question the LED circuit as a matrix because there are not much pins left on the MCU to asign LED columns, also, if I can (not greatly) make them work by just wiring a resistor that goes to a transistor conected to ground.

261474-1
261476-2

my guess is that it's not a matrix but a paralel circuit for each row? but after taking a look at the links you provided and checking the pictures of the front side of the PCB I don't see any resistors in that side, though there is a resistor-transistor cluster near the MCU

261478-3

This and seing videos of this keyboard which show that keys can be individually illuminated makes me think "A-Ha! there's the matrix" but there are only 7 pins available in the MCU and 21 columns in the matrix (at least in the keys matrix). Also, the article mentions that a paralel circuit works by putting a resistor for each LED which doesn't look to be the case here. So the matrix circuit seems more possibly to be the case.

I'm dumb, I just realized, while writing this reply that the resistor cluster I mentioned before contains exactly 21 resistor-transistor-resistor groups, which I guess it totally confirms the LED matrix hypothesis. But where do they wire the columns to? There are 7 pins left in the MCU and there is no other IC present in the board. And if it's a matrix, why is it lighting up just by connecting the end of the LED rows?

I didn't take much pictures of the front side of the PCB and I wished I mapped it, but here are some pictures of the front side:

261480-4
261482-5
261484-6

Hope I provided some relevant info, thanks! :)



« Last Edit: Thu, 04 February 2021, 21:38:22 by andresteare »

Offline nevin

  • Posts: 1646
  • Location: US
Re: Need help, uneven backlight on a QMK converted chinese keyboard
« Reply #11 on: Thu, 04 February 2021, 23:18:11 »
with this info, my guess (without seeing a schematic) would be they are driving the columns + with the resistors & fets (21) and using the rows as the - connected to the MCU to turn the rows on and off.
- it's better to drive shorter strands, as you've seen.
- i saw another suggestion to power them at multiple points on the string (row) instead of just the one end. (i'm not sure how you are driving them... + from mcu or -/ground to mcu)
- also the power circuitry can be before or after the led strings, see this for some general info:   http://jumptuck.com/2011/11/07/using-leds-in-your-circuits/

some package sizes to try & determine what size leds are used in the boards: 5050 (5x5mm), 3535 (3.5x3.5mm), or 2020 (2x2mm)

some data sheets:
3528       https://www.iled.com/class/INNOVAEditor/assets/YeniDatasheets/4001-4005-4024-4025.pdf
- you can see on page 4 the different current & voltages for these particular leds change depending on color (use only as a reference)

5050 (RGB)     https://cdn-shop.adafruit.com/product-files/2757/p2757_SK6812RGBW_REV01.pdf
- this is for SK6812 which is a popular alternative for the WS2812B
- this is an RGB led but useful for size specs & current draw info. an RGB draws more power than single color leds as there are 3 elements in an RGB led

what about cutting traces to the pcbs mcu and using the circuitry already on the pcb (resistors & fets) to drive the leds?

and from your measurements and the spec sheets and how it looks like they are driving the leds in columns, i'll bet 2.6v with enough current to drive the leds at 20-25ma per led will be the answer. (6 leds in a column, so 120-150ma per column @ 2.6v) 6*20-25ma

hope this info helps and gets you pointed in a forward direction. you've done a lot of work already. :thumb:
« Last Edit: Thu, 04 February 2021, 23:20:27 by nevin »
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68