Project showcase
Sound monitoring system

Sound monitoring system © GPL3+

A simple sound monitoring system using a microphone and a small amplifier with LM386.

  • 10,211 views
  • 4 comments
  • 23 respects

Components and supplies

Ardgen mega
Arduino Mega 2560 & Genuino Mega 2560
×1
LM386 microphone amplifier
×1

Apps and online services

About this project

I made it to monitor wild animals&birds entering a barn and making noises.

You can use for all kinds of automation :) (at first I used it as a sound-controlled lamp on/off switch).


Because you can't really use a microphone directly with Arduino we need to amplify the signal from it. An easy solution is to use an LM386 (an integrated circuit containing a low voltage audio power amplifier).

The schematics for the amplifier module is attached here (the original one is taken from wiring.org.co website).


Once you put on a PCB, in order to make it work with the code I wrote just hook it up to +5V/GND from your Arduino and the output from the amplifier to A0 (analog pin 0) from your Arduino board.

That's all :)

Code

sound_monitoring.inoArduino
// Threshold (sound)
int mic_threshold = 500;
// Input pin .. on analog side
int pin_mic = 0;
// Ticks needed to change the state of the system
int ticks_needed = 100;

int mic_value;
int is_on = false;
int ticks = ticks_needed;

void setup()
{
  Serial.begin(9600);
}


void loop()
{
  // Audio value
  mic_value = analogRead(pin_mic);
  // Serial.println(mic_value, DEC);
  
  // Is the read value ok? + did we had X ticks of silence?
  if (mic_value >= mic_threshold && ticks > ticks_needed)
  {
    // System on or off?
    if (is_on == 0)
    {
      is_on = 1;
      // Do ACTION 1
    }
    else
    {
      is_on = 0;
      // Do ACTION 2
    }
    ticks = 1;
  }
  else
  {
    if (ticks > ticks_needed)
    {
      ticks = ticks_needed + 1;
    }
    else
    {
      ticks++;
    }
  }
  delay(10);
}

Schematics

LM386 microphone amplifier
Screenshot%20from%202016 01 22%2016 45 39

Comments

Similar projects you might like

Real time LPG monitoring system

Project showcase by TEAM DIY

  • 2,210 views
  • 1 comment
  • 2 respects

Water Quality Monitoring and Notification System

Project showcase by emmanuel ani

  • 50,587 views
  • 38 comments
  • 112 respects

Plant Monitoring System using AWS IoT

Project tutorial by CJA3D

  • 30,463 views
  • 6 comments
  • 77 respects

Baby-Pram Monitoring System

Project tutorial by IP

  • 7,061 views
  • 4 comments
  • 13 respects

Home/Hotel Monitoring System with Automated controls

Project tutorial by Anas Siddiqui

  • 4,182 views
  • 10 comments
  • 15 respects
Add projectSign up / Login