{"id":3772,"date":"2023-12-15T06:29:03","date_gmt":"2023-12-15T14:29:03","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3772"},"modified":"2023-12-15T06:29:03","modified_gmt":"2023-12-15T14:29:03","slug":"project-16-sound-microphone-and-sd-card-mk24","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3772","title":{"rendered":"Project #16: Sound &#8211; Microphone and SD Card &#8211; Mk24"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3772-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #Sound #Mic #SD #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02a.png\" alt=\"Microphone and SD Card\" width=\"720\" height=\"482\" class=\"alignnone size-full wp-image-3779\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02a-300x201.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02b.png\" alt=\"Microphone and SD Card\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3780\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02b-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02c.png\" alt=\"Microphone and SD Card\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3781\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/12\/DL2310Mk02c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>SparkFun Electret Microphone<\/strong><\/p>\n<p>This small breakout board couples an Electret microphone (100Hz&#8211;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\u2019s analog-to-digital converter. Each breakout comes fully assembled and works from 2.7 Volt up to 5.5 Volt.<\/p>\n<p>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\u2019s ADC.<\/p>\n<p><strong>DL2310Mk02<\/strong><\/p>\n<p>1 x SparkFun RedBoard Qwiic<br \/>\n1 x SparkFun Electret Microphone Breakout<br \/>\n1 x MicroSD card breakout board+<br \/>\n1 x SD Card 8 GB<br \/>\n1 x LED Green<br \/>\n2 x Buttom<br \/>\n2 x Resistor 10K Ohm<br \/>\n1 x ProtoScrewShield<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>SparkFun RedBoard Qwiic<\/strong><\/p>\n<p>CLK &#8211; Digital 13<br \/>\nDO &#8211; Digital 12<br \/>\nDI &#8211; Digital 11<br \/>\nCS &#8211; Digital 10<br \/>\nLED &#8211; Digital 6<br \/>\nBSA &#8211; Digital 2<br \/>\nBUO &#8211; Digital 3<br \/>\nVIN &#8211; +3.3V<br \/>\nVIN &#8211; +5V<br \/>\nGND &#8211; GND<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2310Mk02p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/****** Don Luc Electronics \u00a9 ******\r\nSoftware Version Information\r\nProject #16: Sound - Microphone and SD Card - Mk24\r\n16-24\r\nDL2310Mk02p.ino\r\n1 x SparkFun RedBoard Qwiic\r\n1 x SparkFun Electret Microphone Breakout\r\n1 x MicroSD card breakout board+\r\n1 x SD Card 8 GB\r\n1 x LED Green\r\n2 x Buttom\r\n2 x Resistor 10K Ohm\r\n1 x ProtoScrewShield\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ SD Library and SD Card\r\n#include &lt;SD.h&gt;\r\n\/\/ SPI Devices\r\n#include &lt;SPI.h&gt;\r\n\/\/ TMRpcm  playback\/recording of PCM\/WAV files direct from SD card\r\n#include &lt;pcmConfig.h&gt;\r\n#include &lt;pcmRF.h&gt;\r\n#include &lt;TMRpcm.h&gt;\r\n\r\n\/\/ SD Library and SD Card\r\n#define SD_ChipSelectPin 10\r\n\r\n\/\/ TMRpcm  playback\/recording of PCM\/WAV files direct from SD card\r\nTMRpcm audio;\r\nint audiofile = 0;\r\n\r\n\/\/ Uno\r\n#define buffSize 128\r\n#define ENABLE_RECORDING\r\n#define BLOCK_COUNT 10000UL\r\n\r\n\/\/ SparkFun Electret Microphone\r\nint iAUD = A0;\r\n\r\n\/\/ LED Green\r\nint iLEDG = 6;\r\n\r\n\/\/ Buttom\r\n\/\/ Start Recording\r\nint iStartRecording = 2;\r\nint iStartState = 0;\r\n\/\/ Stop Recording\r\nint iStopRecording = 3;\r\nint iStopState = 0;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;16-24&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Buttom\r\n  \/\/ Start Recording\r\n  isStartRecording();\r\n\r\n  \/\/ Buttom\r\n  \/\/ Stop Recording\r\n  isStopRecording();\r\n  \r\n}\r\n<\/pre>\n<p><strong>getAudio.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ TMRpcm playback\/recording of PCM\/WAV files direct from SD card\r\n\/\/ Start Recording\r\nvoid isStartRecording() {\r\n\r\n  \/\/ Read the state of the Switch value:\r\n  iStartState = digitalRead(iStartRecording);\r\n\r\n  \/\/ Check if the button is pressed. If it is, the SwitchState is HIGH:\r\n  if (iStartState == HIGH) {\r\n\r\n    \/\/ Led Green HIGH\r\n    digitalWrite(iLEDG, HIGH);\r\n\r\n    \/\/ Audio File\r\n    audiofile++;\r\n\r\n    switch (audiofile) {\r\n      case 1: audio.startRecording(&quot;File01.wav&quot;, 16000, iAUD); break;\r\n      case 2: audio.startRecording(&quot;File02.wav&quot;, 16000, iAUD); break;\r\n      case 3: audio.startRecording(&quot;File03.wav&quot;, 16000, iAUD); break;\r\n      case 4: audio.startRecording(&quot;File04.wav&quot;, 16000, iAUD); break;\r\n      case 5: audio.startRecording(&quot;File05.wav&quot;, 16000, iAUD); break;\r\n      case 6: audio.startRecording(&quot;File06.wav&quot;, 16000, iAUD); break;\r\n      case 7: audio.startRecording(&quot;File07.wav&quot;, 16000, iAUD); break;\r\n      case 8: audio.startRecording(&quot;File08.wav&quot;, 16000, iAUD); break;\r\n      case 9: audio.startRecording(&quot;File09.wav&quot;, 16000, iAUD); break;\r\n      case 10: audio.startRecording(&quot;File10.wav&quot;, 16000, iAUD); break;\r\n    }\r\n\r\n  }\r\n  \r\n}\r\n\/\/ Stop Recording\r\nvoid isStopRecording(){\r\n\r\n  \/\/ Read the state of the Switch value:\r\n  iStopState = digitalRead(iStopRecording);\r\n\r\n  \/\/ Check if the button is pressed. If it is, the SwitchState is HIGH:\r\n  if (iStopState == HIGH) {\r\n\r\n    \/\/ LED Green LOW\r\n    digitalWrite(iLEDG, LOW);\r\n\r\n    \/\/ Audio File\r\n    switch (audiofile) {\r\n      case 1: audio.stopRecording(&quot;File01.wav&quot;); break;\r\n      case 2: audio.stopRecording(&quot;File02.wav&quot;); break;\r\n      case 3: audio.stopRecording(&quot;File03.wav&quot;); break;\r\n      case 4: audio.stopRecording(&quot;File04.wav&quot;); break;\r\n      case 5: audio.stopRecording(&quot;File05.wav&quot;); break;\r\n      case 6: audio.stopRecording(&quot;File06.wav&quot;); break;\r\n      case 7: audio.stopRecording(&quot;File07.wav&quot;); break;\r\n      case 8: audio.stopRecording(&quot;File08.wav&quot;); break;\r\n      case 9: audio.stopRecording(&quot;File09.wav&quot;); break;\r\n      case 10: audio.stopRecording(&quot;File10.wav&quot;); break;\r\n    }  \r\n\r\n  }\r\n\r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup() {\r\n\r\n  \/\/ SparkFun Electret Microphone\r\n  pinMode(iAUD, INPUT);\r\n\r\n  \/\/ LED Green\r\n  pinMode(iLEDG, OUTPUT);\r\n  \r\n  \/\/ Buttom\r\n  \/\/ Start Recording\r\n  pinMode(iStartRecording, INPUT);\r\n  \/\/ Stop Recording\r\n  pinMode(iStopRecording, INPUT);\r\n\r\n  \/\/ TMRpcm playback\/recording of PCM\/WAV files direct from SD card\r\n  SD.begin(SD_ChipSelectPin);\r\n  audio.CSPin = SD_ChipSelectPin;\r\n\r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>People can contact us:<\/strong> https:\/\/www.donluc.com\/?page_id=1927<\/p>\n<p><strong>Teacher, Instructor, E-Mentor, R&#038;D and Consulting<\/strong><\/p>\n<ul>\n<li>Programming Language<\/li>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Wireless (Radio Frequency, Bluetooth, WiFi, Etc&#8230;)<\/li>\n<li>Robotics<\/li>\n<li>Automation<\/li>\n<li>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/li>\n<li>Machine Learning<\/li>\n<li>Artificial Intelligence (AI)<\/li>\n<li>RTOS<\/li>\n<li>eHealth Sensors, Biosensor, and Biometric<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<li>Consulting<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>Luc Paquin \u2013 Curriculum Vitae &#8211; 2023<\/strong><br \/>\nhttps:\/\/www.donluc.com\/luc\/<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/@thesass2063<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #Sound #Mic #SD #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; SparkFun Electret Microphone This small breakout board couples an Electret microphone (100Hz&#8211;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 &#8230; <a title=\"Project #16: Sound &#8211; Microphone and SD Card &#8211; Mk24\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3772\" aria-label=\"Read more about Project #16: Sound &#8211; Microphone and SD Card &#8211; Mk24\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[119,47,50,49,38,59,5,287,58,10,43],"tags":[],"class_list":["post-3772","post","type-post","status-publish","format-standard","hentry","category-sound","category-adafruit","category-arduino","category-consultant","category-digitalelectronics","category-fritzing","category-microcontrollers","category-program","category-arduino-programming","category-projects","category-sparkfun"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3772"}],"version-history":[{"count":3,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3772\/revisions"}],"predecessor-version":[{"id":4812,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3772\/revisions\/4812"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}