Close
0%
0%

NFC Bose Wave Player

An NFC-enabled music player designed for kids to be able to pick their songs, built the hardest way possible

Similar projects worth following
I wanted to create a music player for my son who loves music, but is only three and doesn't know how to pick his favorite songs. But he can pick vinyl records he likes because he knows the pictures - then it occurred to me that NFC cards with images would let him pick what he likes. Sure, I could build it with a few off-the-shelf components, but where's the fun in that...

After deciding I was actually going to do this, I had to select a radio that I could gut completely - I needed it to have enough space inside that I could fit all my new hardware and space for a display. I also wanted something with a few buttons so I could have volume control, programming new cards, etc. I also wanted something that wasn't too painful to my ears (I can't stand cheap radios). This is for my kids, so audiophile isn't required - but something that I can stand, at least.

Really, I just wanted something my kids can use that can take a bit of a beating, doesn't cost the earth, isn't painful to listen to and can fit everything inside.

  • Woohoo! (and D'oh!)

    gilphilbert07/22/2021 at 06:20 0 comments

    It's been an eventful week on this project. Where do I begin?

    Buttons

    Well, this one is a positive one (I guess...). I discovered a couple of slight bugs in the button firmware that had me pulling my hair out for two days. Fortunately my hair is fairly short, so the damage is minimal. It turned out that depressing a button wasn't being debounced at all - and worse, the button being sent was out by one (so you would see the last button pressed - always lagging by one button). After virtually rewriting the code I discovered I'd made a couple of small errors - one in my firmware and one in the ESP code. Long story short, that's all fixed - so the good news is that I believe the button firmware is now complete!

    Hindsight Is A Beautiful Thing

    While waiting for the power supply components to arrive in the mail, I fitted the ATtiny with the button firmware into the front panel. No suspense here - it didn't work. Then I tried the NFC reader - and that didn't work either. After some investigation, one will work at a time - but not both together. Obviously I assumed my code was to blame, but apparently that's not it. For some reason, the PN532 and the ESP32 aren't best friends. The PN532 will not share the I2C bus with any other device when connected to an ESP32 - this seems to be a known issue across multiple drivers. I haven't dug into it (since it seems a little pointless to do so), but that's how it is. So, this means my new set of PCBs coming in the mail are already doomed - they're based on a shared I2C bus which is now dead in the water.

    Of course, if I had prototyped the whole thing together, this wouldn't have happened. Regardless, the PN532 does play nice on the SPI bus. Well, it didn't, but I made some changes to the driver to maintain SPI settings on a shared bus and now it works fine with the SD card and display on the same SPI bus. Now I will need to make a few changes as some SPI pins are missing on the connector between the main board and the front board - so both boards will need to be changed to swap from I2C to SPI.

    Sound from the DAC, at last!

    Let's silver-lining this thing then. Once the new boards arrived, even knowing they wouldn't be final, I soldered up the new boards. I was going to check every section of this before I order any more PCBs. I started with the DAC section, since I was waiting for the power supply components to arrive in the mail. This has caused me headaches previously so I thought I'd give it a go again - it would be much nicer to use my own PCM5102A design instead of an off-the-shelf component. After wiring everything to my previous prototype and powering it on... I got sound first time! This is great news.

    We Have Power

    That's right, the final set of components arrived in the mail today and I assembled my faulty board. Well, mostly, anyway. The power section, ESP32 and PCM5102A are all assembled. I fired it up, measured all the voltages and it looks great. This was true last time, yet the thing failed miserably, so I connected to the ESP32 and loaded some firmware to simply play all the songs from the SD card through the DAC. I powered it up, popped on my headphones and... silence. Oh, no - not again. Then I realized that the XSMT (soft mute) of the PCM5102A needs to be pulled high... just maybe. A quick firmware change and... nothing. But why isn't it working? I grabbed my multimeter. Amazingly, the pin on the ESP32 wasn't soldered - it was missing on this one pin! I soldered it quickly, plugged the cable into the wall... and nothing. Oh, come on! Then I realized: in my haste, I hadn't reconnected the other end of the power cable to the PCB. I plugged it in and... glorious sound! No static, nothing!

    Looks like I can order my final set of boards. Again...

  • Block Diagram

    gilphilbert07/19/2021 at 20:08 0 comments

    This project can sound pretty complex. There are a few major parts (the button controller, display, etc.) as well as the main MCU. To try and help visual-thinkers see what's going on, I've put this together quickly to give an overview of the project's main components as well as how they communicate:

    The colored interconnecting lines show the type of communication as well as the direction(s).

    The lines on the sides of the boxes show the power source. The 3.3V regulator pulls it's power from the 5V regulator. The amplifier uses an unregulated rectified power supply from the transformer. 

  • Buttons

    gilphilbert07/18/2021 at 08:08 0 comments

    Remember when I wrote about the buttons on the top panel? After some investigation, I discovered the buttons use a scan matrix - nothing particularly complicated. The columns require the addition of pull-up or pull-down resistors on each row that's scanned to prevent floating pins from reading false positives.

    After spending some hours with a multimeter and pressing buttons repeatedly (it was a fascinating evening) I've mapped all of the buttons in the matrix. There are now two options: buy and off-the-shelf matrix scanner, such as the TCA8418 or do it in software. The keyboard scanner ICs are often both (relatively) expensive and produced for industrial applications, so they come in home-assembly-unfriendly WQFN packages. Sure, I can probably solder one - but where's the fun in that? (you'll find this is a common theme in my projects...)

    There are two options: I could connect the lines directly to the ESP32 - but there aren't enough GPIOs left for that, or I could use another MCU. This isn't a complex task, so the code will be fairly simple. The most complicated bit will likely be the communication. I2C makes the most sense as it only requires two pins, and since the NFC card reader will be using I2C on the front panel as well, the connections will already be present.

    I've settled on the ATtiny series from Atmel. I've used them before and the work here is trivial, so the ATtiny series is ideal. Only a few devices come with enough GPIO pins and come in packages I want to work with, so I've settled with the x61 series. Most likely I'll use the 861 although it will probably be overkill, even if I used the Arduino framework (which I won't). The only hiccup is that the ATtiny x61 series doesn't support any I2C slave functionality, but there is an application note on how to achieve this.

    A few days later...

    Well, that was fun! I've re-written my code a few times, but I've got there. With the use of timers, interrupts and a few modifications to the usitwislave library, I have the whole thing working nicely on a proto board. I've written a fairly in-depth readme to go with the code so you can read more about how it all works. I've tested this with an ESP32 dev module as the I2C master and it works perfectly. I've made up the PCBs for the front panel, so now I just have to wire it up to the prototype main board and insert the ATTiny. I'll write more about the front panel board in my next post.

  • SMT isn't so hard, but little luck

    gilphilbert07/13/2021 at 20:29 0 comments

    The SMT work wasn't anywhere near as hard as I was expecting. Having the SMT stencil really helped as it put the correct amount of paste down and it really helped keeping the components in place as I put them on the board. I did have the hot air gun power up too hard at first and sprayed my components around a bit, but after I fixed that it went pretty well. I had a tiny amount of reflow - two resistors that were pretty close had joined at one end.

    I built the power sections first and measured everything. 4.98V and 3.3V on the nose, so all good. I soldered on the ESP32, switches and resistors and the SD card slot and flashed the MCU. A quick test showed that the SD card was behaving a little oddly, but nothing serious it was working - I was just getting some spurious errors. Nothing serious, so I decided to put that on my TODO list. I wish I hadn't...

    Next I soldered on the DAC stage. Again, this wasn't too bad - I had to remove a little extra  solder that was bridging two the IC pins but that was it. I powered it back up and connected it to the amplifier stage on my previous prototype as I hadn't built the amplifier stage yet. This was a smart move, as it turned out.

    What did I get? HISSSSSSSSSSSSSSSSSSSSSSSSSS. Not good. Not only that, but now the ESP's serial was behaving strangely with some garbage characters and I couldn't get the i2c communication to work at all. The display was working nicely though.

    I've spent hours fiddling with this new prototype. I removed and re-soldered the ESP32, even trying a different module in case I had burned out the first one by heating it for too long. I removed the PCM5102A and resoldered it, but still I was getting tons of static. I removed the ESP32 and tried using the board as a very large DAC module, but nothing. I swapped my 1K i2c pullup resistors for 4.3K in case they were too strong (with the FPC cable they shouldn't be...) and I swapped out the input capacitor for the 3.3V LDO in case that was an issue. Here's the board after all that work:

    In the end, I've come to a single conclusion: the power supply is causing issues. It's the single item that could cause such widespread issues.

    It's very frustrating and I can't really track down the issue as I don't have an oscilliscope. I may have to buy one to track down the issue. The documentation for the LMR14020 isn't wildly clear and while I'm no fool, I can't figure out some of their calculations which don't seem to add up.  Perhaps I'll try a different 5V switching regulator design. Back to the old prototype for now while I try to work out how to solve this issue.

  • A quick update on the prototype

    gilphilbert07/11/2021 at 06:08 0 comments

    This is my current prototype with all through hole components (except the ESP32-WROOM-32U which only comes in castellated form). This shows the PCB in the enclosure:

    You can see the larger heatsink (it says "PAT. PENDING" on top), the amplifier stage at the rear, the ESP32 at the front and the SD card reader on the right. At the front is header for the connection to the front panel. That thing hanging from wires is the DAC module - as the header is around the wrong way, I had to use dupont connectors to get it working. In this model, you can see the empty footprint where the DS logarithmic potentiometer was. I've removed it since I've discovered the ESP32 can control the gain of the DAC directly in software. It doesn't go super-quiet (think whisper quiet) but my kid will be rocking out to this, so that's OK for my purposes. I need to cut a chunk out of the battery bay so it will be possible to change the SD card without taking the lid off - simply removing the battery cover will provide access.

    This one shows the unit a little more assembled:

    The thing hanging off from the left is the PN532 NFC card reader. It's connected via I2C and uses interrupts. Hidden behind the OLED is an ATtiny 841 that powers the (currently missing) button pannel. I only have one connector for the button panel and I don't want to ruin it, so I won't solder it on until the top board is final. At this point, you can scan a card and it will play a song!

  • A new power section and DAC

    gilphilbert07/11/2021 at 05:51 0 comments

    I've been fiddling with my prototype - enabling the wifi on the ESP32 sends the temperature of the LM7805 through the roof, so it's fair to say that it's not going to cope - even with a better heatsink. Even if it could, the sheer power consumption is drawing too much power from the transformer which no doubt was never designed to provide this much power on the electronics line. Sadly, there's no way to find out what the rating for the transformer is. It's obviously more for the 12V line (since this was previously driving a 35W Class-AB amplifier) but the line for the electronics (which was powered at a surprising 20V, down to 12V via an LDO) isn't designed for what I'm drawing from it.

    The solution I can see is a switching regulator instead of a linear one. This will generate considerably less heat (potentially negligible) and put less strain on the transformer. In my hunt for a good switching regulator, I've tried to avoid the low frequency switching regs (~150kHz) and instead have settled on the LMR14020 - a 2A switching regulator at 1MHz. The components are pretty minimal so it shouldn't be hard to integrate... but it's SMT, not through-hole. My plan was to use through hole components for ease, but footprint (I have less space than expected) and component design has forced my hand. Once I've gone down this road, I may as well go all-in. I've swapped the 3.3V regulator from a through hole LM1117T to an SMT LM1117T-MPX and the associated components. I've also swapped the supporting components for the ESP over to SMT. To squeeze the TPA3122 into the smallest space, I've also swapped a few components over to SMT (just a few capacitors) but most of it is the same as before.

    Finally, I've taken a brave step. While I have a lot of experience soldering - even the odd bit of SMT, I've never dealt with anything tiny. I've ditched the large DAC module for a much smaller design of my own, leveraging the PCM5102A that I know works with the ESP32. It's a pretty tiny chip - SSOP - so that's going to be fun! Given all the SMT components, I've ordered an SMT template as well which should help putting down the solder paste. That's another first - so wish me luck!

    This is my next PCB design:

  • Well, I guess it kind of works

    gilphilbert07/07/2021 at 04:03 0 comments

    So good news, bad news and some more good news. Oh, then some more bad news.

    Good News

    I've populated the new board (good news) starting with the power components. One of the changes I made was to make space for a much larger heatsink for the LM7805 5V linear regulator - the input voltage is 12V from the transformer and it was getting very hot. A much larger heatsink is keeping the LDO cool enough to not constantly go into thermal shutdown, which is nice. However, I read the temperature with a IR thermometer - the heatsink is around 85 degrees (celcius) so the internal temperature must be through the roof - and while it's not in thermal shutdown, simply putting the lid on might make that happen. Nonetheless, I'm counting this as good news because otherwise I don't have much good news...

    That said, the new microSD card reading is working perfectly now that the power lines are wired correctly. I can now read files from the SD card - definitely good news.

    The Bad News

    I added some headers for the DAC and plugged it in, hoping for glorious sound from the little PCM5102A module I bought from eBay/Amazon (don't remember which). It has a headphone socket on it, so I don't need to populate the amplifier stage to hear audio. No sound. This is annoying. Then I noticed there's no red light on (indicates power) so went to investigate. The DAC has two rows of pins adjacent to one another. One side is just fine, one side is... well... backward - and there's absolutely nothing I can do about it. I've used dupont cables to plug the DAC module in, but that's definitely not a long term solution. Still, with the pins round the right way I can hear audio... woohoo! Now on with the amplifier.

    More Good News

    I had a couple of "hiccups" (including a short under the ESP32 that caused me some confusion when a simple pin state change took down the entire board by connecting GND and 3.3V. After I fixed that, I heard sound from the speakers! I was a little worried about the amplifier stage - I've never built one and my prototype didn't work - but it works perfectly! All I need to do is fix the header issue and it looks like the main board is done!

    Don't Get Your Hopes Up

    Fortunately (depending on how you look at these things) I decided to put the lid on the thing before I ordered the new PCBs with the corrected header. I'm so glad I did - the lid doesn't fit (not even a little bit). The underside of the lid which houses the speakers is a very odd shape underneath. There's a few things in the way (a bulk capacitor, both LDOs, the DAC) that stop the lid from fitting on. I thought I'd measured this... but apparently not. So now I need redesign the PCB to cram anything over 12mm into the top right corner and work out how to cool down that LM7085...

  • Well they're here... again...

    gilphilbert07/06/2021 at 23:15 0 comments

    The first generation of PCBs turned up and had a slight flaw that took more time than I admit to find.

    I populated the power supply components and tested it (a habit I picked up after destroying a board of perfectly good components and a badly designed power supply stage...). The ESP fired up and I programmed it using the serial header. Next, I put some MP3 files on an SD card and inserted it. I brought up a serial monitor... and nothing.

    Nothing at all. Zero. But it was working fine before. A multimeter revealed that the 3.3V line was reading just 0.9V. Clearly not right. After some investigation, I discovered it was the SD card. Popping it out reset the EPS and all was good, but as soon as it was inserted - the same story.

    I spent a lot of time trying to find this one. I scoured my schematics, datasheets and PCB designs. I followed every trace and verified that I had no shorts. I replaced the ESP32 and resat the SD card slot - still nothing. I couldn't figure it out. I'd spent so long looking at the schematics that I missed something painfully obvious. The 3.3V and GND lines for the SD card were backwards (pointed out to me by AIM65 at diyaudio forums - he did warn me that I would kick myself when he pointed it out. I have the bruises to prove he was right...). After soldering on some wires to the (tiny) PCB pads and wiring up the Micro-SD card slot from my display I confirmed this was right. Very frustrating. But that's OK. Well, it's not. But it will have to be! I fixed the issue (and some layout issues I'd noticed), swapped the SD card slot for a micro SD card slot and ordered another set of boards:

    These have now turned up and I'll populate them soon. I had to remove a bunch of parts from the old PCB and I forgot to take a photo first. I'll add a photo of the new board once it's populated.

  • Circuit boards

    gilphilbert07/02/2021 at 16:10 0 comments

    When I decided to use the Bose radio, I hadn't really thought too much about it's shape. Sure, I'd seen these radios in the '90s (not really since then) and I knew it was wedge-shaped, but I guess I didn't really consider what that would mean in terms of PCB shape. Of course the main board isn't square - not even close. This has made PCB design a nightmare.

    I generally use EasyEDA - it works on all my devices (even my Chromebook), has a pretty decent feature set and integrates with LCSC's component library. Finally, it can designs straight to JLCPCB who I generally use for my PCBs. Given the shape of the PCB, I really wasn't sure where to start. There's no obvious (0, 0) to use as a corner or central point. I tried taking photos for outlines but the perspective was always wrong. I tried scanning an image in using my flatbed scanner, but that still wasn't quite right.

    In the end, I discovered that 150% zoom on my monitor just happens to be 1:1 with real life. This meant I could hold the old board up to my screen and draw an outline / the mounting holes. My arm still hurts from holding it up all that time.

    Eventually, I had a rough outline. Printing it off on letter paper at 100% allowed me to cut it out and then it was iterative design from there. Move this mounting hole by 3mm to the left, try again, etc. Finally, I have a PCB shape to work with. Then there's the component placement. The front of the unit only has 12mm clearance, so all the caps, diode bridges, the DAC module (which I will use as-is), etc. all need to go in the back left corner where there's some height. 

    Putting all of my components into a schematic gives me this:

    After working out the board dimensions and squeezing everything into the top corner:

    I'm ordering the boards and any remaining components so I can start building. No doubt there will be several revisions...

  • Prototype

    gilphilbert07/01/2021 at 08:21 0 comments

    I bought some basic components to get things started on a prototype. More than anything, I need to know if the ESP32 can handle this. I'm pretty sure it can but better to be sure.

    I've used an Espressif ESP32-DevKitC I had laying around (I keep a few on-hand) and a spare display with an integrated micro-SD card reader. The great thing about this model is that it doesn't feature a logic level shifter, it's just the micro SD card slot and a single decoupling cap. I'm not using the display (it's a 2.8" TFT) just the SD card reader. I don't have the correct display, so I'm using a spare 3.12" OLED from Newhaven Display for now. It has the same SSD1322 and the same resolution, so it's functionally identical.

    I wired up the SD card reader to the ESP32, put a few songs on an SD card and had the ESP32 reading the contents in no time. I added the PN532 and spent a long time looking for libraries that worked. First I had to format the cards, prepare them, then write a string (a filename of a track on the SD card). At this point, I could wave a card and it read the card - most of the time. The problem is that the linear regulator I'm using is a cheap module from eBay that, frankly, is useless. The voltage it puts out is anything but smooth and the PN532 appears to be fairly sensitive to voltage spikes.

    I had the display working in no time. Now for some sound!

    I wired up the DAC - just a few pins: power, ground and three I2S connections then plugged in some headphones. I was excited, this would be sound! I powered it up, flashed the firmware and... nothing. No sound at all. Hmm. I fiddled around with the DAC and it made no difference. Wiggled some wires - the way we always do, hoping it will magically fix things - but there was no magic today. After some experimentation, I found that if I not only powered the DAC module with 5V but also provided 5V to the XFMT pin, I got sound! Hooray, it's working. The code is very rough, but it works.

    I've breadboarded up the amp... excited to hear it make some sound, but alas, no sound from the speakers. All I have is a strange clicking noise. It seems that this is usually related to the decoupling caps - but I've tried everything, even posted on forums, but it seems that the TPA3122D2N just isn't breadboard friendly. I can only hope that once I've designed the PCB and built it all, that the amplifier works.

View all 14 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates