Skip to main content
deleted 13 characters in body; edited title
Source Link
dda
  • 1.6k
  • 1
  • 12
  • 18

Problem with simple sound detection circuit using a microphone

I am very new to this community  . My first project with Arduino was using a LDR  ( lightlight dependent resistor) in a circuit like this:

enter image description here

The input iI got was as expected between 0 - 1023.

I then tried a similar project this time using a sound sensor like this:

enter image description here

My circuit wasis as follows -:

  1. A0 on mic to A0 on arduinoArduino
  2. GND to GND
  3. +ve to 5V
  4. ledLED along with resistor to digital pin 9 on arduinoArduino

My program is as follows  :

const int analogInPin = A0; 
 
int sensorValue = 0;             

void setup() {
  pinMode(analogInPin, INPUT);
  pinMode(9, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\n");
  if(sensorValue > 900 )
    digitalWrite(9,HIGH);
  else
  digitalWrite(9,LOW);
 
}

The problem is the serial monitor gives a weird reading, randomly giving 1023 and 0 after regular intervals.

sensor = 124
sensor = 0
sensor = 1023
sensor = 39
sensor = 352
sensor = 1023
sensor = 142
sensor = 0
sensor = 1023
sensor = 44
sensor = 338
sensor = 1023
sensor = 163
sensor = 0
...
...

I can't figure out the problem myself so I came here.

Problem with simple sound detection circuit using microphone

I am very new to this community  . My first project with Arduino was using a LDR( light dependent resistor) in a circuit like this:

enter image description here

The input i got was as expected between 0 - 1023.

I then tried a similar project this time using a sound sensor like this:

enter image description here

My circuit was as follows -

  1. A0 on mic to A0 on arduino
  2. GND to GND
  3. +ve to 5V
  4. led along with resistor to digital pin 9 on arduino

My program is as follows  :

const int analogInPin = A0; 
 
int sensorValue = 0;            
void setup() {
  pinMode(analogInPin,INPUT);
  pinMode(9,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\n");
  if(sensorValue > 900 )
  digitalWrite(9,HIGH);
  else
  digitalWrite(9,LOW);
 
}

The problem is the serial monitor gives a weird reading, randomly giving 1023 and 0 after regular intervals.

sensor = 124
sensor = 0
sensor = 1023
sensor = 39
sensor = 352
sensor = 1023
sensor = 142
sensor = 0
sensor = 1023
sensor = 44
sensor = 338
sensor = 1023
sensor = 163
sensor = 0
...
...

I can't figure out the problem myself so I came here.

Problem with simple sound detection circuit using a microphone

I am very new to this community. My first project with Arduino was using a LDR  (light dependent resistor) in a circuit like this:

enter image description here

The input I got was as expected between 0 - 1023.

I then tried a similar project this time using a sound sensor like this:

enter image description here

My circuit is as follows:

  1. A0 on mic to A0 on Arduino
  2. GND to GND
  3. +ve to 5V
  4. LED along with resistor to digital pin 9 on Arduino

My program is as follows:

const int analogInPin = A0; 
int sensorValue = 0;             

void setup() {
  pinMode(analogInPin, INPUT);
  pinMode(9, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\n");
  if(sensorValue > 900)
    digitalWrite(9,HIGH);
  else
  digitalWrite(9,LOW);
}

The problem is the serial monitor gives a weird reading, randomly giving 1023 and 0 after regular intervals.

sensor = 124
sensor = 0
sensor = 1023
sensor = 39
sensor = 352
sensor = 1023
sensor = 142
sensor = 0
sensor = 1023
sensor = 44
sensor = 338
sensor = 1023
sensor = 163
sensor = 0
...
...

I can't figure out the problem myself so I came here.

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user

iI am very new to this comunitycommunity . My first project with arduinoArduino was using ldra LDR( light dependent resistance resistor) in a circuit like this .this:

enter image description here

The input i got was as expected between 0 - 1023.

I then tried a similar project this time using a sound sensor like thisthis:

myenter image description here

My circuit was as follows -

  1. A0 on mic to A0 on arduino
  2. GND to GND
  3. +ve to 5V
  4. led along with resistor to digital pin 9 on arduino

myMy program is as follows :

const int analogInPin = A0; 

int sensorValue = 0;            
void setup() {
  pinMode(analogInPin,INPUT);
  pinMode(9,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\n");
  if(sensorValue > 900 )
  digitalWrite(9,HIGH);
  else
  digitalWrite(9,LOW);

}

theThe problem is the serial monitor gives a weird reading  ,randomly randomly giving 1023 and 0 after regular intervals.

sensor = 124
sensor = 0
sensor = 1023
sensor = 39
sensor = 352
sensor = 1023
sensor = 142
sensor = 0
sensor = 1023
sensor = 44
sensor = 338
sensor = 1023
sensor = 163
sensor = 0
...
...

i cantI can't figure out the problem myself so I came here thanks.

i am very new to this comunity . My first project with arduino was using ldr( light dependent resistance ) in a circuit like this . The input i got was as expected between 0 - 1023.

I then tried a similar project this time using a sound sensor like this

my circuit was as follows -

  1. A0 on mic to A0 on arduino
  2. GND to GND
  3. +ve to 5V
  4. led along with resistor to digital pin 9 on arduino

my program is as follows :

const int analogInPin = A0; 

int sensorValue = 0;            
void setup() {
  pinMode(analogInPin,INPUT);
  pinMode(9,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\n");
  if(sensorValue > 900 )
  digitalWrite(9,HIGH);
  else
  digitalWrite(9,LOW);

}

the problem is the serial monitor gives a weird reading  ,randomly giving 1023 and 0 after regular intervals

sensor = 124
sensor = 0
sensor = 1023
sensor = 39
sensor = 352
sensor = 1023
sensor = 142
sensor = 0
sensor = 1023
sensor = 44
sensor = 338
sensor = 1023
sensor = 163
sensor = 0
...
...

i cant figure out the problem myself so came here thanks.

I am very new to this community . My first project with Arduino was using a LDR( light dependent resistor) in a circuit like this:

enter image description here

The input i got was as expected between 0 - 1023.

I then tried a similar project this time using a sound sensor like this:

enter image description here

My circuit was as follows -

  1. A0 on mic to A0 on arduino
  2. GND to GND
  3. +ve to 5V
  4. led along with resistor to digital pin 9 on arduino

My program is as follows :

const int analogInPin = A0; 

int sensorValue = 0;            
void setup() {
  pinMode(analogInPin,INPUT);
  pinMode(9,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\n");
  if(sensorValue > 900 )
  digitalWrite(9,HIGH);
  else
  digitalWrite(9,LOW);

}

The problem is the serial monitor gives a weird reading, randomly giving 1023 and 0 after regular intervals.

sensor = 124
sensor = 0
sensor = 1023
sensor = 39
sensor = 352
sensor = 1023
sensor = 142
sensor = 0
sensor = 1023
sensor = 44
sensor = 338
sensor = 1023
sensor = 163
sensor = 0
...
...

I can't figure out the problem myself so I came here.

Source Link
95_96
  • 131
  • 1
  • 1
  • 3

Problem with simple sound detection circuit using microphone

i am very new to this comunity . My first project with arduino was using ldr( light dependent resistance ) in a circuit like this . The input i got was as expected between 0 - 1023.

I then tried a similar project this time using a sound sensor like this

my circuit was as follows -

  1. A0 on mic to A0 on arduino
  2. GND to GND
  3. +ve to 5V
  4. led along with resistor to digital pin 9 on arduino

my program is as follows :

const int analogInPin = A0; 

int sensorValue = 0;            
void setup() {
  pinMode(analogInPin,INPUT);
  pinMode(9,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  sensorValue = analogRead(analogInPin);
  Serial.print("sensor = ");
  Serial.print(sensorValue);
  Serial.print("\n");
  if(sensorValue > 900 )
  digitalWrite(9,HIGH);
  else
  digitalWrite(9,LOW);

}

the problem is the serial monitor gives a weird reading ,randomly giving 1023 and 0 after regular intervals

sensor = 124
sensor = 0
sensor = 1023
sensor = 39
sensor = 352
sensor = 1023
sensor = 142
sensor = 0
sensor = 1023
sensor = 44
sensor = 338
sensor = 1023
sensor = 163
sensor = 0
...
...

i cant figure out the problem myself so came here thanks.