user87993: I just bought a microphone for my Ardoino Nano 33 BLE. The mic can use both Analog and Digital input. Here is the mic and how it's connected. 
Here is the code where I read the input
int sensorPin = A5; // select the input pin for the potentiometer
int sensorValue = 0;
void setup ()
{
 Serial.begin (9600);
}
void loop ()
{
 sensorValue = analogRead (sensorPin);
 delay (500);
 Serial.println (sensorValue, DEC);
}

I've followed an example by the manufacturer and the reads are going random between 0 and 5 sometimes a little higher. It states in the example that it should go up to 1023.
Is something wrong, can I have connected something wrong that would make this? Also when I give 5v nothing happens on the Mic but if I connect 3.3v the mic turns on 2 red led lights and gives me a value around 80 but doesnt respond to any sounds.

user54765: /* edited to specifically provide a potential solution as commented by @jstola */
You have posted a picture of a ubiquitous sound detection sensor - typically a Keyes KY-037.
It is based on an LM393 dual comparator.

The board has a digital output [marked DO] and an analog output marked AO. It also has + and G (Ground) connections.

I dug mine out and attached it to a Nano 33 BLT.

Notice that I have + connected to 3.3v, G connected to ground and AO connected to A5.
A little trick is to connect just power and ground and turn the potentiometer until L2 (that's the LED nearest the pot) turns off. If you make some noise, you will see L2 flash briefly. This sets the digital output threshold and works well for testing the analog out.
Then I ran this simple program (very similar to yours)
void setup() {
  pinMode(A5,INPUT); // not absolutely needed in this case
  Serial.begin(9600);
}
void loop() {
  Serial.println(analogRead(A5));
} 

Opened the Arduino IDE serial plotter (shift+ctr+L) and watched the waveform change when I snapped my fingers - see the spikes?.

So what is the solution to your problem that is does not work?
A couple of possibilities.

You have a different board.

Does your board look just like the one I posted or does it look different? If it is a different board then what you posted, that is another matter.
Assuming it is the same board (or at least the same generic board), it is possible that:

You don't have the connections correct. Double check that.

You don't have the pot set near the mid point - follow the direction for that and observe that the LED can be turned off. That is a multi-turn pot and if you hear a little 'click', you went too far in that direction - move it the other way and see if you can get that LED to just turn off.

Failing any of those, your board could be toast



87993: <p>I just bought a microphone for my Ardoino Nano 33 BLE. The mic can use both Analog and Digital input. Here is the mic and how it's connected. <a href="https://i.stack.imgur.com/hWjof.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hWjof.png" alt="Mic and connection" /></a></p>
<p>Here is the code where I read the input</p>
<pre><code>int sensorPin = A5; // select the input pin for the potentiometer
int sensorValue = 0;
void setup ()
{
 Serial.begin (9600);
}
void loop ()
{
 sensorValue = analogRead (sensorPin);
 delay (500);
 Serial.println (sensorValue, DEC);
}
</code></pre>
<p>I've followed an example by the manufacturer and the reads are going random between 0 and 5 sometimes a little higher. It states in the example that it should go up to 1023.</p>
<p>Is something wrong, can I have connected something wrong that would make this? Also when I give 5v nothing happens on the Mic but if I connect 3.3v the mic turns on 2 red led lights and gives me a value around 80 but doesnt respond to any sounds.</p>
 54765: <p>/* edited to specifically provide a potential solution as commented by @jstola */</p>
<p>You have posted a picture of a ubiquitous sound detection sensor - typically a Keyes KY-037.</p>
<p>It is based on an LM393 dual comparator.
<a href="https://i.stack.imgur.com/FMnAD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FMnAD.jpg" alt="LM393" /></a></p>
<p>The board has a digital output [marked DO] and <strong>an analog output marked AO</strong>. It also has + and G (Ground) connections.
<a href="https://i.stack.imgur.com/9aZL4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9aZL4.jpg" alt="keyes sound board" /></a></p>
<p>I dug mine out and attached it to a Nano 33 BLT.</p>
<p><a href="https://i.stack.imgur.com/a4ySM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a4ySM.jpg" alt="Nano 33 BLT with sound sensor" /></a></p>
<p>Notice that I have + connected to 3.3v, G connected to ground and AO connected to A5.</p>
<p>A little trick is to connect just power and ground and turn the potentiometer until L2 (that's the LED nearest the pot) turns off. If you make some noise, you will see L2 flash briefly. This sets the digital output threshold and works well for testing the analog out.</p>
<p>Then I ran this simple program (very similar to yours)</p>
<pre><code>void setup() {
  pinMode(A5,INPUT); // not absolutely needed in this case
  Serial.begin(9600);
}
void loop() {
  Serial.println(analogRead(A5));
} 
</code></pre>
<p>Opened the Arduino IDE serial plotter (shift+ctr+L) and watched the waveform change when I snapped my fingers - see the spikes?.</p>
<p><a href="https://i.stack.imgur.com/dR86t.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dR86t.jpg" alt="serial plotter waveform" /></a></p>
<p>So what is the solution to your problem that is does not work?</p>
<p>A couple of possibilities.</p>
<ol>
<li>You have a different board.</li>
</ol>
<p>Does your board look just like the one I posted or does it look different? If it is a different board then what you posted, that is another matter.</p>
<p>Assuming it is the same board (or at least the same generic board), it is possible that:</p>
<ol start="2">
<li><p>You don't have the connections correct. Double check that.</p>
</li>
<li><p>You don't have the pot set near the mid point - follow the direction for that and observe that the LED can be turned off. That is a multi-turn pot and if you hear a little 'click', you went too far in that direction - move it the other way and see if you can get that LED to just turn off.</p>
</li>
<li><p>Failing any of those, your board could be toast</p>
</li>
</ol>
