miranda makes things! Week 9

Week 9

Overview Individual Assignment Group Assignment

This week I made a PCB which has an OLED, amp, and two speakers wired in parallel which I plan to use for my Tiny DDR final project, as the brains of the operation.

Tiny DDR display + speaker board

For this week’s project I wanted to make progress on my final project by implementing a board with a display and a speaker. This board will be used to display the arrows across the screen and synchronize them to the music. It will speak I2C to the board with the arrows which I made in week 6, to read in the pressed arrows and score them based on how close they are in timing to the ideal DDR arrow.

Sketches

First, I did some sketches on paper. I received a lot of very helpful guidance from Quentin, who also explained to me the important function of a pull-up resistor in ensuring that an unconnected switch / pin is not floating. Since the DDR machine has two speakers, I also wanted to have two speakers on this board, though I was happy for them to be playing the same audio file. Quentin suggested I connect the two 8 Ohm speakers in parallel, and we double checked in the datasheet that the amp I am using (the MAX98357) can in fact support 4 Ohm to 8 Ohms, so this is fine.

Quentin also pointed me to two helpful Neil Examples(TM): the RP2040 OLED example and the RP2040 MAX98357 example. I basically Frankensteined these two circuits together by reverse engineering their board schematics (OLED here, MAX98357 here), to get these sketches:

KiCad

Then, I was ready to start schematic-ing in KiCad!

Silly hiccup to start things off – I did a bit of reorganization of my folder structure on my computer and accidentally unlinked the fab library in KiCad. I was able to eventually locate the preferences menu in the symbol / footprint editor to fix the path, and all was well.

I made a custom footprint for the male header which connects to the amp by copying the footprint of the normal 7-pin male header and labelling the pins with the amp sockets they are connected to. I accidentally misaligned one of the pink lines of the courtyard for the footprint, and got a DRC error about it. I fixed it by making sure the courtyard was a closed rectangle.

In board setup, I set my minimum clearance to 0.5mm, learning from my mistakes in the previous week. Technically our machine can do 0.4mm, but since we use gerber2img to rasterize to png and then generate the job from the png, some of my traces that were 0.4mm apart last time did not get separated out in the job preview. So, just to be safe I went the conservative route.

I carefully ensured the header pins were correctly ordered for attaching the display to the back of the board, and was able to draft an initial version of my schematic and layout.

I exported these files and then imported the edge files with drill files into gerber2img, and then realized I forgot to delete the through holes which are default for the the Xiao – I edited its footprint to remove the through holes and and reexported it. I also realized I forgot to add a ground plane to the layout, which I got a mild scolding from Quentin about last time around – to avoid a second scolding I added a zone and connected it to ground.

Here were my final schematic and layout:

After putting the gerber files into gerber2img, here were my edge cuts and traces:

Using the measure tool in the Kicad layout tab, I found that my final board would come to 24mm (width) x 38mm (height).

Milling

Next I was ready to mill my board on the Carvera, but I ran into some issues. The probe was dead (low voltage), which was an issue Alan had reported in the Slack. As per his instructions I tried docking it and leaving it to charge for a while, but the voltage never made it to the desired 3.7V. I tried just going ahead with the job anyway, but the machine would crash in the middle of the probe sequence, and after disabling the alarm the probe would be at 0V again.

Luckily, just when I needed him, Alan apparated. We tried debugging the probe together; I showed him the behavior I had observed and we tried once again to dock the probe for charging and run a shorter probe sequence, to no avail. We found another probe, but had trouble connecting it to the Carvera. I had to leave, but Alan stayed behind, and was able to get the Carvera working again! He ran my job for me when I was gone, and I came back a few hours later to a beautifully milled board:

I sautered on the pull-up resistors, amp, speakers, and OLED, and ended up with this:

To distinguish the speaker wires, I used black and white for ground and red and orange for power. I twisted the ends of the wires going to the same net together and screwed them both into the same screw headers, since the speakers were meant to be wired in parallel.

Programming

I did the bare minimum programming to verify that my system works, since I don’t yet have the DDR logic which will play the music and display the arrows fully finalized.

First I verified that the speakers work by running Neil’s XIAO RP2040 MAX98357A I2S amp hello-world:

Next I verified that the OLED works by running Quentin’s OLED hello world:

Checking the power output of a servo

I did this group assignment with Charles and Jacqueline.

We plugged Charles’ servo into the DC power supply. We toggled the AMPS / VOLTS toggle to VOLTS, and set the voltage to 5V (our power voltage). Then, we toggled the toggle to current, and set the maximum current by shorting the clips and setting the current to 1A. We connected the red clip to power and black clip to ground, as usual. We inserted our clips into the connection between the microcontroller and the servo. When we ran the servo, we were able to see the current being drawn on the DC power supply! Charles showed us how applying load to the servo spikes the current, which draws more power since P = IV. Charles explained that if the current spikes past the allowed current, the c.c. indicator light will come on.