Skip to content

Another D.I.Y. Controller Project.

vagfilm

Hi xoorx: if I was a smarter, I would also be playing around with magnetic sensors. You probably need to put a small magnet below each key (or maybe every 5 keys...) oin order to reduce all other sources of magnetic fields surrounding the keyboard. Calibration before each use will be mandatory and tricky (maybe using a magnetoelectric element that is only active during calibration, and calibrating through triangulation like GPS), but if it works it will be a better option than optical sensors.
My suggestion: read back the Cybrid implemmentation (basically turning the hall sensors into on-off binary distance detectors) and the more recent CG discussions on how to circunvent the non convenient "trimpots" ( @CyberGene : where was that discussed?). With just one fast teensy, very simple circuitry and simple code, you can avoid the hassle of full fpga programming...


vagfilm

Looks like I missed a couple of posts between reading yours and writing mine. I think that you are all set.


HZPiano

Hello,

@xooorx, Nice project, nice thread! I'll be following it/you with interest.

  • What advantage do you hope to achieve over the CA's rubber/carbon sensors that you're obviously discarding?
  • With magnetic sensors (vs. optical), I always wonder whether the magnet (in a key, if I understand correctly) also influences neighboring sensors (which I would reckon is unwanted)?

Cheers and lots of fun,

HZ


vagfilm

Wait... Are the magnets in the keys? I don't think that is a good idea because the magnetic fields are alwaus changing (ie, the compound field of a single vs double keys). I would put the magnets in the keybed and the sensors in the keys...


xooorx

HZPiano What advantage do you hope to achieve over the CA's rubber/carbon sensors that you're obviously discarding?

In no particular order…

  • It could also be fitted to a real piano action if one came along at the right price
  • To have a more configurable touch response than just a velocity curve: With full position detection you can decide where in the keystroke the measurement is taken, how far up you need to come for a repeat. Possibly even adjust these in real time, like having a digital version of that Fazioli fourth pedal that moves all the hammers.
  • Possibly could produce additional control data e.g. damper position, key acceleration (distinguish "press" vs "strike" touch), some kind of aftertouch.

HZPiano With magnetic sensors (vs. optical), I always wonder whether the magnet (in a key, if I understand correctly) also influences neighboring sensors (which I would reckon is unwanted)?

From my rough waving a magnet around on a stick test it looks like magnets in adjacent keys could have a small (<1%) effect on the measurements. I'll have to look at this with a more accurate setup. Depending on the results the options could be:

  1. Live with it,
  2. Try to shield it, even if just a bit, (Maybe some mu-metal foil on the key sides would be enough)

Or…

vagfilm Wait... Are the magnets in the keys? I don't think that is a good idea because the magnetic fields are alwaus changing (ie, the compound field of a single vs double keys). I would put the magnets in the keybed and the sensors in the keys...

...Or do this. Not sure about having to run three wires onto each key though, plus circuit board with the sensor, plus biasing magnet.

Edit: And thinking about it, if there's a biasing magnet on the keys then there'll still be moving magnets in the adjacent keys.


Drew-r

HZPiano

From a purely practical point of view, i can say this is a worthy project, having experienced the doldrums first-hand of intermittently sounding keypresses after 14 months of beginner’s learning on a (what had been my) new ES7.

It is somewhat surprising to me that when considering the overall amount of effort in R&D and S&M put into any model of DP, the cost of this rubber/carbon contact/sensor gizmo is probably a small portion yet it literally is where the rubber meets the road in the YMMV DP playing experience.

From a wondering-out-loud view, perhaps it is purely coincidental you started with the same brand of Z stock 🤔 …. but it you build it (better) they may well come. Best of luck!


HZPiano

Drew-r if you build it (better) they may well come.

If you build it they will come, that's for sure.

And then, just five notes (played at various speeds) suffice for the initial communication.

🛠️

Cheers and happy building,

HZ


HZPiano

xooorx additional control data

Rather interesting (not just this bit, but the various goals as you lay them out).

Cheers and happy experiments,

HZ


RIP

xooorx I'm in the south west of the UK so… wrong continent?

For meeting in person, yes, but I routinely meet online with many in the UK, including my piano teacher.
For ordering and shipping common parts (if any) we need to look at import duties and that stuff, we'll figure it out if/when we get there.

xooorx What sold me on this sensor was the built in ADCs and SENT output means I don't have to get into the analog side of things, don't have to get clean analog signals from the keys and multiplexed into an ADC, don't have to trim anything (any trimming would be done digitally) it's digital all the way.

I see. Similar to my reasons for picking optical ones. I guess you looked closely at the piano-conversion design didn't you? Actually I did not think about looking if there were some ADC using "my" sensors already made with similar specs in place, you gave me the idea to go looking: perhaps it does.

