Full Version : MP3 Player for AVR Butterfly
avr >>SOUND & MUSIC PROJECTS >>MP3 Player for AVR Butterfly


AVR_Admin- 04-28-2006
The main goal of this project is to create an open design for a portable MP3 player, in both hardware and software. The secondary goal of this project is to make it as simple to construct, and as cheap, as possible.

The design is based around the AVR Butterfly from Atmel. The use of this module greatly simplifies the hardware design and constrution and packs plenty of punch for $19.99 USD. The remaining hardware can be easily placed on a single sided PCB. The MP3 decoding is handled by a VS1001K decoder chip from VLSI Solution Oy. This chip also has an onboard DAC with enough power to drive headphones, simplifying the board design even further.

The current prototype makes use of either a Nokia 3310 LCD screen or the original alphanumeric LCD. This was used initially because I dropped my original Butterfly and broke the screen, but it also frees up a lot of IO on the Butterfly which I hope to use in the future for implementing a ATA/ CF interface.

Current Status
This device is in the alpha stages of development. A basic PCB has been designed and manufactured; and software has been written to test the hardware capabilities of the device. The current firmware is functional to the point of selecting songs on the MMC and playing them, pausing or skipping to the next song. In future releases it is hoped to add random play and directory support.

The development has been branched into an ATA development branch and MAIN development branches. The main branch is the original with the MMC and alpha numerical orgraphical LCD. In the CVS the last release version is tagged STABLE.

The last major firmware release (0.5) was 28 April 2006. This is added a number of new features including:

ID3 v2 Support
New graphics for Nokia 3310 Screen
Please check the release notes and logs for more detail.

Hardware is currently being designed and debugged for work to begin on a HDD version using 2.5" drives with USB 2.0 connection. The case designs for the basic MMC versions are complete.

The latest Rev D PCB is complete and adds support for li-ION polymer batteries and USB charging.

Link: http://butterflymp3.sourceforge.net/

The software at this stage contains routines for working with the NOKIA 3310 LCD display (and the standard butterfly display), communicating with the MP3 decoder, communicating with the MMC card and a basic FAT16 implementation. The FAT16 is pretty basic, ie. root directory only. It does however do long filenames. If ID3 tags are available it will use this information instead of long file names.

Basic Operation
Basic operation of the mp3 player (version 0.5) is as follows:

Insert MMC with MP3's in root directory
Turn on player (press up on joystick if in standby mode)
MMC will be scanned for MP3 files
First MP3 found will be displayed
Press center on joystick to play/pause
Press Up/Down to adjust the volume (while Playing)
Press Left/Right to select song
Press down to enter standyby mode (while paused/idle)
Press down to enter bootloader mode (while in standby)
If the MMC is removed then the NO MMC screen should be displayed along with the compile time and date. If a MMC is re-inserted at this point it will be redetected. I have verified it working with mp3's at 128kbps, 160kbps, 192kbps and 320kbps. If the battery voltage drops too low then the player will save the state to eeprom and shut down untill recharged.

Current consumption is now around 50mA when playing at full volume. When idle the player can use around 20mA. With latest HW and firmware standby mode reduces current consumption to approx 1~2mA.

Known Issues

FAT implementation only looks at primary partition 1 (some MMCs use partition 2 in MBR!)

CVS Organisation
The CVS is currently split into 3 branchs. The main trunk contains development for the MMC based player with a graphical LCD. The VANILLA branch contains development of the MMC Based player with a standard alphanumeric LCD. The ATA branch is used for the development of the HDD based player.

You can browse the current code through the CVS system here. It has some nice syntax highlighting and everything.

The Vanilla branch has been merged back into the main trunk with release 0.2

Each release will be tagged in the CVS as well as STABLE for the latest stable release. All hardware dependancies in the firmware will be dealt with using conditional compilation. All general defines discribing the hardware will be in main.h with a summary of other hardware options included in various other modules (vs1001.h, mmc.h, pcd8544.h).


Features
The software has been expanded this recently to include some new features. Some of those features are outlined below. The software can be configured for your hardware by changing defines in main.h and some other files.

Different LCD Types
The software can support different LCD options. To set the LCD screen use make LCD=DISPLAYTYPE clean all to build where DISPLAYTYPE is ALPHA, NOKIA or NO_DISPLAY for Orignal, Nokia 3310 and no display respectivly. An alternative wiring is supported through the NOKIA_ALTPINOUT defining in pcd8544.h.

Battery Monitoring
The system now monitors the battery voltage (a wire needs to be connected from the "VoltageIn" at the top left of the butterfly to the battery connection). The system will not startup if the battery voltage is below a set value. The system will automatically save the player state and shut down if the voltage drops too low during playback. To disable this behavour comment out the definition of PWR_CHK_INTERVAL in main.h. If no MMC is inserted the current battery status is temporarily displayed on the Alphanumeric display. With the NOKIA display the battery charge is displayed as a small icon in the bottom right of the display. The exact battery levels can be set in power.h.

NOTE: The player will not startup if battery monitoring is enabled and the wire is not added between the voltage in and the battery.

Player State saving to EEPROM
When the battery voltage drops below the minimum voltage or the user forces the player into bootloader mode (press down twice while paused) then the current status of the player (play time, song, etc.) will be saved to the EEPROM. A high endurace routine was used so the eeprom should stand up to 10 times it's normal number of cycles. About 100,000 times total. When the player is woken from sleep or power down it will scan the MMC and then resume playing where it was last paused.

Visual Feedback
New visual feedback on the APLHA display including: Battery status, volume and player status. Feedback is displayed for STAT_DISPLAY_TIME seconds and then returns to the filename.

FAT16 Filenames
I have finally fixed the bugs in the filename routines and all long filenames should render correctly, with the exception of characters not possible to be displayed on the alpha numeric display.

Power down mode
The low power mode retains current player state in ram. You can switch the player into low power mode by pushing down on the joystick when paused or stopped. To wake the player up push up on the joystick. You can switch to bootloader mode by pushing down a second time once in low power mode. When entering bootloader mode the status of the player is written to eeprom.

Play all / repeat all
The player now wraps around to start or end of file list when manualy selecting songs. SCAN_JUMPTOSTART in main.h controls this behaviour.

Auto Power Down
The software will now automatically time out after 30 seconds when paused or stopped. The player will save the current state of the player resume later. After the last song the firmware will continue playing from the first song again. This can be changed in the file main.h

The auto power down now jumps to the low power mode rather than the bootloader. This saves eeprom usage and power.

ID3 info
The player now recognises and uses information from the ID3 version 2.x tags.
If this information is unavailable then long filenames will be used.

Link: http://butterflymp3.sourceforge.net/sw.html


Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.