Archive for the ‘mp3’ Category

Arduino MP3

Tuesday, July 5th, 2011

ArduinoMP3 (Rev C)

The Arduino MP3 webpage is finally up and the source code for the project is on github.

You can find the web pages at:

http://www.brokentoaster.com/arduinomp3

You can find all the future development at GitHub via this link:

https://github.com/brokentoaster/ArduinoMP3

How to fix LCD contrast problems on the AVR Butterfly

Thursday, June 17th, 2010

I had heard a number of reports of contrast problems on the AVR Butterflies produced over the last year. Unfortunately I haven’t had an opportunity to look into this until now. This week while checking some MP3 player code on a new AVR Butterfly I ran into the problem for myself. Luckily it was a simple fix.

A quick search on AVR Freaks turned up the following solution.

Turns out adding the following to lcd_driver.c fixed the problem:

//updated 2006-10-10, setting LCD drive time to 1150us in FW rev 07,
//instead of previous 300us in FW rev 06. Due to some variations on the LCD
//glass provided to the AVR Butterfly production.
LCDCCR |= (1<<LCDDC2) | (1<<LCDDC1) | (1<<LCDDC0);

I inserted these lines as instructed into the file LCD_driver.c at the end of the LCD_Init() function just after gLCD_Update_Required = FALSE; (this is around line 170 for ButterflyMP3).

The change has fixed the problem on my hardware. Although I have updated the files in the CVS, I have not done a general release for either ButterflyMP3 or Butterfly Logger. You can get the modified files directly from the CVS system, here for ButterflyMP3 and here for Butterfly Logger

In addition to the changes given above in the post at AVR Freaks, the macro around line 45 in the file LCD_driver.h

#define LCD_CONTRAST_LEVEL(level) LCDCCR=(0x0F & level)

should be changed to something like

#define LCD_CONTRAST_LEVEL(level) LCDCCR=(0xF0 & LCDCCR) | (0x0F & level)

This change will ensure that the drive time setting does not get erased when using the macro to set the contrast at some time after initialisation. I have not tested this as none of my firmware sets the contrast after startup.

Why are these changes needed?

It appears that the LCD’s characteristics have changed and it now requires a much longer drive time of 1150μs. The original LCD needed only 330μs. I’m unsure of the effect of this on the overall power consumption other than it will increase the LCD’s portion of it.

If the original 330μs drive time is used, then some of the newer LCDs will be very dim and you may only be able to read them at an angle if at all. If you really want to squeeze a little more battery life out of your AVR Butterfly based project then you could have a go at tweaking this value back to 850μs or even 575μs and check the display for readability.

Heres an explanation of what those bits do from the ATMEGA169PA data sheet on page 248.

• Bits 7:5 – LCDDC2:0: LDC Display Configuration
The LCDDC2:0 bits determine the amount of time the LCD drivers are turned on for each voltage transition on segment and common pins. A short drive time will lead to lower power consumption, but displays with high internal resistance may need longer drive time to achieve satisfactory contrast. Note that the drive time will never be longer than one half prescaled LCD clock period, even if the selected drive time is longer. When using static bias or blanking, drive time will always be one half prescaled LCD clock period.

And the accompanying table from the same datasheet also on page 248.

Table 23-7. LCD Display Configuration

LCDDC2LCDDC1LCDDC0Nominal drive time
000300 µs
00170 µs
010150 µs
011450 µs
100575 µs
101850 µs
1101150 µs
11150% of clkLCD_PS

Arduino MP3 Shield Rev B (correct files this time)

Monday, June 14th, 2010

I have to apologise to everyone who downloaded the Revision B Arduino MP3 Shield PCBs when I posted them here and here.

I accidently uploaded and emailed everyone the wrong files, not only were they not revision B they weren’t even revision A. This was totally my fault as I grabbed the files from the wrong directory when uploading. I was sure I had checked they were correct but obviously I hadn’t.

I’ve included some pictures of what the layout is supposed to look like for Rev B so you can check the gerbers and EAGLE files are correct before getting any made. ( Look for the large ‘B’ on the top copper layer.)




Figure 1 : Arduino MP3 Shield Rev B PCB - Top view




Figure 2 : Arduino MP3 Shield Rev B PCB - Bottom view

I have since fixed the links and are now hosting the correct files. Here are the links again:

EAGLE files are here

GERBER files are here

Arduino Library files are here

PDF of the schematic is here

Once again sorry to everyone who got the wrong files.

