Arduino sound detector false readings

Hey. I am trying to make addressable led lights react to music with arduino nano. Im just a beginner so dont blame. First problem i have encountered is that I am getting very random readings from my sound detector I am using. It jums from 0 to maximum value 1023 even in complete silence. Doesnt react to music much at all. Not sure what is wrong or my sound detector is broken.

#include <FastLED.h>

#define NUM_LEDS 120
#define LED_PIN 6
#define soundSensorPin 0

CRGB leds[NUM_LEDS];

void setup()
{
Serial.begin(9600);
pinMode (soundSensorPin, INPUT);
FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, NUM_LEDS);
for (int i = 0; i < NUM_LEDS; i++)
leds = CRGB(0, 100, 255);

  • FastLED.show();*
  • delay(1000); *
    }
    void loop()
    {
  • int sensor_value = analogRead (soundSensorPin);*
  • //If 0, discard immediately. Probably not right and save CPU.*
  • if (sensor_value == 0)*
  • return;*

int show_leds = map(sensor_value,0,750,0,120);
for(int i = 0;i<NUM_LEDS;i++){

First read the "how to use this forum" post and edit your original post. The forum software has eaten some of your code.

Second, did you think it might be useful information to describe the "sound sensor" or give us a part number we can look up? Prefereably a web link (in [ url] tags) for where you bought it.

Im sorry. The sound detector i have used is bought from ebay
http://www.ebay.co.uk/itm/Microphone-Sound-Detector-Module-Sensor-Analogue-Digital-Arduino-Raspberry-Pi-/322486950584

Do you get anything different from the module's two outputs? Analog and Digital should be different. You are describing the behaviour of the digital output connected to an analog input.

Does adjusting the trimpot do anything?

This is probably going to work poorly as a beat detector. Usually you need some analog filtering to remove any high frequency sound energy in order to detect the low-frequency drumbeats. It would be worthwhile expanding your search to more expensive modules.

I have connected analogue input of sound detector to analogue pin of arduino so they both analogue? Yeah i did not expect anything great from it but jumping from 0 to maximum and random values are not what i expected to see.. Il have a look at some more expensive ones

Sound sensors react to sound. Any sound.
It's up to you to use it correctly.
Print the values you are seeing.
Show how you have it hooked up. Clearly.

The readings im getting is on the first post of the tread i have attached it. Adding another picture of my circuit. Its confusing but i can try to explain.
analogue pin from sound sensor > A0 pin of arduino
D6 pin of arduino > LED drive pin
all share chips share same +5v and same ground. there is not much else to it

Are those jumpers literally sitting loose in the board holes? Or did you solder?

.

Okay... Very strange thing are happening. I have tryed chaning the number of leds to 15 instead of 120. Firstly when i uploaded the sketch, 15 leds kept blinking randomly until i disconnected +5v and connected again. Now 15 Leds react fine to music. I have tryed with 25 aswell it kinda works but seems that the more leds i use the worse sound detector readings get.

And these jumpers are loose in the breadboard holes. i always built everything on breadboard to check if its working and then i solder it all

How.are.they.connected.to.the.nano.

Answer- they aren't.

I have soldered wires to nano, i have left loose the other end of the jumper that goes to the breadboard. the connections are fine

Random leds, what's the deal with that blue gnd hanging off the converter?

If you are going to have long jumpers like that be sure to run each signal wire in parallel with a ground
wire, otherwise you'll risk picking up interference - you effectively have a set of random loop-antennas.

Neat and compact layout is less likely to have such issues. Can't say if thats the problem, but best to
improve the layout in case.

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Including your power supply.

NOT a Fritzy Picture.....

Thanks.. Tom.. :slight_smile:

Leds on the side of the breadboard are not connected to the part of the circuit im working althought i have removed them. I took blue wire from converter out of the circuit for the second i was taking picture to disconnect the power from the circuit.