SD/SDHC CARD SOUND RECORDER




Updated on 30.6.2015
The PIC16F876A’s ADC
digitizes the sound and store it in the SD or SDHC card. The firmware works for SD or SDHC cards only, for old SD (before 2009) use ver1 firmware. Do not use SDXC cards with this project because some of them work on 1.8V drive. The code detects whether the card is SD or SDHC and selects the proper addressing system for the card.
The PIC’s CCP is used as a DAC to convert the digital data back to audio. The sound is converted to 20KHz 8 bits mono in a format similar to .wav files. The quality of the audio is reasonable.
SD card interface the PIC in SPI mode. Reading and writing data is in multi-blocks. Memory is used at the rate of 20KB/s. The Error LED indicates error sent by the SD card. The software doesn’t use any file system, it just uses absolute memory addresses (raw). Since the programme is less than 680 bytes there is much resources left for adding features.SD SDHC CARD SOUND RECORDER
Audio input is 1Vp-p , you can use the mic circuit or other source. The CCP in PWM mode gives 20KHz wave with duty cycle modulated to the audio amplitude. A low pass filter removes the 20KHz component. I added a simple 2 transistors amplifier to boost the power to drive 32 Ohm speaker or headphones

  • SD/SDHC CARD FAT32 WAV PLAYER

This project is for .wav file type player (no recording). The software has the functions needed to read SD/SDHC card formatted in FAT32. The software can play only PCM 22.050KHz, 8 bits, mono. The bytes from the file are streamed to CCP1 (PWM mode) and with an external low pass filter you get the audio. The sound quality is OK for speech or medium quality music.
The software searches for files entries in the root directory only, it streams any file type without reading its name or type.
The circuit diagram is the same as the SD Sound Recorder minus the components for recording. Drawing is included with the software zip.
TO SET UP THE CARD:
Format the card with FAT32.
Create sound files type .wav
Name the files with short names, 8 low case characters max.
Save the files as 22.050KHz, 8 bits, mono.
Add the files to the root directory of the card (don’t use a subdirectory)

  • SD/SDHC CARD SOUND RECORDER 3.3V PIC16F690

This sound recorder has the same characteristics as the sound recorder with PIC16F876A. The difference is the supply voltage is 3.3V. This makes the direct drive of the SD card simpler. It also makes it easier to power it from a battery.
8MHz internal oscillator is used, if the frequency drifts it causes the playback to change speed. I left pins 2 and 3 free in case I have to use crystal oscillator.
The programming of the pic can be with 3.3V, if you have a pic programmer for 5V only remove the SD card while 5V is connected to the circuit, 5V will damage the SD card.

  • SD/SDHC CARD FAT32 WAVE PLAYER 3.3V PIC16F690

This wave player has the same characteristics as the wave player with PIC16F876A. The difference is the supply voltage is 3.3V. This makes the direct drive of the SD card simpler. It also makes it easier to power it from a battery.SD SDHC CARD SOUND RECORDER schematic
The playback speed can be changed by changing the time of TMR0 in the code.
The programming of the pic can be with 3.3V, if you have a pic programmer for 5V only remove the SD card while 5V is connected to the circuit, 5V will damage the SD card.




Troubleshooting: If the Error LED is on immediately on power up it means that the card failed to initialize. This code works for SD card rev 2 or SDHC card, it doesn’t work for SDXC (1.8V) or MMC or SD rev 1 cards. If your card is SD rev 1 you can use my firmware ver 1.
I’ve tested my code on 3 cards only and it may not work for all the cards, try using another make of card.

For more detail: SD/SDHC CARD SOUND RECORDER




Current Project / Post can also be found using:

  • pic microcontroller sound
  • playing wav files with PIC18
  • how to know microcontroller for audio programming
  • microcontroller and sound

Leave a Comment

*
= 4 + 3

Read previous post:
ESP8266 Troubleshooting Guide
ESP8266 Troubleshooting Guide

ESP8266 Troubleshooting – NodeMCU Flasher Where do I download the NodeMCU flasher? Go to the NodeMCU flasher GitHub repository and download...

Close
Scroll to top