Getting Started with the LilyPad MP3 Player

Pages
Contributors: MikeGrusin
Favorited Favorite 12

Hardware Details and Hacking Tips

Power options and hacks

You can power the LilyPad MP3 Player in several ways:

Lipo battery

The easiest option is to use a Lipo (Lithium-Polymer) battery. SparkFun carries these in several sizes, which translates into different run times.

It is recommended that you use a Lipo battery of at least 500mAh, to match the default 500mA rate of the built-in Lipo charger (this is also the maximum current available from most USB ports). SparkFun Lipo batteries have a maximum charge rate of 1C, which means you shouldn't charge them faster than one hour. 500mA will charge a 500mAh battery in one hour, a 1000mAh battery in two hours, etc. A battery smaller than 500mAh would charge in less than one hour, which could cause the battery to overheat and possibly be damaged.

Unregulated 3.7V to 6V source

If you have an external 3.7V to 6V source, you have two options:

If you want to use your power source to recharge an attached Lipo battery, you can attach it to the "VIN" sew tap. Note that to recharge a battery the voltage must be greater than 4.5V (but still less than 6V).

If you want to use your power source to run the LilyPad MP3 Player directly (without a battery), connect it to the JST battery connector or the headers directly behind it. SparkFun carries pigtails (a connector with bare wires) that match this connector. Note that if you connect a 5V FTDI to the board, a maximum of 4.2V will appear at this connector as the charger attempts to charge the missing battery.

Regulated 3.3V source

If you have an external regulated 3.3V source, you can use it by connecting it to the 3.3V sew tap. Note that this will not charge an attached Lipo battery. You can also pull regulated 3.3V out of this sew tap to power other items in your project.

Current requirements

Because the amplifier chip can pull quite a bit of power at full volume, ensure that any external supply you use can supply up to a few hundred mA. With lower volume levels, you can get away with 50-100mA.

Changing the charge rate

If you would like to use a battery smaller than 500mAh, you can do so by soldering a new charge-rate resistor to the board. A through-hole footprint is provided in the white box marked R1 near the power switch.

You will need a through-hole resistor of the proper resistance. The formula to use is R = 1000/amps. For the given 500mA charge rate, the provided resistor is 1000/0.5 amps, or 2000 ohms. For a 110mAh battery, the resistor would be 1000/0.4 or 9090 ohms. (There is no standard 9090-ohm resistor, so use the next larger standard size which would be 10k.)

Before soldering on the new resistor, remove the existing surface-mount resistor within the white box. You can remove it by carefully heating it up with a soldering iron and nudging it off the pads when the solder softens.

Hacking for FTDI power

We said earlier that you can't power the LilyPad MP3 Player solely from a 5V FTDI board or cable. This is because the FTDI connector is used to charge the battery, and the limited current isn't enough to run the whole system including the amplifier (which can draw quite a bit of power).

However, you can modify the board to allow it to be powered via FTDI. Note that if you do this, you'll be bypassing the charge circuitry, so you won't be able to connect a Lipo battery to the board. If you'd rather run the board from an FTDI than a battery, here's how to modify the board.

NOTE: once you make this modification, do not connect a Lipo battery to the board. This modification sends 5V to the battery connector, which would overcharge an attached battery. Damage or fire may result.

To modify the board for power from the 5V FTDI header, solder a jumper wire between the VIN sew tap (you can use the small header hole directly behind it) and the "+" header on the JST battery connector. This sends 5V from the FTDI connector to the power input of the board, bypassing the charge circuitry that limits the current. Once you do this, you'll be able to power the board from the FTDI connector. Did we mention not to connect a Lipo battery to the board after you make this modification?

Solder jumpers

There are several solder jumpers on the board that you can use to alter its behavior. You probably won't need them, but they're there if you're ambitious.

I2C pullups (SJ1 and SJ2)

The TPA2016D2 amplifier chip has an I2C ("wire" library) interface that can be used to alter various settings on the chip. This interface is connected to the ATmega328 and is also sent to trigger 2 and trigger 3 in case you want to use external I2C sensors such as accelerometers, gyroscopes, etc.

In the example sketches, the I2C interface is normally disabled and generally shouldn't interfere with the use of trigger 2 or trigger 3. However, if you'd like to absolutely separate trigger 2 and trigger 3 from the amplifier chip and 4.7K pullup resistors, you can do so by cutting SJ1 and SJ2.

These jumpers are normally connected (there's a thin trace running between the pads). If you want to sever the I2C connection to the amplifier, carefully cut the traces between the pads using a hobby knife. If you'd like to restore the connection later, use a blob of solder to reconnect the two pads.

Serial MIDI connection (SJ3)

SJ3 (on the bottom of the board) can be used to connect the serial RX line (trigger 5) to the serial RX pin of the VS1053B audio decoder chip. This will let you send serial MIDI data directly from trigger 5 to the audio decoder.

Please note that without changing this jumper, you can still play MIDI files from the SD card just like any other audio file. This jumper is only useful if you have an external MIDI source such as a keyboard that you might want to connect directly to the LilyPad MP3 Player.

Headphone jack speaker cutoff (SJ4 and SJ5)

Normally, when you plug headphones into the jack, the audio signal to the amplifier chip and speakers will be interrupted by switches built into the jack. If you would rather have audio go to both the headphone jack and amplifier, you can close solder jacks SJ4 and SJ5 on the bottom of the board.

Even more headers

If you need more I/O than the five trigger pins, and you're not going to be using a rotary encoder, you can take advantage of the unused rotary encoder connections in the center of the board. The following diagram shows the location of these pins and their functions. Feel free to use them in your project:

alt text

In addition to the rotary encoder header, there are several additional pins available on the six-pin ISP (In-System Programming) connector. This connector is normally used to perform bare-metal programming of the ATmega microprocessor (such as replacing the bootloader) using a compatible ISP programmer. You can use these pins for your own purposes, but be aware that the SPI interface (the MOSI, MISO and SCK pins) is already heavily used by the playback software to move data from the micro-SD card to the VS1053B chip.

But all is not lost! If you want to use the SPI interface for other purposes, such as driving an addressable LED string, you can do so if you're careful. Bill Porter's MP3 Player library will let you use the SPI pins between audio transfers, as long as you're quick about it and release the SPI port in time for the next data transfer to take place. (If you don't, the VS1053B will run out of buffered data and "starve", causing a gap or glitch in the playback.) See Bill's documentation for instructions on how to do this, and have fun!