Martha MigliacioAlex Wong
Published © GPL3+

Using the Pmod MIC3 with Arduino Uno

Application notes for Pmod MIC3 and Arduino Uno. In this app, the sound captured by the module is displayed in the serial plotter.

EasyProtip1 hour304
Using the Pmod MIC3 with Arduino Uno

Things used in this project

Hardware components

Pmod MIC3
Digilent Pmod MIC3
×1
Anduino Arduino Uno
×1

Software apps and online services

Anduino Arduino IDE

Story

Read more

Schematics

Pmod MIC3 and Arduino Uno Fritzing file

Fritzing file displaying the connection of the Pmod MIC3 to the Arduino Uno. Please note, this setup is the same for the connection between the Pmod AD1 and Arduino Uno.

Pmod MIC3 and Arduino Uno Fritzing Image

Fritzing image displaying the connection between the Pmod MIC3 and Arduino Uno. Please note, this setup is the same for the connection between the Pmod AD1 and Arduino Uno.
Pmodmic3arduinouno bb hvrsq887kq

Code

Pmod MIC3 and Arduino Uno Code

Arduino
Using this code will display the sound captured by the Pmod in the serial plotter.
/************************************************************************
*
* Test of the Pmod 
*
*************************************************************************
* Description: Pmod_MIC3
* The sound captured by the module is displayed in the serial plotter.
*
*
* Material
* 1. Arduino Uno
* 2. Pmod MIC3
*
* Same shematic as Pmod AD1 setup
************************************************************************/

#define CS 10 // Assignment of the CS pin

#include <SPI.h> // call library

int i;
byte recu[3]; // storage of data of the module
int X;
long somme = 0;

void setup()
{
 Serial.begin(9600); // initialization of serial communication
 SPI.begin(); // initialization of SPI port
 SPI.setDataMode(SPI_MODE0); // configuration of SPI communication in mode 0
 SPI.setClockDivider(SPI_CLOCK_DIV16); // configuration of clock at 1MHz
 pinMode(CS, OUTPUT);
}

void loop()
{
 digitalWrite(CS, LOW); // activation of CS line
 delayMicroseconds(20);
 for (i=0;i<2;i=i+1)
    {
    recu[i] = SPI.transfer(0); // send 2 data to retrieve the value of the two-byte conversion
    delayMicroseconds(20);
    }
 digitalWrite(CS, HIGH); // deactivation of CS line
 X = recu[1]; // X is on 12 bit format
 X |= (recu[0] << 8);
 
for(int i=0; i<32; i++) // Development of the sound curve
 {
   somme = somme + X;
 }

 somme >>= 5;
 Serial.println(somme); // Display in serial plotter
 delay(10);
}

Credits

Martha Migliacio

Martha Migliacio

5 projects • 2 followers
Contact
Alex Wong

Alex Wong

5 projects • 6 followers
I work in Digilent and like creating projects
Contact
Thanks to Lextronics.

Comments