Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using piezoelectric signal for comparator

Status
Not open for further replies.

vielle568

Member
Can anyone please tell me how I can use an analogue signal from a piezoelectric sensor (placed under the bridge of a stringed instrument) to trigger a comparator when the signal level goes above a limit? Is there some way of converting the audio signal from the piezo sensor to dc for use in the comparator?
I’m sure that there’s a probably fairly simple answer but I can’t figure it out. Help required! Thanks.

Vielle568
 
Your piezoelectric transducer will produce an AC signal when it picks up the sound (vibration) The amplitude will be a function of the "bang" and only last for the duration of the sound. The output of the comparator will be a pulse only for the duration of the bang. Since the piezoelectric transducer output will be a low level signal you may want to amplify it a little. The pulse out will be a high to low or low to high depending on how you configure the comparator.

This link is a pretty good read on comparator circuits.

This is also where it would be nice to have a scope to observe the transducer outputs. Especially at different frequencies for notes struck (chords?). I am not a stringed instrument type. :)

Is there some way of converting the audio signal from the piezo sensor to dc for use in the comparator?

The rectified DC level will just follow the transducer output so why rectify it?

Ron
 
Last edited:
If you dont rectify it, you will get a series of pulses out of the comparator while the string is vibrating at an amplitude above the threshold of the comparator.

I'm guessing you will want an amplifier (gain 10 to 100), followed by a two-diode-detector going into the comparator. That way, the output of the comparator will be high/low (your choice) while the string is vibrating.

Something like this:


Since the vibration has an exponential decay, where do you want the comparator to shut off?
 

Attachments

  • Pluck.png
    Pluck.png
    49.3 KB · Views: 475
Last edited:
Hello Reloadron and MikeMl,

Thanks for your replies and thanks too for the info on comparators; useful stuff!

I have sketched out a couple of graphs to give a clearer image of what I am trying to achieve. The input is an audio signal from a piezoelectric sensor. It is mounted below the bridge of a drone string that is used for the rythmn on a musical instrument. Normally the amplitude and frequency of the signal remain constant with the exception of periodic pulses of increased amplitude that form the rythmn. I want to try to capture these pulses and convert them to a square waveform to eventually trigger an analogue switch.
**broken link removed**
The frequency of the audio signal will be set at either 392hz or 440hz and so I think that you're probably right Mike, this will be recognised as an ac input by the comparator and it will out series of pulses at the same frequency. Consequently, the input signalwill need to be rectified. It will also need to be amplified as you suggest as the piezoelectric sensor outputs a very low level signal.

Incidently, will I actually get a square wave out of the comparator or will I get an exponetially decaying curve as shown in your graphs Mike? I'm curious.

How's the weather over there in Davis County? It's probably pretty cold still in Cleveland. We have blue sky and sunshine here in Western France but the temperature doesn't get up to 15°C.

Vielle568
 
Hi

The circuit Mike posted will give you pretty much what you are looking for. The red trace in the circuit is the output of the comparator. To have the output swing positive during the duration you would swap the inputs to the comparator chip. That output in turn could be used to drive your analog switch.

I would be happy with 15C. This time of the year we go from ice to snow to rain and then repeat. :) We see some days of 15C then back to days of -9 C.

Ron
 
About 50degF, Sunny for the past few days. Still lots of snow in the Wasatch; great skiing. I flew the Cessna to Arizona and back across the Grand Canyon this week.

As Ron pointed out, the red trace V(out) is the output of the comparator, the decaying signal is the output of the detector, V(det).

Think of the circuit as three independent blocks; the gain stage, the detector, and the Schmit Trigger (comparator with hysteresis). Note that for proper operation of the detector, the amplitude at the output of the gain block V(a) needs to be a minimum of a couple of volts, so adjust the gain of first stage as needed. To invert the output, flip both diodes in the detector so that it puts out a negative voltage, and set up the trip point pot as needed.

Do you have split supplies? Do you want to invert the output?
 
Last edited:
You're both right, Mike's circuit should be fine. I didn't pick out the red square wave trace in that first graph; I was looking at the other two signals and I simply didn't see it.

The circuit would be simpler running from a single source; ideally a 9V battery as it will eventually be integrated into an instrument and so I'd like to try to keep the weight down.

That must have been quite spectacular flying across the Grand Canyon. I have always been impressed when visiting Brice Canyon. I used to work in L.A. for Hughes Aircraft building satellite test equipment and by chance I have relations in Salt Lake City and Ohio too. No, I'm not an EE I'm an ME, that's why I'm asking all the questions. Thanks for your help guys!

Bryan
 
Here is another version that operates on a single 9V supply, and inverts the polarity of the output. Note the Attack delay and Release delay. This is about typical for this type of tone detector.

Another idea would be to use an **broken link removed**. It will have similar delays.
 

Attachments

  • ToneDet.png
    ToneDet.png
    53.6 KB · Views: 340
The new circuit design seems fine. I'll try it out on a breadboard and let you know how I get on. The input signal will pulse at a maximum rate of 10hz, so each pulse will have a duration of about 50 milliseconds. Is your graph in milliseconds or microseconds? Either way, the attack delay is negliable and can be ignored. The decay delay is somewhat longer but it shouldn't cause any problems as the squqre wave generated will be used to triggers an analogue switch and this in turn activates the sound for the rythmn. As long as the sound signal turns on at the attack of each pulse and turns off before the arrival of each sequential pulse then the rythmn should work correctly.

Thanks for your help.

Bryan
 
The X-axis scale is 0 to 0.25sec or 250ms.

V(h) is what V(det) is being compared to. Note how the hysteresis offsets V(h).

You should use rail-to-rail output low-voltage opamps.
 
Last edited:
Even with the X axis scale at 0.25 seconds the attack delay from the hysterisis doesn't appear to be too significant; the delay at the closing end of the pulse signal is greater but this won't affect the final use in any way.

For the ICs I've a couple of LF353s that are JFET input dual op amps. They have a high input impedance; will this affect things? I also have some TL061CP ICs, again JFET op amps but low power versions. Other than that there's the LM741, NE5532 (dual low noise op amp), MC4558 (low power dual op amp) or OPA2134 (dual audio op amp).

For the comparator I've some LM311 (single supply, low power comparators) or LM393 (dual comparator, low power). I realise that if you leave omit feedback resistor an op amp circuit will functon as a comparator but the two chips above are listed as comparators and not as op amps, so wouldn't there be some advantage in using one of these components?

Bryan
 
Converted to LM358s (MC4558?). Note that for such a slow detection rate, you do not need to use a true comparator chip. Since the LM358 is not rail-to-rail out, I offset the mid rail down to 4V.
 

Attachments

  • ToneDet.png
    ToneDet.png
    41 KB · Views: 256
On a different forum, here recently working with a member that had a problem with using a piezo sensor with no results, and after much weeding of information it was discovered he had a piezo with a built in driver that he was trying to use as a sensor.

We wont make that same mistake here will we.??

Thought it worth a mention.

Pete.
 
OK Mike, I'll use the op amps you suggest. I can see what you've done to reduce the voltage level. And to answer Pete's question, no, the piezo sensor is just a small piece of piezo film about an inch long:
**broken link removed**
There's no driver, just a short length of coax that connects it to the circuit above.

I tried the sensor output on the scope. The result isn't quite the same as the clean block pulse on your graphic image; in reality the pulse section starts with a surge and has a slight decay as it progresses. However, the amplitude of the pulse is still far greater than the basic tone signal between the pulses and the comparator should not have any difficulty in recognising the difference between the two states.

Bryan
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top