Tetrinsic [gd0041]

A motorised, pressure sensitive and haptic feedback slide encoder.

Public Chat
Similar projects worth following
To get the most bandwidth out of the 2 hands I've got, I'm designing a new keyboard "switch" for the input layout (gd0090) I hope I can use for the decades of typing to come.

Finding out about hall effect switches and their potential double-action feature, I started researching double-action switches. Small tactile switches (0.6N, 1.6N) do exist, but from pressing my camera's shutter button, their second actuation force is too high for all but buttons pressed with the thumb. Next, I discovered riskable's Void switches and how the design could allow for adjustable actuation force and doesn't need an electrical connection to the keyboard PCB. Magnets seemed to be quite cheaper than buying 0.8N and 0.5N tactile switches, and allows for LED backlighting because the components needed are smaller.

Ever since I started #Tetent Timespy [gd0136], I came to the realisation that the current solution (5 seperate buttons per finger row) I was trying to obtain was still flawed. As of Sep 14 2022, I've changed the design to centre around a mini BLDC motor connected to a GT2 belt that also acts as the keycap surface. This was inspired by various open source projects (namely the SmartKnob View) and will use the motor and force sensors to simulate different sliders and tactility, as well as make the weight and amount of actuation points software adjustable. The motor is also used to train, as my main questions when learning to type was "Where is the key? What finger do I use to press it?"

