Skip to content

A DIY hybrid piano without ADCs (purely digital sensors)

Star_catcher

DavisB If the video indicates that magnet sensor works, does digital hall effect sensors that directly return velocity and directions can be used instead for minimal software mantainance and system complexity.

A few sensors I looked at: TLE5012B, TMAG527, AS5047P, ATS19520


DavisB

Star_catcher

TMAG5273 is a low-power linear 3D Hall-effect sensor with IΒ²C interface.
Have you ever talked to 88x I2C devices at once over a span of roughly 1meter at the bare-minimum necessary 10ksps per sensor sample rate? Incl. but not limited to converting the 3d position(s) to velocity?

If not, where does your ideas about "minimal software maintenance" and "minimal system complexity" come from? LLM? πŸ™‚

P.S. This conversation is over. Make a seperate thread.


DavisB

DB5.2 Ultra
The minimalist cheapest cost-optimized mid-range MIDI-controller for analog sensor systems.

  • Perfect 20 kHz scanning rate
  • Up to 96 keys (each FFC connector is up to 24 keys each)
  • Real time display of all 96 sensor readings at strict 48 frames per second (with perfect frame pacing)
  • USB 1.1 MIDI with no added latency (apart from USB 1.1 1ms).
  • Works with both hall effect sensors, reflective optical phototransistors, etc.

Single STM32G474. 5x ADCs (all used!). 128 KBs of total SRAM (currently ~ 70 KBs used, and 58 KBs free SRAM). Flash use 31 KBs (481 KBs of free flash).

Still plenty of unused computational resources left on the table. For example, it can handle 30 kHz scanning rate also, BUT it is entirely bottlenecked by analog value setting time after hc4051 mux switches.

(experimental isomorphic instrument, here only 80keys, 20 per cable, hall-effect), multiple of these boards can be chained into main board (isomorphic instruments like this require lots of keys usually as they are duplicated).

But this also works perfectly for traditional digital pianos (after all the principles are all the same).

AI use disclaimer: this product uses zero LLM generated code or outputs of any kind


DavisB

There's one aspect of this that kind of completely blew my mind.
Namely, that a single 170mhz Arm Cortex M4 of STM32G474 can render all 96 graphs on a 320x200x16bits per pixel screen at 48 frames per second, rerendering the whole screen every frame (6 megabytes per second of bandwidth just updating the screen).

While at the same time scanning all the 96 sensors at 20kHz (using 5 ADCs) AND handling USB MIDI events at the same time. While adding strictly speaking almost no latency whatsoever (microseconds at worst).


I didn't think this would be possible, but with a little bit of careful programming, it is!

Since each sensor is 20000 samples per second, and screen is 320pixels wide and updated at 48fps, you get to see 15360 of those samples in real time πŸ™‚

This is what most of SRAM is used for 96sensors x 320samples x 2bytes per sample = 61.44 KB sample history memory


DavisB

Some other tidbits:

  1. These FFC cables can be bought in all sorts of sizes in 600mm and up to 1 meter in length (these sizes however, are way less common and tricker to source). Important for 5.5" and 6.0" octave pianos.
  2. The board is tiny 4layer 50mm x 50mm, and the board is drawn in a rather obsessive manner to avoid anything digital coupling into analog side. For example, on FFC between every analog signal, there's a ground wires on both sides, etc. And the overall analog signal is very, very quiet.
  3. Most noise in the readings in the isomorphic instrument version here comes from dirt cheap chopper-stabilized hall effect sensors (this helps with temperature drift, and zero-offset variability in hall-effect sensors, needless to say, there are better hall-effect sensors on the market). So the noise doesn't come from the main board ADC (which is dead quiet in comparison)


The board next to my old dusty Teensy 4.1 (which I don't like using, because it's way too expensive, too powerful, has some weird bootloader/DRM and using it with Arduino HAL is throwing away 90-95% of performance of the thing anyway πŸ™‚)


DavisB

Newest "product":
Piano Factory Control Board

  • Up to 6 stepper motors (12V-24V)
  • 4 mosfets (for inductive loads, controling solenoids, relays, and vacuum pump DC motor, etc, up to 24V 3A if I recall)
  • 5 inputs (endswitches, etc)
  • Control via USB or UART
  • I2C OLED or SPI screen connector (I2C will be used for pressure sensor)
  • 6 large keyboard mech switches for user control.
  • rp2040 devboard as main MCU.

For automatic measurement, calibration, assembly tasks, etc.
A more sane approach is to leverage existing 3d printer mobo for this, instead of DIYing, but... where's the fun in that. πŸ™‚

The only woopsie I did with this is that GRBLhal rp2040 core expects slightly different step/dir pin arrangement to what I'm using here (it's an easy fix, but for easier GRBLHal porting requires reordering another pcb rev). Outside of that it works perfectly πŸ™‚


