Author Topic: Handwired Rotary Encoder/microcontroller help.  (Read 749 times)

0 Members and 1 Guest are viewing this topic.

Offline vanquishings

  • Thread Starter
  • Posts: 14
Handwired Rotary Encoder/microcontroller help.
« on: Wed, 10 February 2021, 17:03:48 »
Hey there,

Working on my first handwired build, and need some help with a microcontroller recommendation.

My build has 5 rows, 20 columns, and will be utilizing a rotary encoder. If my research is correct, I'll need a microcontroller with 27 digital I/Os for everything.

Is there a microcontroller that offers that many while also being USB-C? If it's compatible with VIA, that would be a plus, as well. QMK seems a little daunting as a total noob to this kind of stuff.

Any help or recommendations are welcome. The wiring/soldering seems like the easy part.

Thanks in advance!

Offline nevin

  • Posts: 1109
  • Location: US
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #1 on: Wed, 10 February 2021, 17:25:53 »
teensy ++2.0 would be 1st suggestion. (but not usb-c). very common for diy handwire boards, plenty of i/o and fully supported in QMK
if you got a little creative with the matrix you could probably do with a promicro (again, not usb-c) or one of the usb-c variants like the Elite-C
there's also the proton-c

and don't forget about the Postage-Board which was built specifically for handwired boards. attaches to the bottom of 3 switches. shop around you may find someone has some in stock.

read gipetto's info about how to setup a "crushed paper matrix" as a way to save a couple i/o pins

some good handwire articles
https://geekhack.org/index.php?topic=87689.0
https://deskthority.net/viewtopic.php?f=7&t=6050&start=
https://deskthority.net/viewtopic.php?t=1067

i could help you if you get stuck on the firmware part as well as VIA support (i've added VIA support for a couple one-of handwire boards), when you get to that point.
for VIA compatibility, the biggest thing is that the controller has a writeable EEPROM
« Last Edit: Wed, 10 February 2021, 17:30:00 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

Offline vanquishings

  • Thread Starter
  • Posts: 14
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #2 on: Wed, 10 February 2021, 18:11:05 »
teensy ++2.0 would be 1st suggestion. (but not usb-c). very common for diy handwire boards, plenty of i/o and fully supported in QMK
if you got a little creative with the matrix you could probably do with a promicro (again, not usb-c) or one of the usb-c variants like the Elite-C
there's also the proton-c

and don't forget about the Postage-Board which was built specifically for handwired boards. attaches to the bottom of 3 switches. shop around you may find someone has some in stock.

read gipetto's info about how to setup a "crushed paper matrix" as a way to save a couple i/o pins

some good handwire articles
https://geekhack.org/index.php?topic=87689.0
https://deskthority.net/viewtopic.php?f=7&t=6050&start=
https://deskthority.net/viewtopic.php?t=1067

i could help you if you get stuck on the firmware part as well as VIA support (i've added VIA support for a couple one-of handwire boards), when you get to that point.
for VIA compatibility, the biggest thing is that the controller has a writeable EEPROM

Thank you so much for such a thought out reply! Exactly what I was looking for. I was actually looking at the Teensy++ as well as the 4.1, but that's probably a bit overkill. I don't necessarily want USB-C for it's capabilities just as much as I'd like it for ease of use on my desk when I swap out other keyboards. Would it be unthinkable to run a female USB-C to micro USB adapter into the teensy?

The crushed paper matrix seems very interesting. I could probably min/max things a bit by utilizing it, but I think for my first build, I'll keep things simple and straight just to avoid further complicating my smooth brain mind. :P

That being said, the postage board looks perfect for a numpad project I've got in my head. Figuring out the best way to keep the USB port sturdy enough to plug into is a headache, and the PB using three switches is ingenious.

I appreciate the offer for help on QMK, I'll keep that in mind when I start to wire things up. Biggest hurdle now is just knowing what I/Os to avoid on the microcontroller. Seems like anything other than GND, VCC, AREF, and RST can be used for columns/rows. Is that correct?

Again, thank you so much! I really appreciate the help!

Offline nevin

  • Posts: 1109
  • Location: US
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #3 on: Wed, 10 February 2021, 18:22:11 »
stay away from the teensy 4's. they're not supported in qmk yet. (different processor)

yes, you could probably do the port mini or micro to c via a little pigtail, very common to use a pigtail or daughter board with handwires to relocate the external connection.

since this is your 1st build. i'd highly suggest the teensy ++2.0. no crazy matrices, and plenty of pins, dedicated flashing application, EEPROM, fully supported, etc... (can't go wrong!)
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 vanquishings

  • Thread Starter
  • Posts: 14
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #4 on: Wed, 10 February 2021, 19:36:57 »
stay away from the teensy 4's. they're not supported in qmk yet. (different processor)

yes, you could probably do the port mini or micro to c via a little pigtail, very common to use a pigtail or daughter board with handwires to relocate the external connection.

since this is your 1st build. i'd highly suggest the teensy ++2.0. no crazy matrices, and plenty of pins, dedicated flashing application, EEPROM, fully supported, etc... (can't go wrong!)

