Hello everyone. I've been trying to solve a problem for two days and I still have not got it.
I have a sound sensor that delivers voltage between 0v-3.3v.
This same, connected to the analogue port of the Arduino, gives me values between 0-660.
In silence he gives me values close to 330.
So far so good!
After that, I applied a voltage divider to reduce the readings in half. I use two resistors of the same value (470 ohm).

With this, I was expecting to read a value close to 165 in silence (half), and values between 0-330 (half) with noise.
However, in silence i'm getting 0 (very bad), and with noise between 0-300 (not so bad)

Here the code:
const int soundPin = A0;
void setup() {
Serial.begin(115200);
Serial.println("Started");
pinMode(soundPin, INPUT);
}
void loop() {
int maxValue = 1024;
int minReaded = maxValue;
int maxReaded = 0;
for (int i = 0; i < 10000; ++i) {
int val = analogRead(soundPin);
minReaded = min(minReaded, val);
maxReaded = max(maxReaded, val);
}
long amplitude = maxReaded-minReaded;
int sound=gain*100/maxValue;
char texto[50];
sprintf(texto, "Sound --> Min=%d Max=%d Gain=%d Percent=%d", minReaded, maxReaded, amplitude, sound);
Serial.println(texto);
}
Anyone know what may be happening?
Your feedback will be of great help.
Thank you so much
Delta_G:
That picture of your code is cute, but I don't have any OCR that can read it and give me back the code. Could you actually just copy and paste the code?
Sorry about that. I added the code to the post, than you 
Try using a voltage divider with higher resistance values (2 x 4.7K). Perhaps the sensor output is overloaded.
jremington:
Try using a voltage divider with higher resistance values (2 x 4.7K). Perhaps the sensor output is overloaded.
Thank you jremington!
I tried with 470k resistors and the same thing happened 
Thank you
470K is too high.
Did you connect ALL the grounds?
Same result with 5k resistors. 
All ground are connected. (Arduino gnd + sound sensor gnd + voltage divider R2)
Thank you!
There is either something wrong with the sensor, or your wiring.
But why use a voltage divider?
jremington:
There is either something wrong with the sensor, or your wiring.
I tried with other sensors and the same thing happens
The wiring is the following:
- Sensor VCC to Arduino 3.3v
- Sensor GND to Arduino GND
- Sensor OUT to Voltage Divider
- Voltage Divider R2 to Arduino GND
- Voltage Divider Between 2 Resistors to Analog Arduino
Image

The sensor works with 3.3-5v and the output is 0-3.3v.
jremington:
But why use a voltage divider?
I have an esp8266-12F with ADC pin that reads between 0-1v so i need to divide the voltaje.
I did not work with the esp8266 so I tried to do it with the arduino to do tests. Once I work with the arduino, I will do something similar but with the wifi module. For the esp8266 i should use a resistance of 220 and another of 100, that way could go from 0-3.3v to 0-1v. This test did not work, either. I preferred to leave aside the wifi module because it is more complex to use it, that's why I am doing the tests in arduino. When I run this with arduino I will do something similar with the esp8266.
Thank you!
There is nothing wrong with your wiring diagram. That leaves the sensor.
Use a multimeter to check the sensor output voltage, with and without the divider.
jremington:
There is nothing wrong with your wiring diagram. That leaves the sensor.
Use a multimeter to check the sensor output voltage, with and without the divider.
I just tried a new sensor just taken out of its packaging, and the same thing happens.
This is the sensor:
AMPLIFIER: MAX9812
ELECTRET CZN-15E
I have a digital multimeter :(, so is more dificult.
With this multimeter and with divider, i read 0V
With this multimeter and without divider, i read 0V-0.6V (but I guess it's not reliable)
It's very strange, I can not think what else to try.
I connect the microphone output to the analog input of the Arduino and it gives me values close to 300 in silence.
I disconnect the microphone output from the Arduino and connect it to the voltage divider (and this to the Arduino), and I read 0 in silence! (not 150)
It works perfect with a constant voltage, such as a battery. With a battery of 5v with this voltage divider i read 512 (2.5v).
There is a possibility that it does not work with voltage waves as in this case?
According to the data sheet of the MAX9812 chip, it can source/sink some 20 mA on its output, so even the rather low 2x470 Ohm to GND shouldn't cause a problem (that's about 3.5 mA at 3.3V).
One thing you can do as test is to connect the sensor the normal way, then add a resistor of say 10k between the sensor output and GND. It shouldn't change a thing. Same for adding a separate resistor between output and Vcc.
These days, almost all multimeters are digital, so I don't understand why you think the meter should be problem.
However, the multimeter readings you reported don't make any sense either.
Does the meter indicate about 3.3V for the "3.3V Vcc"?
Excuse me for jumping in here, but, after looking at the schematic pictures Google showed me, I see the output of these boards is capacitor coupled. So NO DC should ever come from the output of the sensor.
Perhaps you need to rectify and filter the output to get a DC signal.
Paul
Paul_KD7HB:
Excuse me for jumping in here, but, after looking at the schematic pictures Google showed me, I see the output of these boards is capacitor coupled. So NO DC should ever come from the output of the sensor.
If it's capacitor coupled, then indeed no DC. That would pretty much explain the whole picture OP is seeing.
But the problem is: there appear to be various different "sound sensor" boards based on these components, and OP didn't provide any information on which exact sensor they have. I found various such circuit diagrams, some have a capacitor on the output, others have an extra opamp after that capacitor (so can produce DC current), yet others have multiple outputs including sound and a digital output.
So, OP: please provide more details on the exact sensor you have! Schematics would be perfect.
Capacitor coupling is inconsistent with this observation from the OP:
This same, connected to the analogue port of the Arduino, gives me values between 0-660.
In silence he gives me values close to 330.
However, a leaky output capacitor, combined with the 100 MOhm+ analog input impedance, would explain all the observations.
jremington:
However, a leaky output capacitor, combined with the 100 MOhm+ analog input impedance, would explain all the observations.
You mean, like a real world, el-cheapo capacitor on a no-brand board.
Hello everyone. Thank you very much for all your contributions.
I chose to make a sound sensor with the following guide:
With it I was able to solve the problem. With this new sensor I was able to correctly use a voltage divider and it works.
For some reason, with the previous sensor I could not.
antonellif:
Hello everyone. Thank you very much for all your contributions.
I chose to make a sound sensor with the following guide:
LM358 microphone amplifier | Low voltage. Mostly harmless...
With it I was able to solve the problem. With this new sensor I was able to correctly use a voltage divider and it works.
For some reason, with the previous sensor I could not.
Good for you! Now, can you modify the old board with the new parts so you don't have a breadboard all the time?
Paul