Skip to content

Build your own hybrid piano - step three, the electronics

RIP

If you haven't already seen step two or one, rectify that before continuing…

So for the electronics you have again many options. First, you have to decide which sensors and where you place them. If you made it this far, you don't need me to tell you what to do… but I would mention that you may have the sensors measure the hammers, the keys or both (the latter is my choice). There are many kind of choices you have for sensors. Probably you will not want contact one, so either optics or hall effect will be your choice. The latter are discussed in https://pianoclack.com/forum/d/238-another-diy-controller-project whereas the former are discussed at https://pianoclack.com/forum/d/243-diy-piano-sensors -- More details on the sensor comparison here

If you go "optics", like I am doing, you have two main avenues: comparators, like the original Cybrid; or ADCs like piano-conversion. The ADCs will give you more flexibility, the comparators might be easier to design and build fast enough. However even a cheap Raspberry Pi Pico has an ADC which can run 500ksample/s (and could be multiplexed among up to 3 channels, giving 166ksample/s per channel). Not that I am advocating using that board: too many are needed, a nightmare to track them and having them talk with each other…. Other boards have much better ADCs, are only marginally more expensive (per channel), and provide either many more bits (16 bits) at a marginally faster 700ksample/s (to be dived by many more channels, though) or they can be configured with the same bit depth as the Pico (12 bits) and provide much faster total data rate. In any case the lower bits of the ADCs are garbage anyway, so the 12 bits of 16-bit ADC in the ST board might be more usable than the 12-bit of the Pico (which has only about 9 usable bits, as described in its datasheet).

The easiest thing to do with the ADC data is to have comparators in firmware (on each ADC boards, not on the controller as I did merely for testing purposes) and trigger MIDI note-on and note-off at appropriate levels. As needed, the firmware may do other things with the data, which would be very difficult with the hardware comparators. A possible "middle ground" alternative would be to use a DAC as the reference for the comparators, rather than a fixed voltage set by potentiometers as the original Cybrid did.

Stay tuned for more!


RIP

RIP but I would mention that you may have the sensors measure the hammers, the keys or both

And by "measuring the hammers" you can actually sense the shanks rather than the hammers themselves, which have advantages and disadvantages:

  • shanks are all on the same level, hammers in the bass are higher
  • the hammers have to hit something which could be the sensor or a "screen" or something else…
  • close to the flange the shanks move much less vertically than close to the hammers, so more accurate electronics (and darker area) are needed
  • close to the hammers the shanks are much thinner and need a corresponding thinner sensor and more accurate placement and tighter tolerance

I have not finished making my decision, but I am leaning towards sensing the hammers directly, as I will explain when I will have finished my tests. Meanwhile, you can read some discussion about this issue at http://forum.pianoworld.com/ubbthreads.php/topics/3175226/sanding-hammers-weird-question.html (again, wish we had professional technicians here…)



vagfilm

Glad to see this coming along. Nice work...
Two questions: do the hammers need to come that close to the sensor? At this moment it is not calculating velocity, correct? Only note-on event at unknown velocity? And you need to get some 10 dollars speakers to that poor laptop...


vagfilm

In the above post, I meant "coming along" not "coming alone"... Darn phone corrector...


MacMacMac

vagfilm In the above post, I meant "coming along" not "coming alone"... Darn phone corrector...

That "darn phone corrector" must have a sibling "darn web site re-corrector" … because your post says "coming along". 🙂


Johnstaf

Very impressive. I'm still considering something like this for my piano.


vagfilm

MacMacMac That "darn phone corrector" must have a sibling "darn web site re-corrector" … because your post says "coming along". 🙂

I am not going to admit that reading without glasses played a trick in me (or use the age card), and going to blame the admins, Google, Xiaomi, cosmic radiation, covid, and who else is out there. 😊


RIP

vagfilm Glad to see this coming along. Nice work...

Thanks. Stay tuned, more is coming 😀

vagfilm Two questions: do the hammers need to come that close to the sensor?

I plan to place a piece of (probably 3D printed) plastic in front of the PCB with small holes in front of the sensors. Have to decide if the sensors will be flush with this plastic (unlikely) or recessed, and in the latter case by how much.

vagfilm At this moment it is not calculating velocity, correct?

At the moment I implemented the comparator algorithm velocity = distance / (time-hammer-passed-point-A - time-passed-point-B) with all variables settable via MyTechnician (TM), a MIDI-based regulation tool which I am writing right now (current number of lines of the software: 3 😅)

I think this section makes it clear: https://github.com/davidedelvento/Mybrid/blob/main/RaspberryPiPico/pico-piano.c#L460-L499

vagfilm And you need to get some 10 dollars speakers to that poor laptop...

That is my "disposable" laptop, bought in 2006, you should be amazed that I am still able to run stuff on it. I'm surprised that you did not complain about the super-loud fan, which I hardwired to always go at full speed since the temperature sensor died 🤣
I prefer using that one when doing things which could "fry" the electronics (which this obviously isn't, but then switching back and forth between the disposable one and the good one is a pain, so…..)

vagfilm I am not going to admit that reading without glasses played a trick in me

Well, I am. To do all that soldering, I needed to use old telescope eyepieces used as microscope. Really amazing how well you can see with that setup.