I found this video which shows how the slider would ideally perform, just that you can press down on it and it can be set to allow movement "infinitely" in either direction.

  • [T] Tetrinsic as master control

    kelvinAa day ago 0 comments

    I'm currently wondering if I could have one of the Tetrinsics as a "master" IC, instead of requiring a seperate microcontroller for use in #Tetent [gd0090]. The current IC of choice clocks in at a speedy 48Mhz, but the 16K of RAM is a bit of a concern. 

    New Chip

    I went to Digikey to see what other options are out there, and this chip is convinient:

    The M031TD2AE seems to be a 64KB version of the initial chip I found in the previous log. I then looked into the memory sizes of popular DIY keyboard microcontroller choices, and quite a few of them are 32KB, so 64KB should be large enough to upload a full input device firmware. 

    Another cool thing is that it seems that JLCPCB's SMT service has it in stock too. 

    For a 4x4 package, it sure comes with a lot of juicy features. The money saved from omitting the multiplexer has gone straight into a more ideal microcontroller chip, as my ex-VAT chip total is currently £133.

    I've also missed the deadline for the XIAO keyboard contest, so using their microcontrollers is no longer a soft requirement.

    I2C Device Addressing

    Yesterday, I determined that I was going to use I2C as the communication protocol between Tetrinsics. The only concern was how I was going to set the device addresses. 

    Right now, I'm hoping that I can have a "sense" line on the ribbon cable and detect the resistance between the I2C data line or something like that. If each Tetrinsic adds a set ohmic value to the resistance, firmware should be able to determine how far down the daisy chain it is. For example, if 5k resistors are used, 15k resistance detected between the data and sense lines would mean that the firmware gives the current Tetrinsic the 3rd valid device address.

    Further Delays

    Along with now having to learn about the large world of microcontrollers (at least enough to create a working schematic for it) I'm thinking of creating PCBs for Tetent and #Tetent Timespy [gd0136] to save on shipping costs. I'm also thinking of having 1 large Digikey order instead of 2 or 3 seperate ones.

  • [T] Using a microcontroller

    kelvinA3 days ago 0 comments


    So I'm watching VoidstarLabs' new keyboard build and hear about IO expanders and microcontrollers, and so I go onto digikey to take a look, since I've still got concerns about controlling the MP6543 through an expander. What do I find immediately? RP2040 chips that go up to 133MHz for 88p for a MOQ of 1!!

    The issue is that I don't have much board space at all, so the 7x7 package is too large. The current IO expander is a 4x4 package, so I set the relevant filters and found this:

    32 bit. 48Mhz. 16K flash. 2K RAM. Near half the cost of the IO expander:


    No... no... that can't be right. I wouldn't have picked this if the stock quantity was this low... it... it should've been in the thousands or something!...

    Finds a snipaste on the 27th Sep when I first found the chip:

    Wha? There were 5K in stock 3 days ago? Wha... what happened??? So I would've had to recalculate either way????

    Well... I guess I'll start reading the 280-odd page datasheet then... and hope that 490 is enough to stay in stock without beign enought to get bought out by the local factory or something.

    Anyway, I was thinking that the microcontroller could do all the motor control and encoder processing and just ping back to the master every microsecond (1kHz) or so. Every time I think I'm close to having something, I find a new low in limbo (reference to the Limbo Dimension in the Minecraft Dimensional Doors mod).


    I'm looking at the £2.54 EFM32PG22 and it could be an option for a microcontroller with built in 16 bit ADC, but the documentation is too sparce to get an idea of if it's a usable alternative to the £3.79 discrete ADC. The £2.95 MSP430I2020 also exists with 2x24b ADCs, but I can't seem to find the 3 or 4x24b options, nor have I determined if 16 IO pins are enough. It might be, but I'm once again still having troube understanding what its ADC can and can't do. 

    Those are the 2 options that cost less than ADC + M031 (£5.16). The M031 has a 12bit ADC, meaning I can remove the 2:1 switch chip.

    Also, I'm currently reading that strain guages have 10mV of full-scale deflection, so using 16x gain is likely unrealistic for getting usable signals.

  • [M] Direct ADC connection

    kelvinA5 days ago 0 comments

    I was still worried that there were going to be ADC SPI issues with the idea I had last log, and realised that SPI shares all but the CS line. This means that I can cut out the Channel0/1 thing, increase the amount of address configurations to 16 and increase the ribbon cable to 5 lines.

    It should mean that the ADC's can use a faster, 8.192MHz channel and hopefully the ioData line isn't as congested. I just haven't checked if any of the 16 device address combinations are device addresses that are recommended against:

  • [M] I/O Expander

    kelvinA7 days ago 1 comment

    I read through the Ti version of the PCA9555A schematic and it's actually simple to implement, hardware wise. I'm not even sure if I'd need to use the interrupt pin, but even with it, my ribbon cable is only 4 lanes now:
    I might give nSync an IO pin instead of using the serial clock. According to my calculations with a 8.192MHz ADC clock, as long as the serial clock is over 4kHz, the chip will just synchronise and not reset. I can't imagine a situation where holding the pin for over 1/4000 of a second would have any adverse effects, and should facilitate a reset of the chip in a timely manner.

    The reason why I feel that the interrupt may be useful is because of the ADC's "data ready" pin and the motor controller's nFault. Not like it costs money or much space to keep it or omit it, so I'll keep it.

    The next steps are to double check that I've set up the sense pins correcty, see if I can implement suggestions on circuitry for taking ADC measurements and then start creating the custom footprints for the PCB.

  • [T] PCB schematic... fails.

    kelvinA09/25/2022 at 13:17 0 comments


    I just woke up and realised that the next data in or data out signal for the ADC won't be ready by the next master clock cycle.

    I want to make a solution that can take at least 8 daisy chained Tetrinsics. That means I've got 64 bits each way to shift in and out. That's a multiple of 2, so maybe I could install some kind of chip that toggles every 32 clock cycles. Alternatively, I can see if I can swap out a pin for another clock signal. A 3rd idea could be to use oLatch (latch for output pins) as a serial clock.

    I'm also thinking that 1k samples in an actuation window may be more than required considering that high-performance gaming mice poll at 1000Hz (80 samples in an actuation window). I don't know how fast I need position data, but I'll assume 1kHz would have me covered there too. At the end of the day, being too fast would be a nice problem to have.

    The 8 channel ADC is still a bit pricey, and even more so if I opt for the 24-bit option, so I'll stick with the 24-bit triple ADC already in the design. Going from 32ksps to 2ksps would increase my effective resolution from 14.8 to 16.6 bits at x16 gain, with lower gains approaching 17 bits.

    I also need to look to see what pins need pull-up resistors.

    [16:30] The story becomes even more complex now. Apparently, it's somewhat complex to share the 74hc595 and 165 clock pins. I'm going to look into I/O expanders that use I2C. Even with 32.768MHz clock on my initial shift register strategy, the effective signal clock from Tetrinsic's point of view is 512kHz. Thus, I wouldn't need a >1MHz I/O expander for an alternative. Most of the cheap ones are 400kHz by quickly skimming Digikey.

    This seems nice. If this is the kind of product I'm looking for, it'll be +55p on the BOM and it's smaller than 1 singular 74HCxxx, though this only assumes that I can route all the connections with 2 PCB layers. There's also a 3x3 BGA package, and I'd probably use that.

    [17:30] It seems that ony 2 of these can be used on a line.

    The cheapest one that allows 8 addresses is £1.94 and a 4x4 package. It's a bit of a squeeze but it fits.

  • [M] PCB Schematic

    kelvinA09/24/2022 at 19:47 0 comments


    Ok. I've spent the past 2 days drawing up this schematic. It's a good thing that I haven't just press "Buy Now" on anything yet because, as you can see, there are 6 chips and not 5 like in the previous model. The license is going to be under some permissive option but I've just been reading datasheets and connecting the dots so...

    One thing I have learned is the "bypass capacitor" which is 0.1uF (and 1uF and 10uF) as a kind of industry standard. Another notable mention is that I'm going to see if I can get away with the analog and digital input voltages coming from the same source. It sounds like to get any usable-for-high-resolution analog source is going to require experimentation and osiliscopes, so I should just get any PCB out of the door now.

    My chronological schematic creating process in detail is written below.

    Magnet Angle Chip

    Ok that's 1 chip down. 

    Motor Chip

    Is that everything? Wait a second... aren't those Sense pins analog?
    Nouh!! I'll come back to this later.

    ??? Didn’t you say 0.47 a moment ago?

    Hmm. Ok I'll assume the paragraph is the correct one. But nice! There's a 3.3V regulator in this chip, so I don't have to send that power from the MCU.

    Switch Chip or new ADC?

    This sounds like the thing I'd need, but this is seemingly the only option that fits and is under £5 each. What I can do is use this in conjunction with the internal multiplexer of the ADC to switch between Signal+,Signal- and Sense,AGND:

    The issue is that I don't have a free pin on the 595 to controll the switch pin as of now. There's also the option of looking for a new chip. I've found the MCP3561:

    Here's my idea:

    • Strain on channel 0 and 1
    • Swap the aat101 for one of the single-pin versions (like 003)
    • Sin on channel 2
    • Cos on channel 3
    • Sense on channel 4 - 6
    But that's the worst case option.

    A second 595

    By increasing the PCB to 16x16mm, I could get this layout and also have plenty of output pins with the dual 595 chips. That ultrasmall 1.34 is also the only chip that would even fit in that space. 
    HAHAHAH. I'd probably have to buy spares with that kind of size.
    I found this, and it's half the cost as well as being the same sized package as the other chips like the 595. I'm kind of worried about the 120 ohm resistance, but I think the ADC has a much higher impedance anyway.
    This is probably a much less riskier run, and I just had to increase the board width to 20mm.

    ADC Effective Resolution

    Reading datasheet of ADC...

    What's even the point of 24-bit if I'm not even hitting 16 when the noise is added in?

    Adds/Removes components needed for the 8 channel, 16-bit ADC.

    Price is £132.49 for the current ADC and £139.78 for the proposed new ADC.

    But wait. I've got 7 channels I need to scan through and there's only 1 ADC doing the work. That's 

    153600/7 = 21942 samples per second. 

    (Before starting on the schematic, I got some button press numbers. The fastest I could actuate a keyboard press was 0.08 seconds. The last thing I want to happen is that my speed-increasing input device isn't fast enough to keep up. Lets say I want 1000 samples for keypresses for high precision and low latency. That works out to a minimum of 12.5ksps. At this moment, I don't know if I need more or can get away with less samples, so I set that as the target)

    Returning to the ADC, this means I can only use the 32 OverSampling Rate option as 64 would mean I get less samples than the target. Thus, I'd only get 12.6-12.8 bits of data (with the remaining 3ish being noise I assume?).

    Meanwhile, on the current ADC, I can do 32K samples at 128 OSR and get these numbers (1,2,4,8,16 gain)

    There's no 16 bit variant of this current ADC though, which might've saved some money.

    The Clock Signal

    I just realised that:

    • I've got a free pin now that I don’t need to send 3.3v.
    • I can't send the clock pin for the bit shifters via the...
    Read more »

  • [T][M] PCB concept (and project name)

    kelvinA09/21/2022 at 20:12 0 comments

    As you can see, the name has changed:

    This is because it doesn't seem that there's a merge between a linear slide potentiometer and a rotarty encoder, so this device is now just "Tetrinsic". Actually, drop the "encoder" since I my other project titles aren't "#SecSavr Suspense [gd0105] 3D Printer" or "#T^2 Tiles [gd0095] Robotic Wall". Consistency. On the other hand, maybe I should actually be doing that so it's more obvious what the project is. I feel like my project titles would get pretty long if I did that though. Are my hover descriptions not good enough?

    Anyway, the PCB.

    It's a 15.5mm square. JLCPCB will let me have a thickness as low as 1mm whilst keeping the white and the same price, so I've done that. This makes the model 18.85mm thick, so maybe I could get 19.5mm minimum spacing. This assumes that I could use a 2 layer PCB though. For the artistic side, I've decided to have my logo as silkscreen and project name as a plated copper pad. Obviously, this will only work if I don't need traces there. 

    It's pretty close, but there's enough surface space for the 5 chips. I also dug around the datasheets to deduce that the MP6543 needs 4 output pins and the 24-bit ADC needs 5? Looking at the datasheet, I'm hoping that I can have the master clock and the SPI clock connected together, reducing my required output pins to 4. 

    I'm thinking of soldering the 3 sets of flexible cables straight to the 4mm of space on either side, and passive components fit around the available space around the magnet sensing chip. One is the cable from the motor, and the other two are the daisy-chain link cables. One cable (likely the motor) would have to go over another one of the cables to fit. I expect that I'd need at least 4 traces in the cables if I'm able to find a place to solder power wires for the motor.

    [Goes back to JLCPCB]

    Oh nvm as soon as I select "lead free" finishing process, I'm either looking at a decently priced green or 4x for white. That's fine until 4 layers where 15 white PCB's is $77, so I should fully expect to silkscreen everything so that I (hopefully) only need 2. Wait... silkscreen everything? Silkscreen is white, right. How white?

    White enough for my science. Wait, that means that I could totally get "white PCBs with green silkscreen" by just inverting the normal silkscreen. I'll remember that.
    I've also added that signiature greenish beige PCB edge colour.
    Nice, so I can do this and then I can go down to even 0.6mm boards without paying extra, and I can get the board delivered faster. I'll use 0.8mm; with this, 19.5mm spacing should certainly be doable, which apparently is the higher end of the "standard key spacing" specification. I also might not need a case cutout after all.
    I wonder how far off this render is from looking like the "future first proof of concept" now. That was a roundabout way of saying that I think I'm getting close to a design that will actually exist in the real world.


    This is what 19.5mm spacing looks like in the #Tetent Timespy [gd0136]:

    It's going to be pretty close, but I'd be pretty satisfied if I can get this. Actually, I'm somewhat suprised that I can DIY something this unproven yet so professional looking run. I wonder if I should add 3 dots in the top right to make the board look even more advanced though.
    It certainly looks a lot less plain.
    I'll pass because the branding looks perfectly good as is on Tetent.

  • [T] Other uses of Tetrinsic

    kelvinA09/21/2022 at 12:25 1 comment

    Perhaps I should rename "Tetrinsic Switches" to "Tetrinsic Slider", because that's what it is. It's no longer a collection of switches, but 1 motorised slider encoder. I'm using this as an all-in-one input device for #Teti [gd0022], but it's nice to see what other thing I could use these likely-over-£15 sliders for.

    It seems that the main idea for those interested in the SmartKnob View for something smarthome related, so I created a quick concept of what a Tetrinsic smart thermostat could look like:

    The concept uses an 2.8" square display with outter dimensions of 83x60x20mm. I just put something together that looked about right. I don't use smarthome stuff so I wouldn't know if the screen needs to be larger or something. Obviously, similar rotary encoder interfaces (like microwaves and FDM 3D printers) would be something similar looking to the above.

    If you can fit it, it could be a scroll wheel in a custom mouse.

    This was the design of the Thaxis mouse without the joysticks and with a Tetrinsic slider where the thumb rests. It's a vertical mouse design. It became #Tetent Turntable [gd0038] and eventually #Tetent [gd0090]. I wanted to put a motorized scroll wheel on here, but at the time, I was thinking of a nema 14 stepper motor.

    It could be a physical extension of a software synth.

    Just imagine fewer of these, more spaced apart and shorter. Unless you've got the budget and the sliders above are >20mm apart from each other, then it's just shorter.

  • [R] Sourcing chips

    kelvinA09/21/2022 at 11:53 1 comment

    Yikes. This took 8 hours to curate. At least now I know I'm creating a switch that's likely to be >£15 per each. Considering that many ergo keyboards, the Twiddler3 and the Charachorder all cost north of £150, this isn't too terrible. Behind the monitor, the input method is probably the second most important part of a computer system.

    It started with looking for a TMC6300 alternative.

    Since I need a proof of concept ASAP and didn't want to have to spin up a custom board just to try things out, I was hoping that there was something in a larger package that I could use. Long story short, there is not. Options like the STSPIN233 (a newer version of the STSPIN230 that has 3 sense resistors instead of 1) and the MP6543 seen in the parts list above all use the QFN package. I didn't find the MP6543 until much later though, and I'll get back to it. When I started sourcing, the STSPIN23x chips were the only ones I could find on AliExpress. Thus, I was like "well since the package is 3x3mm, maybe a bunch of the other chips I need are similar in size and I could fit all the circuitry on the same PCB.".

    Next was the serial in -> parallel out.

    This was straightforward. It's the 74HC595. It has a serial out so I can daisy-chain them. The microcontroller board I'm planning to use only has 11 pins, and even if it had more, I don't want to do what I did 2 years ago for the #T^2 Tiles [gd0095] where I'm searching up and down AliExpress for a microcontroller with the required amount of pins. This chip increases the amount of digital out pins without needing to increase the physical amount of pins.

    I also looked at 16 bit registers but QFN ones cost much more than 2x8 bit.

    After that, the ADC.

    Seems that nothing comes close to the cost:features of the HX711 (and smaller HX710), but "aw, they don't have my size.". The bigger concern was the sample rate. The 710 only does 40Hz and the 711 does 80Hz. This is probably fine for a weight scale, but probably not for an input device on the fight against QWERTY. 

    I did some searching, found a 16 bit chip, read this article that recommended 24 bit and found went for the 24 bit version of the chip that costs 50p extra each IIRC. The chip is called MCP356RT-E.

    Now, the magnetic angle encoder.

    This is the only one that has to be small, since it's going to be at the end of the pulley gear and there's really not a lot of Z height. Testimonials from scottbez1 and others that typed Reddit comments made me aware that the AS5600 was probably going to give me issues anyway.

    Issue is that the cheapest QFN I could find was the AS5050A, which was a >£6 chip. Yeah, now that I've got a rested pair of eyes I can see an encoder chip right next to the AAT101 I decided on, but even so, it's not as ideal.

    This is what the AAT101 looks like inside:

    Now, I was looking at that and thinking "hmm didn't quite a few 24 bit ADCs come with more than 1 channel?"

    So I got a more expensive, 3 channel ADC.

    It's the ADS131M03. Now I can use all channels of this chip instead of 1 out of 2 on the other one, and I get 24 bits of absolute encoding inststead of 10 bits for the 6-quid-something chip or 12 bits for the MA782GGU. That's also 1 less seperate sensor I need a connection to the serial IO for. It just costs £1 more.

    Then deciding on the STSPIN233 or the MP6543.

    The MP6543 is cheaper than the STSPIN233 which is cheaper than the MP6543A. For hours, I couldn't understand what the PWM in the 6543 was for; was it just a signal in like the 233, or was the PWM telling the chip how to configure the bridges (eg: low pwm = low bridge...).

    I eventually looked at the SmartKnob code, which lead me to the SimpleFOC docs, where I saw 3PWM and 6PWM. It seems that they're just 2 different ways of controlling BLDC motors, and 6PWM has likely been chosen in the SmartKnob View PCB because the TMC6300 is...

    Read more »

  • [R][M][P] Sensors and drivers

    kelvinA09/18/2022 at 17:19 0 comments

    There actually isn't that much space at all for the strain sensors. The smallest that will fit in the new space I've provided (blue face) is the one below, which comes in at 6x7mm:

    It's questionable if the part would even flex in a usable way, since I fear that the 3mm section will bend an unacceptable amount. Ideally, I want to sense up to 240g of force. Fusion360's simulation keeps giving me an unknown failure message so I can't get any data that way. 

    While small, it does seem to be perfectly FDM printable. I'm printing it out now.

    I might "mirror" this idea because the M2 countersunk screws are now right next to the belt:

    In other news, it looks like I'm going to have to abandon the idea of using 2 hall effect sensors instead of an absolute magnetic encoder due to this research I found.

    I've also been looking at my options instead of the TMC6300. The only reason why I started looking around was because of the tiny 3x3mm package, but it seems that I can just fry the board on a pan of sand:

    Anyway, a more important reason to look for alternatives is because my human eye can only see Out Of Stock for the TMC6300-LA and the DRV8311 from Ti I also found. The STSPIN230 looks to be an option. While it's still in the same 3x3mm package, I can get it on alixpress for under £3 a chip.

    Oh, nice the print is done.

    The PLA is quite a bit stiffer than I expected, so perhaps this will work fine. That or it doesn't flex at all and most of the bending is exerted through the top plate of the switches. PETG should be around about 2/3 the stiffness of PLA.

    Hm... wait couldn't I just...

    [some minutes later]

    Yeah. Now everything's 1 piece not 3 and I've now got 6x10mm of area for the strain guages, which increases my options a bit. It seems that a 7mm wide area would be ideal though, which would require me to increase the overall key length to 34mm. 

    - Length increased
    - Keycap_Flat length increased from 24 to 26mm.
    - File repaired
    - Belt length: 97.58mm
    - Recommendation: Reduce belt length to 96.5mm to use a 96mm belt.
    - Implemented changes to Tetent [gd0090] concept without conflicts.
    -- The new length (106mm) does not propose a conflict in Teti [gd0022].
    - The changes can be implemented into Tetent Timespy [gd0136] without 
        expected conflicts.
    - The increased length of the Tetrinsic Switch [gd0041] is expected to 
        increase ergonomics for larger hands.

     Ok everything checks out it seems. 

    This one barely fits, but now I'm realising that these are some expensive strain guages. Here are some 7.1x4.5mm strain guages for a fraction of the price:

    [Some research later]

    Ok I've read and, with the way I'm straining the key, I only need 2 mounted in the area. The other two need to be nearby to account for temperature differences. Ideally, I'd have whatever sensor's in this:

    Considering I need to accurately sense grams of force and not just when someone has pressed hard enough, I'm more inclined to go with the more expensive but full-bridge circuit.
    The issue is that the only ones I can find start at 8mm width.

    [some more research later]

    Right... I could stick the green strain guages to each of the two beams and have the other two somewhere else that doesn't flex.

    okay... I don't think I have enough space for that. At least I now know what the shape is for.

    Second print

    Ok I've printed the keycap and tried to put a GT2 belt over it. I'm now going back to the 24mm keycap-flat length so that I can get a larger radius on the edges. I've also been able to try out friction of the belt on plain PLA. It's much more resistant than fingernails, but feels much more consistent when transitioning from fingernail to fingertip. The GT2 gives a dependable grip to my fingers that I've only somewhat experienced...
    Read more »

View all 17 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates