How to Use Arduino Sound Sensor Module with NODE MCU – Sound Controlled LED Project

In this project we will see how to use the arduino sound sensor module as an input device to the NODE MCU. And just to make sure everything is working fine we will connect a LED which will switched on/off based on the external sound.

Things you will need:

Arduino sound sensor module – I have used a 3 pin digital sound sensor but you can also use the 4 pin analog one.

Node MCU board

Blue LED

5V power supply

Jumper wires

Circuit Diagram:

Sound Controlled LED with NODE MCU

Now open the Arduino IDE, select NODEMCU as board. Put the following code, connect your board with the pc and upload:

const int LED = D5;
const int SOUNDSENSOR = D0;
const int threshold =1023;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
Serial.println(“— Start Serial Monitor SEND_RCVE —“);
Serial.println(analogRead(SOUNDSENSOR));
pinMode(SOUNDSENSOR, INPUT);
pinMode(LED, OUTPUT);
//pinMode (ledPin, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:

int soundsens=analogRead(SOUNDSENSOR); // read analog data from sensor
Serial.println(soundsens);
if (soundsens>=threshold) {
digitalWrite(LED, HIGH); // turn led on
delay(1000);
}
else{
digitalWrite(LED, LOW);
//Serial.write(‘low’);
}
}


After you finished putting everything as per the circuit, it should look like below:

After wiring NODE MCU LED and Power Supply

Debashri, Founder of Rentorsa

Hi, I am Debashree. Apart from managing this webshop, i am also passionate about cooking ( you will see the recipes in our youtube channel), singing, writing and teaching.

Leave a Reply