Week 5: Into the Matrix

#electronics #pcb #simulation

Group assignment

For the group assignment, Alan Han explained power supply, multimeter, oscilloscope, function generator, and logic analyzer. I used my own project to study the logic analyzer. The device used MAX98357A as DAC and amp but had an issue producing sound. During the debugging session with the TAs (Nikhil and Alan), we ruled out power issue by observing stable power voltage. We also ruled out connection issue as all the lines: clock, channel, and data were normal. We found low voltage on speaker. Eventually, we realized the bug was software. The diagnostic tool was helping in eliminating hardware issues.

During the testing, we noticed that the plugging in/out of probes can interfere with the I2S signal. Presumably because of the motion of the probes causing inductance change, which in turn, distorted the clock or data line.

Hooking up logic analyzer probes Hooking up logic analyzer probes

We used saleae Logic 2 analyzer with the companion software. The tool can visualize both digital and analog signals and allowed us to choose a protocol and decode the data. Very helpful.

Visualize data Visualize data

Simulation

I wanted to simulate the hand-held device of my final project. For simulation, I wanted to study the idea of addressing unique 3.5mm audio jacks using binary encoding.

TRRS jack TRRS jack

One pin for ground, 3 pins for 2^3 = 8 unique addresses. I used an 8-pin DIP switch to simulate the 3-bit binary input. In production, the input will be determined by the jack that the user plugs in. The jack's identity only matters in the software, but to make the simulation fun, I added an LCD display to show which jack is plugged in. Since it's a walkie talkie, I added a push button to show TTS, and a slide switch to toggle between modes: programming vs. interaction. I used wokwi, which provided the Xiao-ESP32-C3 board that my project uses. For production, there won't be an LCD, but will be an I2C DAC/amp and a I2C ADC for audio input/output. I will prototype them for the actual PCB design. If there are enough I/O pins, I will consider a second button so user can squeeze both to enable broadcast mode.

Simulate the hand-held device

I also wanted to simulate the main body device. It has two roles: lighting up an LED for a specific jack, where the computer will control which jack is active and use wifi to activate it, and setting the 3-bit address for each jack, which can be hardwired directly from Xiao's 3.3v output. To make the simulation more interesting, I cycled the LEDs in order, just to show I can address them by software.

Simulate the main device

Designing the Operator

To prepare KiCad with the symbols, footprints, and 3D models, I followed the documentation to install our course library. In addition, depending on the installation method, you may need to manually add additional libraries from the official repo. When installing with Flatpak, the official 3D models were already included.

I wanted to start the PCB design towards my final project, using KiCad. The schematic design is very simple: layout the Xiao-ESP32-C3, I2S Microphone, I2S DAC/Amp, a TRRS jack, and a couple of switches.

Schematic Schematic design

As soon as I transitioned to the PCB design, I realized the problem: I hoped to use the MAX98357A and ICS-43434 both on their breakout boards, not as bare ICs.

PCB design PCB design missing breakout boards

Also, I don't want to solder them onto the same board as the Xiao. As a consumer, I enjoy electronics that come with user repairable parts. So I decided to pivot: design a development board that helps me route the pins from the Xiao to the headers where I can plug in the breakout boards. If I accidentally damage any component, I want to make it easy to swap out the broken part.

Starting over, I put down the schematic design using pin sockets and loaded them into PCB editor. When I opened the 3D view, I realized that I chose the wrong connector.

Schematic design Schematic design with the wrong sockets

PCB design PCB design with the wrong sockets

I wanted female socket, but got the male pin instead. Switching to female socket, the symbol exists, but they are missing footprint. Luckily, I was able to find a similar footprint. Assigning the footprint to the symbol allowed me to open the PCB editor based on schematic design.

Missing footprint The symbol is missing footprint

Assign footprint Manually assign footprint

Schematic design fixed Schematic design with the right sockets

3D view confirmed 3D view confirmed socket type

Just as I thought I was approaching the finish line, I recalled to run the constraint checker. I realized I had chosen the wrong track width. Instead of 0.2mm, I should have chosen 0.4mm.

Selecting track width I should have selected track width sooner

Setting minimum clearance Set minimum clearance

It took me a while to manually fix all the wires. I also marked up the area for the speaker, just to get a sense of scale.

PCB design PCB design with the correct sockets

Feeling a bit uncertain, I went to the office of our TA Alfonso and got the immediate bad news: I didn't run constraint checker after changing the track width. Running the constraint checker again, more problems appeared. Because I laid out the wires using 0.2mm track, now the wires are touching the keepout area. After several rounds of manual fixing, I felt that it was impossible to clear the errors without crossing at least one wire. Alfonso agreed and encouraged me to try using 0 ohm resistors as a jumper.

Crossing the wire Crossing the wire

Adding a jumper was not as straightforward as I thought. I had to go back to add the symbol, then redo almost the entire PCB design due to position shifting. The resistor jumper requires additional clearance, forcing me to push out the speaker area.

Jumper in schematic Jumper in schematic

Final 3D view 3D view with the jumper

Designing the Switchboard

After designing the hand-held device PCB, I felt more comfortable with the tool and quickly designed the main body PCB. For each TRRS jack, I added an LED as status indicator. I "hardwired" the 3-bit address from Xiao to each jack. I used resistors to protect the LEDs from high voltage.

Main body schematic Main body schematic

Main body PCB design Main body PCB design

Final 3D view Main body 3D view

Key lessons learned: Apply design rules before starting PCB layout. Check constraints often. Do not lay the wires too early. They are not easy to change.

Appendix