Date: 19950221 From: Gregory A. Youngdahl To: Multiple recipients of list Subject: Piezo to 68hc11 A/D Hi all, Some of the recent postings have piqued my interest in a project that has been in the back of my mind for a while. This is to create something that I can strike with a drum stick, and produce MIDI messages (Note On and Off) with velocity values (range of 1-127) relative to the strength of the strike. I've seen setups using little piezo electric transducers that you can buy at Radio Shack and put under a mouse pad or some such and get analog blips out of. I assume these could be amplified (or voltage divided) so that the output would be suitable for measurement with a 68hc11 A/D converter. This much I can probably do. My question has to do with what an appropriate approach to triggering the conversion would be, and also stabalizing the signal during the measurement. What would people suggest for doing this? Would a sample/hold be needed, or some kind of peak detector, or perhaps just some form of integrator? While I realize that a specific answer is probably not possible (and of course would take all the fun out of tinkering), the more detailed the response is, the more it would help me (part numbers, basic diagrams, pointers to articles or whatever would be appreciated). I'm really more of a software type who likes to dabble in hardware, but doesn't have all that much experience in the hardware realm. Thanks for any suggestions, -- Greg Youngdahl AT&T Bell Laboratories Naperville, IL Date: 19950221 From: Raymond E. Rogers To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D What is the purpose of this? To quantitativly measure and store the impact or the drum stick or the response of the drum? It seems to me that the xducer will just measure the strain of the memebrane and you will have to do some processing to convert the time varying strain signals into velocity, acceleration and position signals. Incidently there is company in LA that makes pressure sensitive resistors that might work as well ( and be cheaper) as the more normal strain xducers; but I haven't used them and there could be calibration problems. ====================================================================== Ray------------------------------------------------------------------- The views expressed are a result of a collaboration between myself, my society, and the world. Unfortunately I have had problems getting my partners to shoulder their share of the Blame! ====================================================================== Date: 19950221 From: Holger Hellmuth To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D A project in a german electronics magazine used a simple microphone as sensor. No microprocessor was necessary. The output of the micro was integrated and used as multiplier for the D/A converter. Holger. Date: 19950221 From: Gregory A Youngdahl To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D Hello Holger, Thanks for your response (quoted below for context, it is short)... > A project in a german electronics magazine used a simple microphone as > sensor. No microprocessor was necessary. The output of the micro was > integrated and used as multiplier for the D/A converter. I suppose it would be possible to come up with some kind of a state machine or sequencer that would pump a 3-byte MIDI NOTE-ON message with the value from the A/D as the velocity byte, followed by a 3-byte MIDI NOTE-OFF message to a UART and avoid using the uC. However, I personally (given my limited hardware experiences) would find it easier to use the 68hc11 for this. Perhaps this might not be the most sensible decision for a commercial product cost-wise, but for my home tinkering it seems OK. I still need the Serial port to pump out the MIDI data, and with 8 A/D converter channels I could potentially hook up 8 of the sensors and simulate a reasonably full set of drums. I would really be interested in more details about the integrator circuitry. Would it be possible for you to provide some description of the integrator, or at least more details about the magazine (name, which issue). Being a German magazine, I'm not sure I could find a copy around here (I'm near Chicago IL, USA). Even if I did, unless it was in English I don't know if I'd understand it :-) Thanks, -- Greg Youngdahl AT&T Bell Laboratories Naperville, IL Date: 19950221 From: Grant Beattie To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D On Tue, 21 Feb 1995, Gregory A Youngdahl 708 979 0013 wrote: > Some of the recent postings have piqued my interest in a project that > has been in the back of my mind for a while. This is to create something > that I can strike with a drum stick, and produce MIDI messages (Note On and > Off) with velocity values (range of 1-127) relative to the strength of the Check out back issues of Electronic Musician at your local library. There has been at least one drum trigger project in there. I think there was even one in Electronics Now. > strike. I've seen setups using little piezo electric transducers that you > can buy at Radio Shack and put under a mouse pad or some such and get analog Edmond Scientific has these for about a buck apiece. These are also a larger diameter than the Radio Shack variety (which is a good thing). > blips out of. I assume these could be amplified (or voltage divided) so that > the output would be suitable for measurement with a 68hc11 A/D converter. Hmmm. Not sure it you'd even need the A/D. I think there is someone on the list that has been down this road before. Date: 19950221 From: Grant Beattie To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D On Tue, 21 Feb 1995, Gregory A Youngdahl 708 979 0013 wrote: > I suppose it would be possible to come up with some kind of a state > machine or sequencer that would pump a 3-byte MIDI NOTE-ON message with the > value from the A/D as the velocity byte, followed by a 3-byte MIDI NOTE-OFF Divide the A/D value by two. I think data values are limited to 127 for MIDI. > I would really be interested in more details about the integrator > circuitry. Would it be possible for you to provide some description of > the integrator, or at least more details about the magazine (name, which There are lots of MIDI-trigger devices on the market. Why not have a look inside one of them? Date: 19950222 From: Tim Braun To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D > From server@bobcat.etsu.edu Tue Feb 21 21:15:45 1995 > From: Grant Beattie > On Tue, 21 Feb 1995, Gregory A Youngdahl 708 979 0013 wrote: > > > Some of the recent postings have piqued my interest in a project that > > has been in the back of my mind for a while. This is to create something > > that I can strike with a drum stick, and produce MIDI messages (Note On and > > Off) with velocity values (range of 1-127) relative to the strength of the > > Check out back issues of Electronic Musician at your local library. > There has been at least one drum trigger project in there. I think there > was even one in Electronics Now. I subscribe to EM, and there was a drum trigger project based on the 68hc05 (or was it an 8051?) as well as an Atari parallel port gizmo a few moons back. I believe it was an 80c51 connected to an external ADC0808. No, that was an expression controller. The drum trigger was fixed velocity, I think. I've got this project (hc11 drum trigger) on my list, as well. It looks like it's too far down to get to, soon, though. > > blips out of. I assume these could be amplified (or voltage divided) so that > > the output would be suitable for measurement with a 68hc11 A/D converter. > > Hmmm. Not sure it you'd even need the A/D. I think there is someone on > the list that has been down this road before. Some systems have used a fixed threshold, but we want dynamics. I'd like to try feeding the trigger into the A/D and doing software integration. Though why I don't want a few Cap's around, I'm not sure. ______________________________________ Tim Braun | Continental Healthcare Systems Canada | Date: 19950223 From: Werner Backes To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D Gregory A Youngdahl wrote: > I suppose it would be possible to come up with some kind of a state >machine or sequencer that would pump a 3-byte MIDI NOTE-ON message with the >value from the A/D as the velocity byte, followed by a 3-byte MIDI NOTE-OFF >message to a UART and avoid using the uC. However, I personally (given my >limited hardware experiences) would find it easier to use the 68hc11 for this. >Perhaps this might not be the most sensible decision for a commercial product >cost-wise, but for my home tinkering it seems OK. I still need the Serial >port to pump out the MIDI data, and with 8 A/D converter channels I could >potentially hook up 8 of the sensors and simulate a reasonably full set of >drums. I think that the all-in-hardware-solution is no good approach especially if you want velocity data. I though of such a drum project some time ago. What I would try is: 1. A high-impedance amplifier (FET-OpAmp) to get a good signal from the piezo, 2. A low pass filter to clean the signal from noise which would disturb the A/D-conversion and would make it impossible to get the 'right' peak. Maybe 1 & 2 can be done with the same OpAmp. The cleaned signal would be connected to the hc11's A/D inputs. The problem is to 'hit' the peak with an A/D conversion. A smoother peak (lower frequency of the low pass filter) would be better to handle but would affect a delay between the hit to the drum and the peak. But I think a good compromise is possible. btw, I ripped a piezo from a broken digital clock, it worked fine as a 'hit sensor'. Werner Date: 19950223 From: Kilsti Geir To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D Werner Backes writes: > I think that the all-in-hardware-solution is no good approach especially if you > want velocity data. I though of such a drum project some time ago. What I > would try > is: > 1. A high-impedance amplifier (FET-OpAmp) to get a good signal from the piezo, > 2. A low pass filter to clean the signal from noise which would disturb the > A/D-conversion and would make it impossible to get the 'right' peak. > > Maybe 1 & 2 can be done with the same OpAmp. The cleaned signal would be > connected to > the hc11's A/D inputs. The problem is to 'hit' the peak with an A/D conversion. > A smoother peak (lower frequency of the low pass filter) would be better to > handle > but would affect a delay between the hit to the drum and the peak. But I > think a good > compromise is possible. > This is starting to get somewhere... I have made a system very alike this one in my 6809 machine. A high impedance Op-amp on the input is a 'must'. After a non-inverting op-amp, the signal is fed through a diode and then smoothed by a condensator and a resistor in paralell towards GND. In this way, the rise time is fast, and the decay time can be controlled by the RC-values. In addition to feeding this signal to an A/D converter, I feed it into a comparator to have a trigging signal. By adjusting the voltage divider R2/R3, you can get a threshold level, so that you don't need to read the A/D converters all the time. The best is to feed this trigger signals into an edge-sensitive input that can give interrupt to the CPU. The trigger output will go HIGH when the input signal reaches the trigger level and LOW when it falls below. If you swap the + and - inputs on the trigger op-amp, the levels will be opposite. All the op-amps can be powered with 0V and 5V, but to get a best possible resolution, the Vref on the A/D converter should be about 4V (max. level on the A/D signal). If you don't want to sample the whole signal, feed the A/D signal into an additional Op-amp circuit working as a derivator (1 op-amp, 1 R, 1 C). The output signal from a derivator will change level (from HIGH to LOW) on the top of the 'curve'. If this gives an interrupt, you need only to do one sampling of the signal to get the level/velocity. Try with different values. I use small piezo's for this and it works fine! ---o To derivator | >From o--|>|---o----o--------o---o------------o To A/D Op-Amp d | | | |C / R1 | |\ --- \ -------|+\ --- / | \-----o To Trigger | \ | / | | +5V ---|-/ -------- A | |/ ---- | | -- -\/\/\--|--/\/\/-- R2 R3 | --- - Geir Kilsti, Land of the midnight sun (Norway) Date: 19950224 From: Gregory A Youngdahl To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D Hello all, Thanks for all the great replies I've gotten to this thread. Sorry I haven't responded sooner, but I've been in a class, and have just gotten cought up on my email. I'll try and address some of the questions that have been asked, and not answered by others... "Raymond E. Rogers" writes: > What is the purpose of this? To quantitativly measure and store > the impact or the drum stick or the response of the drum? The idea is to create a trigger device for a MIDI (Musical Instrument Digital Interface) sound module that can reproduce drum sounds. MIDI defines messages that control electronic musical instruments. They are sent over a current loop type of serial link. Some instruments can make the sounds of drums. I want to make something that I can hit with a drum stick and have it send the necessary MIDI messages to the sound module to reproduce the drum sound. The harder I hit with the stick the louder the sound should be. One component of these MIDI messages is a "velocity" byte (actually 7-bits) that indicate how hard the pad was struck (or, when implementing a piano keyboard type of controller, how hard the keys were pressed). This is the component of the message that I need the A/D to generate based on the level of the signal from the piezo sensor. Grant Beattie writes: > Hmmm. Not sure it you'd even need the A/D. I think there is someone on > the list that has been down this road before. As mentioned above, the A/D is needed to generate an indication of how hard the "drum" was struck, so that the information can be placed in the MIDI message, and the sound module can generate a sound with volume relative to the strength of the hit (some other sound parameters in addition to the volume may be dependent on the strength of the hit as well, depending on the sophistication of the sound module). Grant Beattie writes: > There are lots of MIDI-trigger devices on the market. Why not have a > look inside one of them? Surprisingly, I haven't seen any devices of this type that produce MIDI messages. Most of the drum triggers just produce the analog voltage that feeds into a dedicated sound module (which may or may not be able to receive MIDI messages as well) to generate the sounds. If you know of a stand-alone drum pad that generates MIDI rather than just analog voltages, I'd be interested to know more about it. Tim Braun writes: > Some systems have used a fixed threshold, but we want dynamics. I'd like > to try feeding the trigger into the A/D and doing software integration. > Though why I don't want a few Cap's around, I'm not sure. Now this is an interesting idea. I hadn't thought that I'd be able to get more than one reading per drum hit. You seem to be implying that I could get several samples of each hit. If the signal is clean enough (or if it can be cleaned up) this might be a good approach. Werner Backes writes: >The problem is to 'hit' the peak with an A/D conversion. > A smoother peak (lower frequency of the low pass filter) would be better to > handle but would affect a delay between the hit to the drum and the peak. True, the message with the velocity byte should come relatively soon after the "hit". A delay of a few milliseconds (probably less than 10 or so) *might* be acceptable (?). Lots of room for experimentation (that is where the fun is!). Kilsti Geir writes: > If you don't want to sample the whole signal, feed the A/D signal into an > additional Op-amp circuit working as a derivator (1 op-amp, 1 R, 1 C). The > output signal from a derivator will change level (from HIGH to LOW) on the > top of the 'curve'. If this gives an interrupt, you need only to do one > sampling of the signal to get the level/velocity. Try with different values. This sounds like the best approach. As I mentioned, my hardware experience with these kinds of circuits is rather weak. You made a great diagram of the rest of the circuit. Any chance you could do one for the derivator (where the R and C go, and some reasonable starting values)? Thanks to everyone who replied (on the list and privately). This has been (and hopefully will continue a little) to be an interesting thread. -- Greg Youngdahl AT&T Bell Laboratories Naperville, IL Date: 19950225 From: Grant Beattie To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D On Fri, 24 Feb 1995, Gregory A Youngdahl 708 979 0013 wrote: > Grant Beattie writes: > > Hmmm. Not sure it you'd even need the A/D. I think there is someone on > > the list that has been down this road before. > > As mentioned above, the A/D is needed to generate an indication of > how hard the "drum" was struck, so that the information can be placed in the > MIDI message, and the sound module can generate a sound with volume relative I was thinking you might be able to do this with input capture... > Grant Beattie writes: > > There are lots of MIDI-trigger devices on the market. Why not have a > > look inside one of them? > > Surprisingly, I haven't seen any devices of this type that produce > MIDI messages. Most of the drum triggers just produce the analog voltage > that feeds into a dedicated sound module (which may or may not be able to > receive MIDI messages as well) to generate the sounds. If you know of a > stand-alone drum pad that generates MIDI rather than just analog voltages, > I'd be interested to know more about it. Alesis D-4, Yamaha has one too, any Roland Octapad or derivative, later Simmons drum brains,... etc. The Alesis gives you 12 piezo-to-MIDI converters all with programmable sensitivity, programmable note numbers (and many other parameters too) AS WELL AS a damn good collection of drum samples. Pretty cheap too, it's only weak spot is the 8031 inside :) GB Date: 19950227 From: Kilsti Geir To: Multiple recipients of list Subject: Re: Piezo to 68hc11 A/D > Now this is an interesting idea. I hadn't thought that I'd be able > to get more than one reading per drum hit. You seem to be implying that I > could get several samples of each hit. If the signal is clean enough (or if > it can be cleaned up) this might be a good approach. > The A/D conversion is fast: 32 E cycles (16/32us with 8/4 MHz Xtal). You can do plenty of samples during a drum hit. I've made a simple oscilloscope, where I plot the hit-curve on a graphical LCD screen. After adjusting the RC values several times, I got a nice, smooth curve with fast response (practical no delay). I have 6 trigger inputs. Each of the level-variable trigger signals is fed into various edge- sensitive inputs. As I didn't have that many edge-sensitive inputs that could give interrupt, I had to let go of the derivator idea. So now I get an interrupt whenever a hit occurs that is over the limit, I send the two first MIDI bytes. Then I start to sample that curve until it reaches it's maximum level, which is sent as the velocity byte (of course divided by two, to get 0-127). This works fine. No noticeable delays. > > True, the message with the velocity byte should come relatively soon > after the "hit". A delay of a few milliseconds (probably less than 10 or so) > *might* be acceptable (?). Lots of room for experimentation (that is where > the fun is!). > You got THAT right! > > This sounds like the best approach. As I mentioned, my hardware > experience with these kinds of circuits is rather weak. You made a great > diagram of the rest of the circuit. Any chance you could do one for the > derivator (where the R and C go, and some reasonable starting values)? > I'll look up my papers within a few days. Since the HC11 is so fast, I suppose it will make no difference whether polling or interrupt is used on both the trigger- and the derivator-signals. The HC11 don't exactly have plenty of edge-sensitive inputs... Geir Kilsti, Norway. Date: 19970228 From: Clifford Heath Organization: Open Software Associates Limited To: mc68hc11@bobcat.etsu.edu Subject: 68HC11 MIDI piezo triggers Folk, There was some discussion a while back about piezo MIDI trigger units using the 68HC11. I am in an advanced state of building a 64 channel piezo to MIDI board based on the 68HC11 (as a hobby project), and have written some things about it at http://www.osa.com.au/~cjh/electronics. The device performs pulse stretching and scans all 64 channels in around 1.4 milliseconds, so with a 10ms time constant on the stretcher can easily handle peak detection on 64 channels. I'm still programming it, but the basic operation is fine. The difficulties that remain are software - how to null out adjacent channel interference (I'm using it for a vibraphone layout), how to eliminate double triggering, etc None of these problems is hard, just take time. The board layout isn't available as yet, since I'm trying to decide whether to commercialise the project, but I'm happy to answer any questions about how I made this thing work - there were a few gotchas with the piezos, but basically the device is *very* simple. There are only 4 components per channel, and two of those are resistors in 9-pin SIPs. I use 8 4051 multiplexers to get from 8 to 64 channels. It has MIDI in/out and optional MAX232 on the UART, and the layout is entirely single sided (four jumpers). The extra ports are brought out to headers, and I plan to add a EL backlight inverter for an LCD in a later version. There is room in ROM to program a fully customisable drum-kit controller instead of the vibraphone layout, and it's on this basis that I'm considering commercialising it. Jaap, if you want to add this to one of your MIDI files, it might be of use to someone. Clifford Heath Open Software Associates Limited, +61 3 9871-1694 Box 401, Ringwood, Victoria, Australia 3134. http://www.osa.com.au/~cjh