Drew-r It is somewhat surprising to me that when considering the overall amount of effort in R&D and S&M put into any model of DP, the cost of this rubber/carbon contact/sensor gizmo is probably a small portion yet it literally is where the rubber meets the road in the YMMV DP playing experience.

Agreed. I'd expect many more instruments utilizing optical sensors of various kind, these days. E.g. computer mice moved away from moving parts long ago….

TTYL.


vagfilm

xooorx And thinking about it, if there's a biasing magnet on the keys then there'll still be moving magnets in the adjacent keys.

What are you calling "biasing" magnets? AFAIK, you don't need more than a stationary reference magnet at close distance to the sensor (you don't even need that, but then you tilt the keyboard and because it is calibrated to the North Pole, notes play spontaneously... You definitely want magnets fixed to the keyboard frame).
Those are extremely sensitive sensors (used as compasses...) so if you out the magnets in the key and the sensor in the keybed, whenever you move a key the readings in ALL 88 sensors will be affected. Unless I am seeing this completely wrong, you cannot have any movable magnetic source close to the sensors. What you need are many non movable internal magnets in order to supress the external magnetic fields. And even then, I would not use that keyboard in a live setting on an arena concert... But it should be fine for home use.
You don't need full range of the sensor. You are only measuring 10mm of travel distance (and the output will not be linear to distance, anyway)... No need to slice 10mm into micrometers.


xooorx

RIP I guess you looked closely at the piano-conversion design didn't you?

The only design I looked closely at was the Cybrid... but then having just slightly different goals ended up taking things in a very different direction.

RIP For ordering and shipping common parts (if any) we need to look at import duties and that stuff

I'm really not sure how much practical component/design/code level commonality there will be, given that I have made some contrary design decisions. OTOH on a more abstract level ("So we're sensing the key positions. Now what?") it becomes the same thing.

vagfilm What are you calling "biasing" magnets? AFAIK, you don't need more than a stationary reference magnet at close distance to the sensor (you don't even need that, but then you tilt the keyboard and because it is calibrated to the North Pole, notes play spontaneously... You definitely want magnets fixed to the keyboard frame).
Those are extremely sensitive sensors (used as compasses...) so if you out the magnets in the key and the sensor in the keybed, whenever you move a key the readings in ALL 88 sensors will be affected.

No, these aren't extremely sensitive sensors for direction finding. They detect the strength, not the direction, of the magnetic field, and they do so on one axis only. They are intended for sensing the position of components in moving machinery. If the south pole of a magnet approaches a sensor from directly above it gives an increasingly positive output (0 to 2047). If the south pole approaches from directly below it gives an increasingly negative output (0 to -2048). The idea of "biasing" is to have a fixed magnet positioned with its south pole directly below the sensor so we get a strongly negative reading until the moving magnet approaches from above. The ideal setup would go from -2048 to 2047 as the key approached, using the full range of the sensor, instead of 0-2047 using just half the range.

The magnets in nearby keys are a small problem rather than a big problem because they are further away and their poles are not aligned with the sensor axis. (But yes, they are a small problem).


vagfilm

Ok... As a non engineer I always assumed that for automation of linear track movement you used the same sensors and simply discarded 2 of the orientations. So, these are even better, and you are correct that it will probably work either with magnet or sensor on the keys. And it should be better insulted from external magnetic fields. My experience is with sparkfun modules of 3d magnetic detection, and that is very powerful, but a bit complex to calibrate.
In any case, I would first try it without the biasing magnets. From 0 to 2048 is more than enough resolution (even without optimized normalization of key travel to full range of the sensor).


Khuja Wangtishvili

@xooorx
How is your project? Did you manage and finish it to the stage that you can play on it everyday and nothing more there is to be done?


SouthPark

Interesting project. We know that yamaha wasn't able to account for every important condition (state), so they ran into the loud/soft note issue. So ….. an appropriate combination of hardware measurements and software control algorithms will be needed to avoid that sort of thing. Looks like that's probably sorted here.

As for hall sensors, certainly ok for estimating velocity. And need to have a reliable system to track the direction of the hammers. And the algorithm needs to track the hammer position and direction at pretty much all times. And that's just for one hammer.

For optical encoders, maybe the absolute encoder could be handy if the processing side (hardware) can properly handle everything. The incremental optical encoder could possibly be more along the lines of hall effect sensor, except the optical sensor is expected to be capable of much higher resolution … and much less noise.

A project like this and these ones look like a heap of fun. Certainly will keep one occupied nicely for quite a while.


xooorx

Khuja Wangtishvili How is your project? Did you manage and finish it to the stage that you can play on it everyday and nothing more there is to be done?

Erm, no. I really should get back to it.