RIP
xooorx So far I've coded up a physical model of a key/hammer/string system
Fantastic! Now we are getting scientific 🙂
If you care, you can introduce in your model the sensor response too. In fact the ADC number is not linear with distance for three reasons:
- current from the sensor (ADC measures voltage but V=RI is quite linear)
- ADC conversion (both in value and in time)
- time response for the sensor
For the first reason: see Pag.4, top figure for the 'RCA6 sensor (not sure what "negative distance" means in this plot). With this sensor (the one I am utilizing) at the distance of most interest, i.e. the last few mm, it's linear enough you can probably ignore this issue (assuming the datasheet is correct, which might or might not be). For the CNY70, the difference is big, see fig. 9 (notice that unlike the other one, the vertical scale is logarithm!) and also notice how it flattens in the most important last half mm. The same problem is shown in fig.2 for the QRE1113.
The second problem is described in general at https://microchipdeveloper.com/adc:adc-inl and the specifics of the ADC I am used are on fig. 116 and fig. 117 (in pag 588-9) and in the Errata RP2040-E11 on pag 647 of the datasheet (you would not think a datasheet would have 600+ pages eh?) -- I said repeatedly, I am interested in characterizing this platform, but I expect that eventually it would show its limits and not be adequate. So you might want to consider the other MCU which @JayKominek is already utilizing and which I plan to switch to when he has settled on a hw design. Here is the datasheet and the relevant data is in fig. 39 at pag 171 and fig 91 at pag 284. @JayKominek may chime in with more details, since I did not dig too deeply into these 356 pages (less than the other datasheet, but denser…)
Then, there is the time factor. The sensors do not respond immediately to a changing light, but they have a bit of delay. The sensors' datasheets report information about this either in a figure or in a table. Links above, let me know if the way they report it is too cryptic for you
The data is posted in https://github.com/davidedelvento/Mybrid/tree/main/data/RPiPico%2BEAITRCA6 in binary format.
There was a file uploaded here as plain text file (UNIX end line) rather than MIDI, but it got inadvertently deleted as described at https://pianoclack.com/forum/d/1222-i-have-inadvertently-deleted-some-files-on-the-forum/17 and I am not reuploading unless asked