scherbakov.​al

I once added Wi-Fi control to my CNC machine. It’s actually quite convenient when paired with a lightweight wireless keyboard.


DavisB

Yes, various esp32s work great as wireless UART bridges and such.
I use this bluetooth gamepad for remote control of CNCs:

Feasibility testing & experiments of 3d printing various NarrowKey piano parts.
Currently short pivot folding types and related parts.

Its so much fun!
All these tiny parts with these tiny intricate details. Tiny weighted hammers, etc.

Is 3D printing a "good feeling"narrowkeys feasible? I don't know yet, but so far I haven't run into any problems (except for 3d printing being inherently very slow process... but that "problem" has a very boring solution πŸ™‚).

There's something very satisfying about making these little tiny test pieces (and I'm learning), like lego / meccano pieces you screw together and customize - what happens if I add a spring to the action, what happens if I move it a little bit there - how does that change the overall feel of the action, etc.


DavisB


The white part here is roughly 10gs of PLA, and takes roughly 25mins to print on Bambulab A1.
For a whole set of 88 keys - roughly speaking - 25mins x 88keys = 2200mins = 36.7 hours of nonstop printing.

It appears that the fancier printers (H series, X series etc) don't actually move the needle that much, usually somewhere around 20% speed improvement. But for this particular piece - it takes 25mins down to 22mins (changing printer from A1 to H2S/H2D or X2D in Bambulab Studio on same quality settings). 36.7->32.2 hours or so.

There's some other tweaks, like changing nozzle from 0.4mm -> 0.6mm and such, but they are still relatively marginal improvement.

The boring solution is that the printing speed (throughput) scales linearly with numbers of printers.
So 1x A1 (250eur) to 4x A1 (1000eur) brings down printing time 36.7hours -> 9.16hours.

The prototype here has a pivot length of 178mm. Pivot length of Kawai MP11 is 240mm. So large pivot key does fit on a print bed of 256x256mm area printers (A1, P1S, P2S, X2D) without printing on the diagonal.


Max size if printing on the diagonal (the 180mm plate is A1 mini).

That's why print farms generally speaking - spam A1(250eur) and P1S(370eur) - they are cost efficient - and reasonably reliable - hands-off fire & forget type of printers.

If it turns out that ASA/ABS (or other fancier engineering materials) is an absolute necessity, X2D seems like the perfect fit - dual nozzle, heated chamber (important for consistent prints), better air filtration system, and will print pretty much any material you throw at it and just 630eur. Getting 4x multiples of a pricier printer is admittedly less fun.

P1S can also print ASA/ABS, but without heated chamber getting consistent prints is probably significantly tricker and more involved process?


DavisB

The attentive among you might have noticed use of ball bearings in this 3D printed prototype model.

It started off as a joke - "ha, what if every DP hammer uses a ball-bearing?" and ended up as permanent fixture in my designs.

Both DB5.2 Max and DB5.2 Ultra narrow key pianos make extensive of bearings for consistent "zero" friction.

It isn't just about performance though, manually gluing in felt bushings on every axle is labour intensive (and not fun) compared to press fitting a bearing.

And as the dimensions of wood change (or 3d printed plastic) and as felt wears down, so will - if ever so slightly - the friction. This does away with this.

The wooden key action DB5.2 Max uses 88 x bearings for hammers.

And the new DB5.2 Ultra - will likely use 88x2 = 176bearings. One for the Hammer and one for the Key.

That is a LOT of bearings! And it feels is very premium.


CyberGene

DavisB I have always thought that modern plastic piano actions should use either ball bearings or epicycloidal profiles to prevent wear. Felt and wood are naturally good at minimizing wear. However, as a result acoustic piano actions also have some friction which is desirable because it prevents uncontrolled rebounds. Will you account for this when you start using ball bearings?


DavisB

@CyberGene
Modern mass-market plastic piano actions have way less reasons to use ball bearings than I do.

These injection molded plastic parts can have very high tolerances (think Lego pieces from ABS) and very smooth surfaces, and in combination with the right grease, they appear to have very low friction. Especially if you make some parts out of slippery self lubricating plastic like POM, etc.

I still use felt in my designs (just not in the 'rotating'/radial load parts so to speak)... I have to!

I spent quite a while trying to figure out how to squeeze in a thrust bearing in a very-very limited space (I tried all sorts of stupid ideas!), and nothing has worked as well as the good-old felt bushing.

The beauty of the felt as the thrust bearing is that it's springy and self-centering - which works surprisingly well for shitty drifting, wood working-tier +/-0.1mm to +/-0.2mm tolerances.

Which are also the tolerances of FDM 3D printing!

Felt's essentially a springy thrust bearing. I sure want to replace it with something else, but thus far I haven't found a better alternative.


« Previous Page