I'm glad I mentioned it! Sounds like the ++ is the way to go and just find a way to adapt it into USB-C.

Thanks for the help! Sets me on the right track.

Offline nevin

  • Posts: 1109
  • Location: US
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #5 on: Wed, 10 February 2021, 19:56:00 »
here's one might take some digging to find at another retailer

or get a usb-c breakout board
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 vanquishings

  • Thread Starter
  • Posts: 14
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #6 on: Wed, 10 February 2021, 20:27:12 »
here's one might take some digging to find at another retailer

or get a usb-c breakout board

https://www.adafruit.com/product/4090

Something like this seems like a good call. That way I could just buy a cheap mini USB cable and do a custom length.

Getting beyond crafty, now!

Offline nevin

  • Posts: 1109
  • Location: US
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #7 on: Wed, 10 February 2021, 20:46:16 »
Could wire jumpers instead of using the onboard mini-b connector on the teensy to go to the usb-c breakout
« Last Edit: Thu, 11 February 2021, 04:34:10 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

Offline vanquishings

  • Thread Starter
  • Posts: 14
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #8 on: Thu, 11 February 2021, 17:11:35 »
Could wire jumpers instead of using the onboard mini-b connector on the teensy to go to the usb-c breakout

Probably just gonna keep it simple for this one and just use the breakout or maybe just the adapter.

Quick follow up. What's the best way to hold the microcontroller still? I assume you don't want to just glue it to the bottom plate or lay it under the key switches. That seems like a good way to accidentally short something.

Or is it that simple? What do most people do?

Offline nevin

  • Posts: 1109
  • Location: US
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #9 on: Thu, 11 February 2021, 18:49:06 »
very few of the microcontrollers have mounting holes, so you can hot glue it under switches or the bottom of case or make a mounting clip/holder into the case if your 3d printing something.

if 3d printing, look around, someone may have already modeled a holder
something like this (for promicro)
or this, developed for promicro & trrs jack for dactyl-manuform builds

i also thought about incorporating header pins or the sockets keeb.io sells into the print for the plate so that the matrix was one piece with the plate and the controller could be socketed/removable.... just a thought.

btw, keeb.io also just recently added their own usb-c breakout board

not a secret.... i'm a big fan of keeb.io (extremely good, budget boards & parts)
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 vanquishings

  • Thread Starter
  • Posts: 14
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #10 on: Thu, 11 February 2021, 19:00:58 »
very few of the microcontrollers have mounting holes, so you can hot glue it under switches or the bottom of case or make a mounting clip/holder into the case if your 3d printing something.

if 3d printing, look around, someone may have already modeled a holder
something like this (for promicro)
or this, developed for promicro & trrs jack for dactyl-manuform builds

i also thought about incorporating header pins or the sockets keeb.io sells into the print for the plate so that the matrix was one piece with the plate and the controller could be socketed/removable.... just a thought.

btw, keeb.io also just recently added their own usb-c breakout board

not a secret.... i'm a big fan of keeb.io (extremely good, budget boards & parts)

I noticed the lack of mounting holes. I'd assume you wouldn't want to just tape it to the bottom plate. I'd want something more sturdy, but I feel like any of the components touching aluminum is a bad idea. Maybe put some kind of pad between the MC and the plate just as a rinky dink method to to test everything before final assembly.

I'm well versed in keebio! I'm holding my breath for a Levinson PCB restock for a macropad.

I'll bookmark that breakout board, I just bought that one I linked from ADAfruit. If that doesn't work, I'll look at the keebio verison.

So there's nothing to worry about putting the MC on the bottom plate? That's a relief.

