lbf20012001
Published © GPL3+

Sound Direction Tester

In this video, I test two DAOKI microphone sensors with my Arduino Uno to create a sound direction tester.

BeginnerFull instructions provided12,096
Sound Direction Tester

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
USB-A to B Cable
USB-A to B Cable
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 330 ohm
Resistor 330 ohm
×2
5 mm LED: Red
5 mm LED: Red
×2
DAOKI High Sensitivity Sound Microphone Sensor Detection Module For Arduino AVR PIC
×2

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Extraction Tool, 6 Piece Screw Extractor & Screwdriver Set
Extraction Tool, 6 Piece Screw Extractor & Screwdriver Set
Breadboard, 830 Tie Points
Breadboard, 830 Tie Points

Story

Read more

Schematics

Fritzing Diagram

Fritzing Diagram

Code

SoundDirectionFinder

Arduino
This code/sketch makes finding the general direction of sound easy. This code/sketch drives to LEDs to indicate which of two microphones is receiving an audible sound.
If both microphone sensors detect sound both (left and right) LEDs light indicating that both microphones have detected sound. If one microphone sensor (left or right) detects sound,
then the corresponding LED (left or right) will light up. If both microphone sensors detect sound then both LEDs will light up.
/*
 File/Sketch Name: SoundDirectionFinder

 Version No.: v1.0 Created 14 August, 2019
 
 Original Author: Clyde A. Lettsome, PhD, PE, MEM
 
 Description:  This code/sketch makes finding the general direction of sound easy. This code/sketch drives to LEDs to indicate which of two microphones is receiving an audible sound.
 If both microphone sensors detect sound both (left and right) LEDs light indicating that both microphones have detected sound. If one microphone sensor (left or right) detects sound,
 then the corresponding LED (left or right) will light up. If both microphone sensors detect sound then both LEDs will light up.


 License: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) version 3, or any later
 version of your choice, as published by the Free Software Foundation.

 Notes: Copyright (c) 2019 by C. A. Lettsome Services, LLC
 For more information visit https://clydelettsome.com/blog/2019/08/15/my-weekend-project-sound-direction-tester/

 */

int leftLedPin=13;
int rightLedPin=12;
int rightSensorPin=7;
int leftSensorPin=8;
boolean rightVal = 0;
boolean leftVal = 0;

void setup()
{
  pinMode(leftLedPin, OUTPUT);
  pinMode(rightLedPin, OUTPUT);
  pinMode(leftSensorPin, INPUT);
  pinMode(rightSensorPin, INPUT);
  Serial.begin (9600);
}
  
void loop ()
{
  rightVal =digitalRead(rightSensorPin);
  leftVal =digitalRead(leftSensorPin);
  
  // when the sensor detects a signal above the threshold value, LED flashes
  if (leftVal==LOW && rightVal==LOW) 
  {
    digitalWrite(leftLedPin, LOW);
    digitalWrite(rightLedPin, LOW);
    Serial.println("None");
  }
  else if (leftVal==LOW && rightVal==HIGH)
  {
    digitalWrite(leftLedPin, LOW);
    digitalWrite(rightLedPin, HIGH);
    Serial.println("Right");
  }
  else if (leftVal==HIGH && rightVal==LOW)
  {
    digitalWrite(leftLedPin, HIGH);
    digitalWrite(rightLedPin, LOW);
    Serial.println("Left");
  }
  else 
  {
    digitalWrite(leftLedPin, HIGH);
    digitalWrite(rightLedPin, HIGH);
    Serial.println("Both");
  }
}

Credits

lbf20012001
5 projects • 32 followers
Contact

Comments

Please log in or sign up to comment.