Neil's assignment for this week:
group project:
        use the test equipment in your lab to observe the operation
           of a microcontroller circuit board
     individual project:
        design a development board to interact and communicate
           with an embedded microcontroller
        extra credit: try another design workflow
        extra credit: make a case for it
        extra credit: simulate its operation
Qwiic system example
Sparkfun's Qwiic system connecting to several of their I2C modules using a daisy-chained cable.
My plan for the individual assignment is to make a development board that interfaces with the STEMMA and Qwiic plug-and-play microcontroller systems offered by Adafruit and Sparkfun respectively. These companies sell sensor boards and other modules that just plug into their development boards with a single jack and cable, no messy wiring. The two systems are compatible with each other, and I'd like to make a dev board that also works with them.

Regarding the group work, as a physics professor I actually have more experience using an oscilloscope than our class instructor, so he asked me to take the lead in teaching that side of the group lab activity. I have written up my lesson plans for what I showed the other students, in lieu of doing a group writeup myself. My instructor and I agreed that that was probably more useful to everyone than for me to join one of the groups.

Group Contribution: Oscilloscope Lesson Plan

This section describes how I taught the other students in my lab to use the Rigol DS1102E oscilloscopes in our Fab Lab. Other materials needed for the lesson: an Arduino and a computer to connect it to. (We used a Seeed Xiao ESP32C in the lab this week.)
  1. First, describe the purpose of the scope: to measure voltage changes that happen too fast to be detected by a multimeter or noticed by the human eye. The multimeter is great for basic problems -- is it connected? Does it have power? while the oscilloscope is great for debugging complicated circuit problems -- is the microcontroller sending data as it should? Is there electrical interference causing trouble?
  2. Now show the basic controls, and how to hook up the probe:
    Oscilloscope picture
    Basic controls for the Rigol DS1102E oscilloscope.
    Oscilloscope picture
    How to connect the probe to a circuit.
  3. To demonstrate the concept, program an Arduino Uno with the standard Blink sketch. Attach the oscilloscope to ground and to the LED pin. Set the vertical scale to 1V/division, and the horizontal scale to 0.5 sec/division. Students will be able to see the trace slowly moving across the screen illustrating what the scope does, at human-eye speed.
  4. Now ask students to modify the Blink sketch with a much shorter delay (say, 1 ms instead of 1000) and tune in the scope to find the signal. Demonstrate the following:
    • Adjust the horizontal scale for the new pulse frequency
    • Adjust the vertical scale
    • discuss the scale of the grid lines on the screen and how to read them quantitatively (each square is one of the divisions selected on the scale knobs.)
    • Show how the "trigger" knob can be adjusted to synchronize the oscilloscope with the input signal, and how hard it is to read when the triggering is too high or low
  5. Demonstrate pulse width modulation, and how it works, using the following code:
    int ledPin = D8;
    
    void setup() {
      // initialize digital pin ledPin as an output.
      pinMode(ledPin, OUTPUT);
    }
    
    void loop() {
      analogWrite(ledPin, 100);  // Turn the LED on weakly
      delay(1000);                      // wait for a second
      analogWrite(ledPin, 200);   // turn the LED on brighter 
      delay(1000);                      // wait for a second
    }    
    Students can see that "Analog" output varies the duty cycle of digital pulses.
  6. Finally, we can show how the "bits" of binary communication work. The following code creates a serial output on the same pin that was being used for blinking earlier, so we can see the direct binary signals the chip emits as it sends "Hello World.":
    HardwareSerial MySerial(0);
    
    void setup() {
      // Initialize custom hardware serial port
      MySerial.begin(9600,SERIAL_8N1,7,8);
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      MySerial.write("Hello World"\n);
      delay(50);
    }      
The pulses emitted by the Arduino can be decoded using knowledge of the UART protocol and ASCII. I find that students really appreciate seeing "ones and zeros" on the screen, and what digital data actually looks like.

I wrapped up the session by talking in general about some of the advanced features of the oscilloscope so students know what's possible and can look up the details:

(Photo of student results here once they post them.)

Development Board Design

For my indivdual project, I designed a development board using KiCAD. I have some experience doing circuit board design already, so I took this as an opportunity to do something more aesthetic and not just utilitarian.