Offline nevin

  • Posts: 1109
  • Location: US
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #11 on: Thu, 11 February 2021, 20:39:57 »
Yes, as long as it's isolated (no shorts), if your using an  aluminum case.
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 xudongz

  • Posts: 33
    • Personal Site
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #12 on: Thu, 11 February 2021, 20:50:46 »
Whether an aluminum can cause a short depends on the aluminum. Anodized aluminum for example is not conductive.

Instead of thinking of it as 5 rows and 20 columns, you can probably route it into 10 rows and 10 columns (5 rows on the left, 5 rows on the right). In such case you'll only need 22 GPIO.
SliceMK | ErgoDox Wireless group buy running until March 5, 2021

Offline vanquishings

  • Thread Starter
  • Posts: 14
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #13 on: Thu, 11 February 2021, 21:06:54 »
Yes, as long as it's isolated (no shorts), if your using an  aluminum case.

Gotcha. Might go acrylic on the bottom, or just tape the MC down and glue the adapter just to be able to have the freedom to move the MC/tinker with wiring, if need be.

Whether an aluminum can cause a short depends on the aluminum. Anodized aluminum for example is not conductive.

Instead of thinking of it as 5 rows and 20 columns, you can probably route it into 10 rows and 10 columns (5 rows on the left, 5 rows on the right). In such case you'll only need 22 GPIO.

Interesting! I was considering giving the rough aluminum a few coats of spray paint/clear coat or perhaps even cerakote just to give it a nicer look.

Any benefit to the crushed paper matrix other than saving IOs? I really don't mind using a larger MC with this build, it's already a larger keyboard, and I'm not too concerned about space under the hood.

At least assuming I can figure out with IOs I can use on the teensy and which I should stay away from.  ;D

Offline xudongz

  • Posts: 33
    • Personal Site
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #14 on: Thu, 11 February 2021, 21:44:32 »
Definitely worth looking into whether the specific aluminum finishing process will make it non-conductive. Worst case scenario, you can use a sheet of paper to prevent shorts.

Needing 22 GPIOs lets you use the Proton C (with USB C port) that someone else linked. However optimizing for GPIOs used can get messy really quick on handwired builds.

It's also worth considering the time/money investment of designing a PCB. It's reasonably affordable with lots of prototype manufacturers like JLCPCB. If there's a schematic problem, it's reasonably straightforward for strangers on the internet to spot the issue. A lot more can go wrong in a handwired build. The pins for rotary encoders tend to be fairly closed together and you wouldn't want physical keyboard movement to cause a short there.
SliceMK | ErgoDox Wireless group buy running until March 5, 2021

Offline vanquishings

  • Thread Starter
  • Posts: 14
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #15 on: Thu, 11 February 2021, 22:07:38 »
Definitely worth looking into whether the specific aluminum finishing process will make it non-conductive. Worst case scenario, you can use a sheet of paper to prevent shorts.

Needing 22 GPIOs lets you use the Proton C (with USB C port) that someone else linked. However optimizing for GPIOs used can get messy really quick on handwired builds.

It's also worth considering the time/money investment of designing a PCB. It's reasonably affordable with lots of prototype manufacturers like JLCPCB. If there's a schematic problem, it's reasonably straightforward for strangers on the internet to spot the issue. A lot more can go wrong in a handwired build. The pins for rotary encoders tend to be fairly closed together and you wouldn't want physical keyboard movement to cause a short there.

Thanks for the follow up. The more tips I can get, the better! Interesting that even paper would be enough. I was just planning on using a little piece of foam or something. Once I do one, I'm sure I'll be able to figure out the best place to park the microcontroller, but I'm hesitant to hot glue anything down until I'm sure. The adapter is one thing, but I like options when it comes to the MC.

I'm more than fine with the Teensy++ on this one. I'm pretty experienced with soldering, so oddly enough, that's the least frightening part of this build. QMK is way more intimidating. Haha.

Also, I'll be utilizing these for the encoders: https://www.thingiverse.com/thing:3770166 , so hopefully wobble is minimal, and they'll be sitting a bit proud above the plate to make it easier to manipulate the knobs and so they're not as deep in between the plates. Less to wobble into. Or at least that's what I'm hoping!

I'll have to look into custom PCBs. I was under the impression it wasn't worth the effort, and often had multiple for the minimum order requirements.

As I mentioned, I really do appreciate the help. Nice that there's helpful strangers out there such as yourself!

Offline nevin

  • Posts: 1109
  • Location: US
Re: Handwired Rotary Encoder/microcontroller help.
« Reply #16 on: Fri, 12 February 2021, 09:16:49 »
nice find on the ec11 adapters.
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