First real signal & some mechanics #43
Replies: 7 comments 27 replies
-
Way to go!! :-) What do you mean "position the CNY70s at the back of the action"? What do you have in mind? |
Beta Was this translation helpful? Give feedback.
-
Four hammer strikes on four sensors "simultaneously". Very nice to see there's no cross talk. (The picture is very small, you'll have to take my word for that.) I'm also amazed I can hit four pianos keys with +/-15ms precision. It certainly doesn't feel like it when I'm practicing. 😄 My initial "four sensor" spacer plate was too thin, and I got signals with a big V in the middle, probably where the hammer got close enough into the sensor to ensure that no light from the LED could reflect back onto the phototransistor. That's consistent with the earlier issue. So you definitely need to keep the hammer 1-2mm away from the sensor. Tomorrow, I'll either get some sensors on the ends of the key sticks, or try actually attaching the ADC board to these four sensors. Or both! |
Beta Was this translation helpful? Give feedback.
-
Here we go, an actual hammer strike, collected from data sent via one of the ADC boards: If you're fluent in gnuplot you can note that I'm flipping the 16 bit value around, which is necessary and expected because the transimpedance amplifiers turn a 0 current signal in to the ADC's max input, and higher currents result in lower voltage inputs to the ADC. With that done we're getting a signal range of ~2000 to ~20000. We're losing about 2 bits of range, and we've got a couple bits of noise (no attempt was made to figure out how many bits of noise there are 😄). Not bad! The code I'm running to collect this is hacked together junk, so there might be some dropped samples, the time base is hand wavy at best, etc. I think I'll assemble one of the ADC boards from the most recent revision, and then I can start writing real code for it. |
Beta Was this translation helpful? Give feedback.
-
I dumped 15kHz data into a file and put it into a Gist: https://gist.github.com/jkominek/d0c3da99e5edb7396fec9a61f9a0eccd First column is wall clock time, to the best of the ability of the processor's RC oscillator to measure (let's call it in +/-5%), and the second is the signal off the CNY70, measured at 16 bit resolution. There's quite a bit of noise down at the low end. I'd definitely be investigating that more, especially since it seems to have some 120Hz/240Hz structure to it. I might be picking up something from a switching power supply. The CNY70 LEDs are still running off of a simplistic LED, rather than the very nice one I designed. (:sunglasses:) But if anyone cares to try and process such things, there you go. (Notes: I used a larger gain resistor on this board, so the values are slightly higher than we saw in the previous gnuplot image. And in that previous image, I had a low pass filter in the firmware that I'd forgotten about. I've commented that out, so this is 100% raw ADC readings.) |
Beta Was this translation helpful? Give feedback.
-
Sound! I've got the ADC board converting some timings on the peak into velocity-like numbers, and sending them on. A little toy python script reads the messages (which would normally be interpreted by the main board) and turns them in to MIDI, sends them through loopmidi, and they're picked up by pianoteq. Huzzah! Tentatively the resolution doesn't look bad, with the haphazard calibration values I threw together for this single bass hammer, I've got every third (7 bit) MIDI velocity at the high end of the scale. And four or five times more values than necessary at the low end. Next steps:
|
Beta Was this translation helpful? Give feedback.
-
Tiny little update: still alive, no problems, just not very productive, and what productivity I did have was directed elsewhere. Before the hiatus, I did finish assembling enough sensor boards and cables that I've got 11 keys all wired up (hammers & key sticks), and attached to a single ADC board. And I left the LED power board running continuously for the last two and a half months. On brief inspection, it appears to still be working fine, but one of the indicators LEDs failed. Zero light, but still electrically conductive. Very odd, didn't realize they could fail like that. Tonight I put together some code for receiving/verifying messages sent to the ADC board over its serial link. (Somehow getting bidirectional UART code working on microcontrollers is always very satisfying.) Now for the calibration code on the boards and PC... |
Beta Was this translation helpful? Give feedback.
-
Very weird that a LED constantly on would fail like that. I thought that the life of a LED was much, much longer if constantly on, or limited by the on-off power cycles (in my house the dimmable ones seem to fail much more quickly, if the dimmer setting is changed constantly). Looking forward to the progress! |
Beta Was this translation helpful? Give feedback.
-
I've had an action for some weeks now (feels like ages), and finally got enough frame built up around it to hold one of the CNY70s over a hammer shank.
The sensor is on the underside the horizontal 2020 rail, carefully positioned so you can't see it at all. 😄 The grey, green, brown and blue wires give away its position. It's over the B0 hammer shank. The LED is getting slightly more than 20mA, and the phototransistor is sitting on top of a 1800 ohm resistor, and the two of them have 5V applied.
There's some regularly occurring fuzz on the signal, at 120Hz, so I'm guessing the long wires/cable I'm using are picking up something from power lines. The BNC-to-dual-alligator clips cable I'm using on the scope was $5, so I expect they skippped the shielding. Not worried.
And finally, a short video of the oscilloscope as the key is struck repeatedly: https://www.youtube.com/watch?v=-9GIGnnsfAU
It turns out that placing the sensorboards I'd designed over the hammer shanks with an extrusion in the position depicted isn't actually great:
So I've got new sensor boards, and custom cut aluminum extrusions on the way so that I can position the CNY70s at the back of the action. One row of them being directly struck by the hammers, and another row suspended over the key sticks, behind the backchecks.
Beta Was this translation helpful? Give feedback.
All reactions