Creative Commons License
Arduino MP3 Shield by Nick Lott is licensed under a Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License.
Based on a work at www.brokentoaster.com.

Arduino MP3 Rev B v0.0

Monday, February 15th, 2010

Last week I managed to have some luck with my Arduino MP3 shield. The big hold up was caused by not having enough power from the FT232RL chip to supply the decoder and the memory card at the same time (50mA max d-oh). I also had a software issue, I had not altered the code to deal with the 16Mhz clock speed of the arduino from the 8Mhz I was using on the ButterflyMP3 project. The SPI clock was running at 8Mhz where it needed to be slower than 6MHz (to comply with the VS1011E datasheet). Once I had that sorted everything just popped into place and started working reliably.

I apologise in advance for the poor integration of the library examples. I have simply and quite roughly ported the minimal parts of my buterflymp3 project over to the arduino and this hardware. The examples will test reading FAT16 file system on the MMC/SD card, test the VS1011E decoder chip, and play the first mp3 file found on the memory card. I hope to get these tidied up later but have not had any time to do so lately.

The PCB has not actually been tested yet so I’d hold off building a million of these until after a successful test. There is unlikely to be much wrong with it though as I have simply added a voltage regulator and re routed a couple of signals to fix my earlier mistakes. ( I’d forgotten that I/O lines 0 and 1 are used by the uart on the arduino)

I have embedded the BOM below. ( The bom is here if you don’t see it below)

Here are all the files so far. These are all released under a Creative Commons 2.5 license .

EAGLE files are here

GERBER files are here

Arduino Library files are here

PDF of the schematic is here

To use the library simply put the “mp3” folder from the zip file inside the “libraries” folder in your arduino folder (create one if it doesn’t exist). Restart Arduino 018 or later and you should have “mp3” entries in the menus under examples and import libraries.

The BOM references a 2.8V LDO voltage regulator but the schematic shows a 3.3V. Either will work fine but the 2.8 will give you slightly lower power usage.

If you are interested in PCBs or kits, drop me a line at buy_pcbs@brokentoaster.com
As always any comments, suggestions or ideas are welcome.

New PCBs in from BatchPCB

Tuesday, January 5th, 2010


My order of PCBs from BatchPCB arrived the week before Christmas so plenty of soldering and things to keep me busy over the holiday. I’ve also been distracted of late with building a reprap, although I’ve not got much further than amassing a number of PCBs, components and motors, watch this space for details as the build progresses.

My Batch PCB contained a new version of the Arduino MP3 board with provision for running from the 5V Duemilanove Arduino and a number of MLMC boards so I can string them together for testing. Unfortunately the ArduinoMP3 PCB had a couple of design errors, which is typical when your working on a design off and on over a course of months. The design will probably be released soon, but the libraries and demo code are also proving slightly more difficult.

Some changes to Hardware.
The basic design of the board is the same, VS1011 and SD card shared on the SPI bus with a 5 way Joystick on some digital lines.

I forgot about the TX/RX lines being shared with digital 0 and 1 on the arduino so I’ve had to re-route signals using those pins to the previously unused analog/general IO pins.

A couple of changes related to running the circuits on a 5V / 3V3 system. My Butterfly MP3 system that I based this on was powered from a single supply rail of 2.8V. The FTDI USB chip on the arduino was originally used to provide a 3V3 supply to the shield. I thought the 50 mA stated in the data sheet would be enough as my butterfly mp3 system only used about 50mA including processor and display. Unfortunately the is a large current draw when an SD Card is inserted causing the FTDI chip to reset and breaking connection with the PC. Although not a big problem I decided to add an LP2981 LDO regulator to supply a 100mA for the card and MP3 player circuits. If you don’t want to use this then you can not fit the parts and easily bypass with a jumper wire.

C++ing the libraries
I was hoping to use the existing libraries for the Arduino and SD cards to access the MMC/SD Cards and provide demo code to show using the shield. For an as yet unknown reason the existing libraries from Adafruit wave shield do not work. In order to test my hardware I have converted my MMC and FAT libraries from the ButterflyMP3 project to C++ for use with the Arduino system. I few teething problems and issues as I remember how C++ works and I now have a working SD Card system. Output from my current software is shown below

I’d like to use the already available libraries as they offer FAT32 and extended features over my bare bones implementation – so not quite ready to publish any finished code just yet.

Next step is adding the support for the VS1011. Again not quite as smooth as I’d hopped but moving along with the help of the old intronix logic port. Currently the VS1011 is not setting up correctly. Occasionally it plays OK but mostly nothing or a very slow version of a song, indicating to me the clock registers are not being set correctly.

