While shopping for parts for my next project, I came across these $2 MP3 players from China. They are about 2AA batteries in size. It has all the I/O I'll ever need in a project. It even comes in an inconspicuous injection molded case making easy to hide your gadget/key/bitcoin keeper in plain sight.
There is already a project: China cheap MP3 player hack . In my case, I would upgrade from the STM32F030 which is my usual favorite to STM32F103 with native USB interface, dual ADC, dual SPI and a lot more memory.
- STM32F103 64kB FLASH, 20kB RAM, up to 72MHz
- Mini-USB: USB 1.1 device, charging
- 128x64 LCD
- Micro SD slot for SD/SDHC.
- 3.5mm Stereo - multiple I/O functions are available
e.g. 3.3V TTL serial, ADC, PWM, I2C and serial bootstrap.
- 5 push buttons, On/Off switch
- ~100mA Hr LiPO battery, LTC4054 charger.
Low power design
The device is powered from internal Li-ion battery. LTC4054 is used for charging the battery from USB. LDO is used to power the main circuits. The RTC and backup RAM location are backup from the battery. A pair of silicon diodes is used to drop the battery voltage down as they consume no quiescent current vs a LDO.
From Elm-Chan: How to Use MMC/SDC
MicroSD can draw a lot of current and introduce a droop during hot-insertion. This can reset the microcontroller or affect results of ADC. The XC6206P332MR and other ultra low quiescent current LDO make compromises for low bandwidth/transient response. It has a slow recovery time for a sudden load. Previously I have seen much less droop using a switch mode supply with a fast transient response.
While you can pile lot of passives to undo the manufacturer's design decision on $0.04 parts, it is cheaper and takes much less space to simply use 2 separate supplies for the microcontroller and the MicroSD.
I wired 4 GPIO in parallel (saving one MOSFET) to control the power to the LCD backlight (probably around 20mA).
A diode clamp is used for input protection. Two series resistors are used as current limit and the signals are clamped a diode drop above the zener voltage. The zener is pre-biased by R4 to reduce the load on the inputs below the threshold. C2 reduce the AC impedance.
The protection circuit can be altered for clamping to 3.3V rail by replacing D1, D2 with use schottky diodes, D3 depopulated and relacing R4 with 0R.
Libraries that needed to be ported/written
- Hardware random number generator for key generation (Poorman's Quite Random Number Generator (PQRNG) by Hardware)
- Nemuisan's STM32 GPS tracker which contains STM32F103 low level driver and FatFS (Elm ChaN's FatFs Module) for reading/writing to Micro SD card
- LCD driver, keypad driver, USB driver (libopencm3 or STM32CubeF1 library)
- HaD project: China cheap MP3 player hack
- Github: libopencm3 - open source library/driver
- Website: STM32CubeF1 library
- Website: [Cheap][Hack] a 2.50$ Chinese MP3 Player for its 128×64 mini LCD
- Website: Elm ChaN's FatFs Module
- Website: https://github.com/avislab/STM32F103 code examples
Open source password/bitcoin keeper
- Github: Bitcoin hardware wallet
- Github: mooltipass
- Github: Google Authenticator PAM module, Wiki: Google Authenticator...