SD/SDHC CARD SOUND RECORDER
For SD with PETIT FAT File System seeΒ SD Bitmap projectΒ For sound playback with EEPROM seeΒ Doorbell
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.
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 SOUND RECORDERΒ FOR ARDUINO
A sound recorder project for Arduino Uno with ATMEGA328P device.
The firmware works for SD or SDHC cards only. 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 quality of the audio is reasonable.
The ADC converts the sound to 20KHz 8 bits mono in a format similar to .wav files. Timer0 in Fast PWM mode is used as a DAC to convert the digital data back to audio. During recording the ADC converts the audio to 10 bits, the low byte is streamed to the SD card. The 0.65V bias to the ADC input is for setting the signal to the low byte of the converter output.
SD card interfaces the microcontroller 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 of communication with the SD card. The software doesnβt use any file system, it uses absolute memory addresses (raw).
Audio input is 1Vp-p , you can use the mic circuit or another source. The PWM gives 64KHz wave with duty cycle modulated to the audio amplitude. A low pass filter removes the 64KHz component. I added a simple 2 transistors amplifier to boost the power to drive 32 Ohm speaker or headphones.
Circuit diagram
SD/SDHC CARD FAT32 WAV PLAYER PIC16F876A
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.
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.
For a successful recording a sector (512 Bytes) has to be writen in 20ms, some old SD cards may be too slow writing data to the flash memory, in such case the error LED comes on. Try another make of card.
Source :Β SD CARD SOUND RECORDING, PLAYBACK CIRCUIT PIC16F876A