I think another weekend or so of work and I’ll be there but if you’d like a copy of the current PCBs or Arduino files then just drop me an email or leave a comment.

Current Demo Software Terminal Output

TEST
0
MMC_RESET returned 0
MMC_SEND_STATUS returned 0
MMC_SEND_CID returned 0
0: FE 02 54 4D 53 44 30 31 47 28 9A CF 7B 33 00 7A ..TMSD01G(...3.z
1: 83 08 8E FF FF FF FF FF FF FF FF FF FF FF FF FF ................
MMC_SEND_CSD returned 0
0: FE 00 2D 00 32 5B 59 83 D6 7E FB FF 80 16 40 00 ..-.2[Y.......@.
1: FB 5E C9 FF FF FF FF FF FF FF FF FF FF FF FF FF .^..............
MMC_Capacity returned 1037952
MMC_Name returned 0 SD01G(
MMC_Read returned 0
MMC First Sector:
0: FA 33 C0 8E D0 BC 00 7C 8B F4 50 07 50 1F FB FC .3........P.P...
1: BF 00 06 B9 00 01 F2 A5 EA 1D 06 00 00 BE BE 07 ................
2: B3 04 80 3C 80 74 0E 80 3C 00 75 1C 83 C6 10 FE ...<.t..<.u.....
3: CB 75 EF CD 18 8B 14 8B 4C 02 8B EE 83 C6 10 FE .u......L.......
4: CB 74 1A 80 3C 00 74 F4 BE 8B 06 AC 3C 00 74 0B .t..<.t.....<.t.
5: 56 BB 07 00 B4 0E CD 10 5E EB F0 EB FE BF 05 00 V.......^.......
6: BB 00 7C B8 01 02 57 CD 13 5F 73 0C 33 C0 CD 13 ......W.._s.3...
7: 4F 75 ED BE A3 06 EB D3 BE C2 06 BF FE 7D 81 3D Ou.............=
8: 55 AA 75 C7 8B F5 EA 00 7C 00 00 49 6E 76 61 6C U.u........Inval
9: 69 64 20 70 61 72 74 69 74 69 6F 6E 20 74 61 62 id partition tab
A: 6C 65 00 45 72 72 6F 72 20 6C 6F 61 64 69 6E 67 le.Error loading
B: 20 6F 70 65 72 61 74 69 6E 67 20 73 79 73 74 65  operating syste
C: 6D 00 4D 69 73 73 69 6E 67 20 6F 70 65 72 61 74 m.Missing operat
D: 69 6E 67 20 73 79 73 74 65 6D 00 00 00 00 00 00 ing system......
E: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
F: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
11: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
12: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
13: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
14: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
15: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
16: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
17: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
18: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
19: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
1A: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
1B: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 ................
1C: 37 00 06 03 C3 E6 F3 00 00 00 0D B3 1E 00 00 00 7...............
1D: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
1E: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
1F: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 AA ..............U.
0
SECTORS PER CLUSTOR 20
BYTES PERSECTOR 0200
FAT Init returned:0
SECTORS PER CLUSTOR 20
BYTES PERSECTOR 0200
FAT boot Sector info
FAT begins at sector 244
Clusters begin at sector 768
Sectors per cluster = 32
Root dir starts at sector 736
THESTR~1.MP3 00045 037A00 2E0F
THESTR~2.MP3 00124 03400 2E1A
THESTR~3.MP3 001F5 025C00 2E24
THESTR~4.MP3 0028C 030400 2E2E
TWINSE~1.MP3 0034D 051B249 2E39
THEWHI~1.MP3 00494 03867AF 2E45
THESTR~5.MP3 0057B 02FE00 2E51
THESTR~6.MP3 0063B 032B00 2E5C
THESTR~7.MP3 0079 034D00 2E68
BEASTI~1.MP3 007DD 02EC9A4 2E74
BEASTI~2.MP3 00899 02E93C3 2E80
BEASTI~3.MP3 00954 01F172F 2E8B
THESTR~8.MP3 009D1 03A300 2E95
THESTR~9.MP3 00ABA 02DC00 2E9F
THEST~10.MP3 00B71 02F00 2EA9
THEST~11.MP3 00C2D 026900 2EB4
05-ILE~1.MP3 00CC8 02E8C16 2EBD
BEASTI~4.MP3 00D83 03EF2C9 2EC8
Files: 18
1A
DONE