LM393 Sound Detection Sensor calibration

Hello everyone, has anyone used a LM393 Sound Detection Sensor, does it actually deliver a continuous signal reporting the sound amplitude. The reason I am asking is because I just got one, and although I am calibrating it carefully, the output signal of the sensor translates in the computer erratically. Is there any specific formula around to apply to it and calibrate it ?

Thanks K.

has anyone used a LM393 Sound Detection Sensor,

I have used a LM393 but it is not a Sound Detection Sensor it is just two comparators.

the output signal of the sensor translates in the computer erratically.

How are you wiring it up? They have open collector outputs you know, so unless you have a pull up resistor you will just get random noise when you try and read a pin.

Right, thanks, I guess it still works with sound though, what is the most obvious use of it, tracking amplitude ?

Basically, I want to use use it a switch where it will activate some function, like if(sound==1){doThis} I guess I can define a certain threshold up to when it will generate the data. I am looking here and there, and I am not really sure, either it is an analog or a digital sensor. In any case, is there any wiring scheme I can take a look in order to use it properly ?

Thanks

That chip will not track amplitude. It is a digital comparator.
That means it has two inputs, A and B. If voltage A is higher than B the the output is high, if voltage A is lower than B then the output is low.
Sound is a constantly changing voltage so this chip by itself will not track any changes in amplitude.
If you have a peak detector

Then you could use this chip to trigger when the peak of the sound is greater than a certain fixed level, but I am not sure if this is what you want.

Note that the peak level of a sound, is not very correlated to the perceived loudness of a sound.

This sounds rather complicated for the use I want it, and I am pretty much sure there will be something other to have the job done. Maybe I can use a microphone for that, I hear that you can attach a normal microphone with a fairly easy hack, any tips about that ?

Thanks

This sounds rather complicated for the use I want it,

It very well might be, but as you have not had the good grace to tell us what you want it to do it is impossible to be more helpful and we can only answer the questions asked.

I would like to use it as an amplitude detector, and to use it as a monitoring reference to suppress a signal that comes out of the computer, a sort of a feedback loop between a real world value and the signal output of the computer. So let's say, if the amplitude goes high the compressor will turn down the sound output accordingly, aka machine listening.

Still not 100% on what you want to do. The front end then should be how I described with just a peak detector feeding directly into the analogue input of the arduino. You can then use the analogue read to see what it is and apply any threshold detection in software. Then you need something like a digital pot http://arduino.cc/en/Tutorial/SPIDigitalPot#.UxxIql6prdU to control the "sound"? out of your computer into an amplifier.

The LM393 dual comparator-based sound sensor provides two outputs, one analog (typically A0) and one digital (typically D0). While the sensor's digital output (D0) is connected directly to the OUTPUT pin of the LM393's first operational amplifier, the sensor's analog output (A0) is connected to the microphone via a resistor (150R-1500k) BEFORE the comparator so its value is not determined or modified at all by the LM393.

I suspect that the issue mentioned by Kostantinos has to do with the way Arduino converts the analog signal coming from the microphone into a numerical value (typically between 0 and 1023). The value read at the sensor's analog output (A0) when the microphone does not register any sound ("silence"), will change (usually decreasing) over time depending on the variations of sound level. I guess the mentioned issue appears when trying to use a fixed value (say 500) as a threshold to determine whether there is sound or not because the actual threshold must be adjusted over time.

I doubt OP is interested any more after more than 6 years.

You normally use two variables that are updated with analogRead for some time. One for the the positive peaks, and one for the negative peaks. Subtracted from each other gives a sound value. Then DC/bias voltage becomes irrelevant. Leo..