The Alpha Geek – Geeking Out

Project #16: Sound – Microphone and SD Card – Mk24

——

#DonLucElectronics #DonLuc #Sound #Mic #SD #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Microphone and SD Card

——

Microphone and SD Card

——

Microphone and SD Card

——

SparkFun Electret Microphone

This small breakout board couples an Electret microphone (100Hz–10kHz) with a 60x mic preamplifier to amplify the sounds of voice, claps, door knocks or any sounds loud enough to be picked up by a microcontroller’s analog-to-digital converter. Each breakout comes fully assembled and works from 2.7 Volt up to 5.5 Volt.

The Electret Mic Breakout translates amplitude, not volume, by capturing sound waves between two conducting plates in the microphone and converting them into electrical waves. These electrical signals are then amplified and picked up by your microcontroller’s ADC.

DL2310Mk02

1 x SparkFun RedBoard Qwiic
1 x SparkFun Electret Microphone Breakout
1 x MicroSD card breakout board+
1 x SD Card 8 GB
1 x LED Green
2 x Buttom
2 x Resistor 10K Ohm
1 x ProtoScrewShield
1 x SparkFun Cerberus USB Cable

SparkFun RedBoard Qwiic

CLK – Digital 13
DO – Digital 12
DI – Digital 11
CS – Digital 10
LED – Digital 6
BSA – Digital 2
BUO – Digital 3
VIN – +3.3V
VIN – +5V
GND – GND

——

DL2310Mk02p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #16: Sound - Microphone and SD Card - Mk24
16-24
DL2310Mk02p.ino
1 x SparkFun RedBoard Qwiic
1 x SparkFun Electret Microphone Breakout
1 x MicroSD card breakout board+
1 x SD Card 8 GB
1 x LED Green
2 x Buttom
2 x Resistor 10K Ohm
1 x ProtoScrewShield
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// SD Library and SD Card
#include <SD.h>
// SPI Devices
#include <SPI.h>
// TMRpcm  playback/recording of PCM/WAV files direct from SD card
#include <pcmConfig.h>
#include <pcmRF.h>
#include <TMRpcm.h>

// SD Library and SD Card
#define SD_ChipSelectPin 10

// TMRpcm  playback/recording of PCM/WAV files direct from SD card
TMRpcm audio;
int audiofile = 0;

// Uno
#define buffSize 128
#define ENABLE_RECORDING
#define BLOCK_COUNT 10000UL

// SparkFun Electret Microphone
int iAUD = A0;

// LED Green
int iLEDG = 6;

// Buttom
// Start Recording
int iStartRecording = 2;
int iStartState = 0;
// Stop Recording
int iStopRecording = 3;
int iStopState = 0;

// Software Version Information
String sver = "16-24";

void loop() {

  // Buttom
  // Start Recording
  isStartRecording();

  // Buttom
  // Stop Recording
  isStopRecording();
  
}

getAudio.ino

// TMRpcm playback/recording of PCM/WAV files direct from SD card
// Start Recording
void isStartRecording() {

  // Read the state of the Switch value:
  iStartState = digitalRead(iStartRecording);

  // Check if the button is pressed. If it is, the SwitchState is HIGH:
  if (iStartState == HIGH) {

    // Led Green HIGH
    digitalWrite(iLEDG, HIGH);

    // Audio File
    audiofile++;

    switch (audiofile) {
      case 1: audio.startRecording("File01.wav", 16000, iAUD); break;
      case 2: audio.startRecording("File02.wav", 16000, iAUD); break;
      case 3: audio.startRecording("File03.wav", 16000, iAUD); break;
      case 4: audio.startRecording("File04.wav", 16000, iAUD); break;
      case 5: audio.startRecording("File05.wav", 16000, iAUD); break;
      case 6: audio.startRecording("File06.wav", 16000, iAUD); break;
      case 7: audio.startRecording("File07.wav", 16000, iAUD); break;
      case 8: audio.startRecording("File08.wav", 16000, iAUD); break;
      case 9: audio.startRecording("File09.wav", 16000, iAUD); break;
      case 10: audio.startRecording("File10.wav", 16000, iAUD); break;
    }

  }
  
}
// Stop Recording
void isStopRecording(){

  // Read the state of the Switch value:
  iStopState = digitalRead(iStopRecording);

  // Check if the button is pressed. If it is, the SwitchState is HIGH:
  if (iStopState == HIGH) {

    // LED Green LOW
    digitalWrite(iLEDG, LOW);

    // Audio File
    switch (audiofile) {
      case 1: audio.stopRecording("File01.wav"); break;
      case 2: audio.stopRecording("File02.wav"); break;
      case 3: audio.stopRecording("File03.wav"); break;
      case 4: audio.stopRecording("File04.wav"); break;
      case 5: audio.stopRecording("File05.wav"); break;
      case 6: audio.stopRecording("File06.wav"); break;
      case 7: audio.stopRecording("File07.wav"); break;
      case 8: audio.stopRecording("File08.wav"); break;
      case 9: audio.stopRecording("File09.wav"); break;
      case 10: audio.stopRecording("File10.wav"); break;
    }  

  }

}

setup.ino

// Setup
void setup() {

  // SparkFun Electret Microphone
  pinMode(iAUD, INPUT);

  // LED Green
  pinMode(iLEDG, OUTPUT);
  
  // Buttom
  // Start Recording
  pinMode(iStartRecording, INPUT);
  // Stop Recording
  pinMode(iStopRecording, INPUT);

  // TMRpcm playback/recording of PCM/WAV files direct from SD card
  SD.begin(SD_ChipSelectPin);
  audio.CSPin = SD_ChipSelectPin;

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories
Archives