As you might have guessed from the title, I've run into a couple of small issues. Before we get into that, here's a photo of the device all buttoned up and ready to play music. The NFC reader is to the right of the display, simply hold one of the cards to that blank space and it plays the song:
First, let's talk good stuff: the hardware works (albeit with a few gotchas, read on...) and the software is coming along nicely too. I've finally buttoned the whole thing up and actually used it, which is fairly nice to do at last! It can read/write NFC cards, play songs, set the volume, you can navigate the menu and there's OTA firmware updates. I'll upload a video once I've got some of the loud "clicks" fixed!
I still have a decent list of features to implement (select a song to play from the menu, better volume control, maximum volume settings, password protection, etc.). I'm pretty pleased with what I've accomplished so far. But it's definitely not perfect...
More Hardware, More Problems
As the most ambitious project I've taken on, I knew I would run into some problems. I wasn't expecting so many to be honest, but hey, that's part of the learning process. "So, what's wrong with it now?" , you ask? Well, here you go:
- Amplifier Shutdown. It didn't occur to me that when the ESP is in deep sleep, it disables it's GPIO. This means that pins set high/low before sleep start to float - including the amplifier shutdown and DAC mute circuits. Floating pins on amplifier ICs are not a good idea and lead to very strange behavior, including clicking, hissing and more. I can work around this by using light sleep instead of deep sleep but introduces other software complexities as well as consuming more power when powered off. This can be fixed with a weak pull-down resistor.
- DAC Mute. Other than the floating pin problem, the DAC is actually fairly "noisy" during start/stop of playback - especially when switching songs (possibly relate to the I2S library I'm using). The Soft Mute feature of the DAC is nice, but you have to work out how long it will take for mute/unmute to take place based on sample rates and more. The amplifier can do this for me for "free" (it's fixed at 100ms). I'll switch over to the amplifier mute, include a weak pull-up resistor and pull the DAC's XSMT pin high
- It sounds terrible - and there's a few reasons for that. First, I really should have measured the speaker impedance values more carefully. The left speaker is a 4 Ohm woofer, the right speaker is an 8 Ohm "twiddler". That was fine for the old Class-AB amp but a Class-D needs output tuning for different output impedance - this means my identical output filters and BC blocking caps are all wrong. On top of that, I completely mixed the values for those parts, so my low frequency cutoff is around 120Hz for both sides. Correct value components won't fit in the old PCB so I'll need to change the PCB to make it fit
While I'm at it, I'm also going to swap the amplifier for the more powerful TPA3123 (instead of the current TPA3122) which requires a different PCB layout. I really, really hope that this will be the last version I have to create!