Difference between revisions of "Sensor-MIC"

From Microduino Wiki
Jump to: navigation, search
(Programming)
 
(2 intermediate revisions by the same user not shown)
Line 81: Line 81:
  
 
==Example==
 
==Example==
This is a simple example which outputs the state of the Mic Sensor to the serial port terminal.
+
This is a simple example which outputs the value of the Mic Sensor to the serial port terminal.
  
 
'''Note''': Important lines of code are highlighted.
 
'''Note''': Important lines of code are highlighted.
Line 115: Line 115:
 
Copy and paste the code above to the Arduino IDE or
 
Copy and paste the code above to the Arduino IDE or
  
Download the above example:  
+
Download the above example: n/a
  
*Open the Serial Monitor (magnifier glass on top right) and set 9600 baud. This will display the serial output data.
+
*Open the Serial Monitor (magnifier glass on top right) and set 9600 baud. This will display the serial output.
 
</tab>
 
</tab>
  

Latest revision as of 19:26, 18 August 2017

Language: English  • 中文
Microduino-Sound

The product number of Sensor-MIC is: MSDT11

Sensor-MIC is sound detection sensor module.

Electret microphone is composed of sound electric conversion and impedance conversion. The key component of sound electric conversion is electret diaphragm, which is a slice of thin plastic film of which one side is steamed with a layer of metal film, and after the electret by high voltage field, the two sides respectively has opposite charges, the steamed gold face of the diaphragm is outward, and is connected with the metal case. In the electret microphone, there is a field effect tube to do pre amplifier, so a certain blas voltage is needed when the electret microphone is working normally, which is generally not greater than 10v.

Instruction of Sensor Pin

Sensor backpin.png

Microphone Sensor
General Pin Out Sensor / Trinket's Pin Out
PIN1 (GND) GND
PIN2 (VCC) VCC
PIN3 (SIGNAL-A) Analog Input
PIN4 (SIGNAL-B) Not Connected
  • General Pin Out is the standard pin out of a Sensor / Trinket connector.
  • Sensor / Trinket's Pin Out is this specific Sensor / Trinket's wiring in relation to the General Pin Out.
  • SIGNAL-A / SIGNAL-B are signals that could be digital input, digital output, analog input or analog output. Or special signals such as serial communication (SoftwareSerial, IIC (I2C), etc) or other special signals.
  • Not Connected refers to the Pin not being used for this particular Sensor / Trinket.
  • Read more about the hub module.

Features

  • Capacitive sound detection component
  • Low power and high sensitivity
  • With small size which is easy to install

Specification

  • Voltage
    • Working voltage: 3.3V~5V
  • Size
    • Size of the board: 23.5mm*13mm
    • 1.27mm-spacing 4Pin interface connected to sensorhub
    • The CAD drawing of the sensor: File:Sensor CAD.zip
  • Technical parameters
    • Measuring voltage: 0~5V(measuring frequency range 100Hz~4000Hz)
    • Measuring sound intensity: 45~120dB
    • Accuracy: ±1%
  • Connection
    • This sensor can be connected to the following interfaces of core: A0~A7

Document

Usage

Basic Functionality

The Mic Sensor is an analog input sensor. It is able to detect noise levels based on air vibrations. A Core module can read the voltage value.

Mic Sensor State Table
Noise Level Value Produced
Absolute Silence 0
Ambient Background Noise <40
Snapping Fingers / Talking 75~200
Amps that are "Up to eleven" 1023

Programming

Introduction

The Mic Sensor is used as an analog input pin. Therefore, the pinMode and analogRead functions will be used.

Key Functions

  • Required Libraries: None
  • Key Functions:
    • pinMode(pin_number, pin_mode) - sets the mode for the pin
      • pin_number - is the pin number that the sensor is connected to
      • pin_mode - is the mode to set the pin to. Either INPUT or OUTPUT
    • analogRead(pin_number) - Reads the value of the pin, between 0 and 1023
      • pin_number - is the pin number that the sensor is connected to

Example

This is a simple example which outputs the value of the Mic Sensor to the serial port terminal.

Note: Important lines of code are highlighted.

//Define the pin the sensor is connected to
//Note: This sensor uses analog read, which means only pins denoted with an 'A' prefix will work.
const int MIC_SENSOR_PIN = A0;

void setup(){
  // put your setup code here, to run once:

  //Initial serial communication port at 9600 baud
  Serial.begin(9600);

  //Configure the pin into input mode
  pinMode(MIC_SENSOR_PIN, INPUT);
}

void loop(){
  // put your main code here, to run repeatedly:

  //Perform a digital read and store the value into pin_state variable
  int pin_value = analogRead(MIC_SENSOR_PIN);

  //Print out the current value of the sensor
  Serial.println(pin_value);

  //delay 10ms between loops
  delay(10);
}

Copy and paste the code above to the Arduino IDE or

Download the above example: n/a

  • Open the Serial Monitor (magnifier glass on top right) and set 9600 baud. This will display the serial output.

Program Download

Programming

  • Follow the Software Getting Started Guide.
  • Select the Board, Processor and Port.
  • Click [File]->[Open], browse to the project program address, and click "Sensor-MIC Test.ino" to open the program.
  • After confirming all these items are correct, click "→" to download the program to the development board.

Hardware Setup

  • Referring to the following diagram, connect the Sensor-MIC to the analog interface A0/A1 of Microduino-Sensorhub


Microduino-sLight A1.JPG


Result

  • After download, open the serial monitor.
  • The value displayed in the serial monitor reflects the current sound intensity detected by the MIC sensor.

Application

It can be used to collect sound or detect the sound shaking.

Project

  • Sensor-MIC

Purchase

History

Gallery

  • Front
File:Microduino-Sound-F1.JPG
Sensor-Sound Front
  • Back
Retrieved from "https://wiki.microduinoinc.com/index.php?title=Sensor-MIC&oldid=21605"