Okay, I built the circuit that Boriz suggested, thanks Boriz:
http://img223.imageshack.us/img223/5739/audiosensorob2.gif
And it works, it works better than the version with transistors. Its getting there but the sensitivity is still poor. It doesn't quite have to be be inside the speakers, but its still far from what I am after.
For the gain, I started with setting R5 to be 40 times R2. The sensitivity got better as I raised the ratio. Currently its 3000 times as much. Raising it further doesn't seem to help a great deal.
So obviously, I'm doing something wrong here. The op-amp seems to be behaving as I think it should. Is the problem with the microphone?
Component Values are:
R1 47k (giving 2.2V over the elecret)
R2 15
R3 47k
R4 set to 2k4
R5 Set to pretty much zero
R6 220k
C1 470n
C2 120n
And I'm using one op-amp from a 358.
(My +5V supply is only 3.8V, but that shouldn't make a difference?)
And my test code is:
SYMBOL counter1 = b1
SYMBOL temp_var = b2
SYMBOL temp_var2 = b3
Main:
temp_var2 = 0
'High point latching to catch transients
for counter1 = 1 to 5
readadc 0, temp_var
if temp_var > temp_var2 then
temp_var2 = temp_var
endif
next
if temp_var2 > 128 then
pins = %11111111
elseif temp_var2 > 64 then
pins = %01111111
elseif temp_var2 > 32 then
pins = %00111111
elseif temp_var2 > 16 then
pins = %00011111
elseif temp_var2 > 8 then
pins = %00001111
elseif temp_var2 > 4 then
pins = %00000111
elseif temp_var2 > 2 then
pins = %00000011
elseif temp_var2 > 1 then
pins = %00000001
elseif temp_var2 < 1 then
pins = %00000000
endif
Goto Main
(Obviously, if I can get a decent range out of the sound input, then these thresholds can be calculated on the fly for AGC.)
Any hints gratefully accepted.
http://img223.imageshack.us/img223/5739/audiosensorob2.gif
And it works, it works better than the version with transistors. Its getting there but the sensitivity is still poor. It doesn't quite have to be be inside the speakers, but its still far from what I am after.
For the gain, I started with setting R5 to be 40 times R2. The sensitivity got better as I raised the ratio. Currently its 3000 times as much. Raising it further doesn't seem to help a great deal.
So obviously, I'm doing something wrong here. The op-amp seems to be behaving as I think it should. Is the problem with the microphone?
Component Values are:
R1 47k (giving 2.2V over the elecret)
R2 15
R3 47k
R4 set to 2k4
R5 Set to pretty much zero
R6 220k
C1 470n
C2 120n
And I'm using one op-amp from a 358.
(My +5V supply is only 3.8V, but that shouldn't make a difference?)
And my test code is:
SYMBOL counter1 = b1
SYMBOL temp_var = b2
SYMBOL temp_var2 = b3
Main:
temp_var2 = 0
'High point latching to catch transients
for counter1 = 1 to 5
readadc 0, temp_var
if temp_var > temp_var2 then
temp_var2 = temp_var
endif
next
if temp_var2 > 128 then
pins = %11111111
elseif temp_var2 > 64 then
pins = %01111111
elseif temp_var2 > 32 then
pins = %00111111
elseif temp_var2 > 16 then
pins = %00011111
elseif temp_var2 > 8 then
pins = %00001111
elseif temp_var2 > 4 then
pins = %00000111
elseif temp_var2 > 2 then
pins = %00000011
elseif temp_var2 > 1 then
pins = %00000001
elseif temp_var2 < 1 then
pins = %00000000
endif
Goto Main
(Obviously, if I can get a decent range out of the sound input, then these thresholds can be calculated on the fly for AGC.)
Any hints gratefully accepted.