Project Name: PIC32MX SD-Card Wave File Player
Author/Designer: Y H
Project description: Simple wave file mini jukebox. Continuously plays *.wav files and return to starting point and repeats. DAC is in the form of PWM to save pins. The system will not play the file if the wave file is invalid in format. The system is fitted into a Christmas decoration (not shown in video) as an external sound player. User improvisation of the fittings and the enclosures are welcome. Plays only one-channel, Mono 8-bit wave files, from 8kHz sample rate to 44.1kHz sample rate. FAT16 is only used because of space constraints in the microcontroller.
Video:
Software:
1.) MPLAB C32 v2.01, MPLAB IDE v8.80
2.) SD-Card Routines using MDDFS (Memory Disk Drive File System) from Microchip Application Libraries v2011-10-18.
3.) Double-buffering technique
Hardware:
-Microcontroller: PIC32MX120F032B. (SPDIP) [Future Projects will involve higher end PIC32MX1xx series]
-SD-Card Slot: DFrobot SD-Module. (obtainable from Cytron)
-UART-USB converter: Cytron UC00B.
-Cytron ICSP Universal Socket.
-Crystal: 10MHz.
-Power supply from the UART-USB converter.
-DAC using Pulse Width Modulation.
-RC First-order Low-Pass filter (still under testing, will improve this on future revisions)
-Carrefour Speakers. (Connections to a larger amplifier is untested - please use small speakers)
Schematic:
Source Code: "test2-wav.zip". (It was in a test when I try to make that thing, hence the name.)
Remarks: The "HardwareProfile.h" in the "C:\Microchip Solutions v2011-10-18\MDD File System-SD Card" (or where you installed it) has a bit of a problem - it detects the "CD" pin on the SD-Card holder, which could be a problem if you need to save some wiring. I'm supplying the modified "HardwareProfile.h" inside to prevent the system from detecting the "CD" pin. You need to extract the provided "HardwareProfile.zip" into the "C:\Microchip Solutions v2011-10-18\MDD File System-SD Card" and overwrite it.
If you have problems compiling because of the missing "system.h", go to "Project->Build Options->Project", then click on the "Directories" tab, then the drop-down menu "Show Directories For", and select "Include Search Path". On the "C:\Program Files (x86)\Microchip\mplabc32\v2.01\pic32-libs\include\peripheral" in the box when it's selected, take out the space and the "(x86)" after the "Program Files". It should be this: "C:\Program Files\Microchip\mplabc32\v2.01\pic32-libs\include\peripheral".
The UART is optional. It is just for debugging purposes.
Note: LPF (Low Pass Filter) values suggested a 0.01uF capacitor and a 1K resistor. Connect the output to Pin 11 after the LPF. Use a small speaker.