My concept is called "Beansprout", and the goal is to allow the Xiao Seeed processors to interface with the quick-connect Stemma QT and Qwiic cabling systems by Adafruit and Sparkfun. (It's called Beansprout because it's a Qwiic Stemma that starts from a Seeed.)

Stemma QT
Adafruit Stemma QT I2C cable

Design goals are as follows:

Later on in the semester, when I need to build a board with button or display or sensor or something on it, I'll build it to be Stemma-compatible, so I can wire it up just by plugging it into the Beansprout. These will be called "leaves", or maybe "pods".

I took a lot of notes while planning this out, including links to components, a tangent about selecting magnetic field sensors for the final project, and the details of the Stemma system. Most of this is captured in the page you're looking at now or my final project page, but for the sake of completeness here's a link to my Google Docs notes.

KiCAD Concepts and Glossary

There's a lot of new concepts and terminology in circuit board design, so here's a quick definition of terms and ideas:

Installation and Setup

I followed our instructor Brandon's procedure for setting up KiCAD for FAB use.
  1. Download KiCAD from https://www.kicad.org/download/windows/.
  2. Install the Fab Academy KiCAD libraries, which provide symbols and footprints for parts we typically have in the lab. To do this:
    1. Clone the Fab Library git repo. In git bash, do git clone git@gitlab.fabcloud.org:pub/libraries/electronics/kicad.git in the directory where you want the libraries to live.
    2. Open Preferences → Manage Symbol Libraries. When prompted on first setup, choose "Copy global default symbol library".
    3. Click + to add a new library.
    4. Click the folder icon in the "Library Path" column, and find the fab.kicad_sym file in the cloned Fab repo. Choose the nickname "fab".
    5. Open Preferences → Manage Footprint Libraries. When prompted on first setup, choose "Copy global default footprint library".
    6. Click + to add a new library.
    7. Click the folder icon in the "Library Path" column, and find the fab.pretty folder in the cloned Fab repo. Choose the nickname "fab".
    8. Open Preferences → Configure Paths…
    9. Click + to add a new path that points to the git-cloned folder. Set the Variable Name to FAB.

Creating a Board: First Draft, "Phat"

My first draft for a dev board, I just threw some parts together and hooked them up. The process is as follows. First, create a new project and open the Schematic Editor.

Schematic Editor

  1. Add parts using the Add a Symbol tool to lay down my microcontroller and connectors. I used the following parts:
    • Seeed Xiao RP2040
    • Conn_Header_JST_SH_1x04_Vertical_SMD x2 (Stemma QT I2C)
    • Conn_Header_JST_PH_1x03_Vertical_SMD x2 (Stemma GPIO)
    • Conn_PinHeader_1x07_P2.54mm_Vertical_THT_D1mm x2
      (These are standard 0.1 inch header modules, like you find on an Arduino Uno.)
  2. The 1x07 pin headers are through-hole mount, which isn't Fab preferred, but I couldn't find surface mount components. I plan to change them out later.
  3. Move the symbols around to make logical sense. You can pick them up to move with the "M" key, rotate them with the "R" key, and flip them horizontally and vertically with "X" and "Y".
  4. Stemma QT
    Changing the value of a symbol
  5. Add Power symbols using the Add Power Symbol tool. These have the special property that they're automatically wired up to each other: all GND symbols will be joined with traces on the board, you don't have to wire them up in the schematic. I used the following power symbols:GND, +5V, and +3v3 to match the power available from the Xiao.
  6. Draw wires to connect the Xiao to the connectors using the Add a Wire tool. (Not the Add a Bus tool!)
  7. Add Labels to the different signal lines using the Add a Net Label tool to indicate their function.
  8. Add names to the different connectors to shorten them and indicate their function. Double-click on the symbol and change its "Value" to something meaningful.
My first draft schematic design looked like this:
First draft schematic design for my devboard. The weird extra components at the bottom left are jump resistors, to be explained later.

PCB Editor

