Peripherals Involved: GPIO, I2S, DMA, I2C
I did a lot of firmware/embedded projects in college, my capstone involved using a microcontroller to transmit and receive data using visible light diodes, but I haven’t done any since. I grabbed an STM32F4 and looked for a project to get myself back into firmware and my friend’s birthday presented an opportunity.
He has a cat named Chalupa who’s getting up there in years and I wanted to give him a little keepsake of her to keep on a shelf at home or in the office. The development board I got, the STM32F407-Discovery, conveniently has an audio chip on it, the Cirrus CS43L22, and there’s some guidance in an app note online on how to implement audio using the board.
I secretly recorded Chalupa purring, and then converted that to hexadecimal text using Audacity and Octave (a free MATLAB alternative) so I could copy it into code. I could get the audio playing through earbuds plugged into the board’s headphone jack, but in the end I would be using it to play audio out speakers. I had to modify the code to do so without getting to actually test it in hardware, so I had to get it exactly right.
I developed a board to go into the box, powered by 3 AA batteries. I used two TLV1117 regulators to convert that to 3.3V for the MCU and 2.5V for the audio. I layed out the PCB using the development board for reference and got the bare prototype board built by OshPark.

Time to get to work. Luckily I got three boards because good god hand-soldering a QFN package is incredibly difficult.



I also did some product design in figuring out the enclosure box, and getting the button. I got the box from Michael’s, just a simple wooden box that I drilled a hole in for the button to go in, put in the battery and board all soldered up, and epoxied shut. I got a photo printed of Chalupa and then attached that to the box using mod podge. I did end up later painting this as well to add some color, and a paw print on the back matching Chalupa’s toe beans, but I unfortunately didn’t get any pictures of that.
And hey here’s the finished product. Look at that cutie!