Analog microphone (sound sensor)

Technical specifications

  • Sensor model: EM9767P
  • Operating temperature: −20 to +60 °C
  • Storage temperature: −30 to +70 °C
  • Ambient humidity: 60–70%
  • Atmospheric pressure: 860–1060 hPa
  • Sensitivity: −59 to −53 dB
  • Output impedance: 2.2 kΩ
  • Maximum current: 500 μA
  • Signal-to-noise ratio: 55 dB
  • Voltage reduction: −3 dB
  • Operating voltage: 1–10 V
  • Dynamic range: 100 dB

Description

The sound sensor is your robot's “ears”. It outputs an analog signal proportional to the loudness of surrounding sounds.

Use

Connection

The sensor uses a standard 3-pin connector and connects to any IN port on Trackduino.

Programming

The required blocks are in the “Sensors” block group.

Block and generated functionDescription
Analog microphone reading block

int micAnalog(int port)
Returns a value from 0 to 1023 corresponding to the loudness of the sound received.

Argument: int port — the port the sensor is connected to.

The threshold microphone block Threshold microphone reading block does not work with this sensor; it is intended for the digital microphone.

Project example

Noise level meter

Generated code:

int _ABVAR_1_SoundLevel = 0 ;

void setup()
{
  pinMode( OUT1 , OUTPUT );
  pinMode( OUT2 , OUTPUT );
  pinMode( OUT3 , OUTPUT );
}

void loop()
{
  _ABVAR_1_SoundLevel = micAnalog(IN1) ;
  if (( ( _ABVAR_1_SoundLevel ) > ( 25 ) ))
  {
    led ( OUT1 , HIGH );
    if (( ( _ABVAR_1_SoundLevel ) > ( 50 ) ))
    {
      led ( OUT2 , HIGH );
      if (( ( _ABVAR_1_SoundLevel ) > ( 75 ) ))
      {
        led ( OUT3 , HIGH );
      }
    }
  }
  else
  {
    led ( OUT1 , LOW );
    led ( OUT2 , LOW );
    led ( OUT3 , LOW );
  }
}