Now it's time to lay out the components on my future circuit board. Open the PCB Editor from the project window, or hit the Switch to PCB" icon.
    design rules
    Design rules for my board. Notice that everything's at least 0.4 mm in size.
  1. Use the update board from schematic tool to bring your schematic parts into the new PCB design. The parts will come in as a group.
  2. Lay out the components in a way that makes physical sense, using the same movement commands and keystrokes as in the schematic editor. Now, orientation and position are crucial! Traces can't cross over each other, so you need to minimize or eliminate crossing points. Traces can go under components though, which is the key to success.
  3. Set up "design rules". We're going to be milling this board with a 1/64" (0.4 mm) wide bit, so it's crucial that all traces and pads are separated by at least 0.4 mm. Many of the other rules (like for silkscreens) don't matter.
  4. Set up standard trace widths. In the File / Board Setup menu, choose "Net Classes". I changed the width of the default tracks to be 0.8 mm, with 0.4 mm spacing between them. This will hopefully give nice big phat traces that are easy to mill and can carry lots of power if needed.
  5. netclass setup
    Design rules for my board. Notice that everything's at least 0.4 mm in size, and kept 0.4 mm away from everything else.
    netclass setup
    Default netclass setup for my board (0.8 mm traces, 0.4 mm separation)
  6. I also created a thinner track width in the "Track" dropdown, of 0.4 mm, to connect to small components and pads.
  7. The thin blue lines are "airwires", and show which pads need to connect to which. Replace these with actual traces using the Route Tracks tool. As I drew, I made sure to keep everything as widely separated as possible while keeping the overall design as compact as possible.
  8. Edge cuts
    Edge cuts layer and rectangle drawing to create a board outline.
  9. Use the Design Rules Checker in the "Inspect" menu to find any problems with your board and make sure it's manufacturable. In my case, this found a whole bunch of tiny little traces that I couldn't see buried under the intended ones.
  10. To make an outline for your board, activate the Edge.cuts layer on the right side of the PCB editor, and draw a rectangle of the desired size.

Crossing the Streams: The Jump Resistor Trick

Often, two traces have to get past each other, and there's no way to route them around to avoid crossing on a single-layer board. That's why most professional circuit boards have two or more layers. To make it work, the secret is to add zero-ohm SMD "Jump resistors" to your design, so traces can "hop over" each other. These are included in the Fab KiCAD library as R_1206_JMP. In the schematic editor, they have only one terminal, so you can stick them anywhere. In the board editor, they have two pads carrying the same signal, so you can use them to hop over other traces. The only drawback to this method is that it leaves "air wires" between the two pads of the jump resistor, which causes error in the design checking phase, I'm not sure if that can be avoided.

In the end I needed three. I feel like I could have made it less if I were smarter at solving the routing puzzle.

jump resistor (schematic)
Jump resistors in the schematic editor.
jump resistor (board)
Jump resistors in the board editor. Note the remaining blue airwire. (Don't try to connect it!)

Finished First-Draft Board

Here's what my final first-draft board design looked like:
First draft board design for my devboard.
I wasn't really happy with this. The extra pin headers seemed redundant, since they were just repeating what the Xiao does anyway, and it looks bulky and awkward.

Second Draft: "Slim"

Soldering pin and Xiao to PCB
Through-hole and surface-mount combined in one big blob of solder.
So then I thought, what if the devboard had pins that poked through both the xiao and PCB, so you could plug it into a breadboard for custom hookups? The Xiao footprint already has through-holes you could use for this, and it has castellated holes so you can still surface-mount it to the top of the board. But the current design is too fat: it would cover all the holes on a standard breadboard. And so I started thinking about an alternative "slim" design. As the design evolved I realized this one could be done with only one jumper resistor -- and it's only really there for aesthetic reasons. Here's the new design:
Slim design (schematic)
Schematic for the "slim" board design.
Slim design  (board)
PCB design for the "slim" board design.

Next steps: The "Beansprout" Aesthetic

And that's when the "Beansprout" concept really started to take off, because now it starts to look like a beanstalk, or something plant-like, with rising tendrils for the traces.

But it's also when I ran out of time. When I actually build this, I'm going to re-do the traces so they have smooth organic curves instead of angles, add some cosmetic "leaves" to the design of the copper. And the daughter boards that plug into the design will be leaf or seed-pod shaped. I made a pencil sketch of what the overall idea would look like, and exported the traces to Illustrator as an SVG and made an initial stab at redrawing the traces as smoothly curved lines and adding leaves. Unfortunately I didn't have time to perfect this and I'm a terrible artist, but you get the idea of what I'm going for. I tend to think in straight lines, and this sort of organic drawing isn't in my skill set. I'll revisit this soon!

sketch of beansprout design
A pencil sketch of the "beansprout" idea.
sketch of beansprout design
An inital stab at organic curving tendrils for the traces.

Design Files