Microphone Sound Detection

From Microduino Wiki
Jump to: navigation, search

Function of the Module

  • Please refer to: Sound Detection Sensor
  • As an analog input sensor, the values it detect have a certain range, which is 0-1023 theoretically. Besides, the value is changeable.

Overview

To use the sound/microphone(MIC) sensor to detect sound and check data in the serial monitor.

Bill of Material

  • Module
Module Number Function
mCookie-CoreUSB 1 Core board
mCookie-Hub 1 Sensor pin board
Microduino-Sound 1 Sound detection sensor
  • Other Hardware Equipment
    • One USB cable USB
Mic-phone.jpg

Hardware Buildup

  • Setup 1: Connect the MIC sensor with the A0 analog port of the Hub, which is the control pin of the MIC. Therefore, MIC is an analog sensor. Users can change the analog port to A2 or A4 on your own.
MCookie-Sound-sensor.JPG
  • Setup 2: Connect the CoreUSB, Hub and the Sound sensor to the computer with a USB cable.
MCookie-Sound-pc.JPG

Mixly Programming

  • Step1: Since using serial monitor, we need to find "Serial Communication" from "Communication" item.
Mixly Serial.jpg
  • Step2: "Serial Communication" description.
  • Step3: MIC sound sensor is an input device and the value of the sound has a certain range while the returned data is digital quantity, based on which we can find and drag out the digital input and output from "Input/Output".
  • "Analog Input" description.
  • Overall code description.

Debugging

  • Step1: Select the right board card(Core USB 32U4) and COM port(Recognized automatically by default).
Mixly board COM.jpg
  • Step2: Open the serial monitor.
Mixly COMXX.jpg
  • Step3: Check if the serial baud rate is the same with the pre-set one.
Mixly COMXX ok.jpg
  • Step4: Check the data and you'll find: When there is no sound around the sensor, the data is about 10. And the data is getting bigger along with the sound becoming louder, the maximum is about 700.

Extension

  • To trigger and perform some tasks by judging the sound value.
  • Example code
  • "Logic" description
  • "Comparison" description