I am quite new to the Arduino, I have an Arduino Nano and i bought the soundsensor Lm393 and some leds. My thought was to make them work together so when a sound is detected the led will light up and when no sound is recognized the light wont light up. I have tried this code that I found on Youtube but it didn’t work for me. This is what I used, do you guys have any tips for how I could do?
int ledPin = 11;
int soundSensor = 5;
void setup ()
pinMode (soundSensor, INPUT);
pinMode (ledPin, OUTPUT);
void loop ()
int statusSensor = digitalRead(soundSensor);
if (statusSensor == 1)
Code should work. Post your schematic or wiring diagram.
The LM393 is just the comparator chip used on the sound sensor board.
Do you have a link to the sound sensor?
Is there an adjustment potentiometer on the sound sensor?
Maybe you just need a louder sound?
My thought was to make them work together so when a sound is detected the led will light up and when no sound is recognized the light wont light up.
Depending on what your ultimate goal is... You don't need a microcontroller to do that...
The LM393 could directly-drive a regular LED, but the current is a little low so it can't drive it to "full brightness", and the logic would be reversed (with the existing circuit) because it can only "sink" current, which means the LED is on when the output is low. But, you could add a little (low power) transistor to invert the logic and fully-power the LED.