htmaa '22, by jakin

week 5: electronics design

Prior Experience: 0.5/5

I actually have never designed a circuit before, although I have used the Arduino IDE to connect to circuits that I referenced (Arduino + breadboard) or a PCB that someone else gave me. For some reason, even though I've learned about resistors/capacitors/etc. in an E&M context (I can calculate the effective resistance or whatever), it's really hard to understand what it means/these components do in a circuit that actually does something. I had no idea how I would start on this week, but thankfully there were resources to guide me.

This week, we will be designing the actual circuits that we mill out!

The assignment for this week is

  • group project:
    • use the test equipment in your lab to observe the operation of a microcontroller circuit board
  • individual project:
    • redraw an echo hello-world board,
    • add (at least) a button and LED (with current-limiting resistor)
    • check the design rules, make it, and test that it can communicate
    • extra credit: simulate its operation

This is the echo hello-world board that I decided to redraw: http://academy.cba.mit.edu/classes/embedded_programming/D11C/hello.D11C.echo.png

I started following Jake's Eagle tutorial. Eagle is an ECAD software that is integrated with Fusion 360. Here is the demo: http://mtm.cba.mit.edu/2021/2021-10_htmaa-demo/.

I clicked File -> New Electronics Design. Then I created a New Schematic, which automatically generated a board, which I can see when I click Switch Document.

First, I typed "/grid on" to turn on the grid. I went to the Library tab and clicked library manager. There are lots of different libraries, but I just uploaded the fab library from https://gitlab.fabcloud.org/pub/libraries/electronics/eagle/, since this is all I will need for HTMAA, and turned it to "in use", and turned off all the other libraries.

There are 10 fundamental commands for circuit design in Eagle.

  1. /add pulls up the fab library (resistors, microcontrollers, capacitors) and together with /delete are how you build a schematic.

Components can sometimes have multiple footprints, such as the ATSAMD11E18A, which Jake used. I am redrawing the board with the SAM D11 C so I just selected the UC_ATSAMD11C14A-SSUT component as the microcontroller and placed it on the grid.

  1. /grid on, which we already used, turns on the grid for the schematic and the PCB documents. The grid can be very frustrating but it can also be very useful. mil is 1/1000th of an inch, but we can switch to metric by using grid on mm 0.5, which switches to a smaller grid.

Then, I continued adding the rest of the components on the hello.D11C.echo board. The 10-pin connecter I used was the CONN_05X2_ARM_DEBUG, and I selected CONN_05X2_ARM_DEBUG to make the footprint match what I was expecting. Now, I have to add the programming lines.

  1. /net is the schematic equivalent of wire. I /move d the 10 pin programmer so that it aligned with the microcontroller. Then I drew a wire from RESET to PA28/RST. When I went to the PCB, I saw that the two components were connected with an "air wire", which is something we should route but haven't routed yet.

  1. /name is a super useful command that allows me to write down what's going on. I named my net "RESET". If I draw a net coming out of one pin and out of another pin and name them the same name, then Eagle will allow me to connect the two pins without having to actually draw the entire line. This is super useful in keeping the schematic clean.

For some reason /rotate doesn't work, so I just double clicked and clicked rotate.

Here is the datasheet for the SAMD11C: https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42363-SAM-D11_Datasheet.pdf. Pages 8 and 10 were useful and converting what Jake was doing to what I had to do.

Another useful thing for the schematic is "symbol cards", such as ground, voltage, and so on. I added "supply 1," which is maintained by Eagle, to the libraries in use. This adds the symbols for voltage, ground, and so on.

I connected the ground. The program header has a VCC, which connects to 3.3V, but it is not actually powering anything; it is just checking whether there is power connecting to the board.

  1. /copy just copies a component.

I added a switch (SW_SWITCH_TACTILE_6MM) to the reset and the ground of the microcontroller.

Then, I added a pull up resistor, under R, R1206FAB. I ran /value and then wrote 10K, which is not required for the circuit to work but helps me to know how much the resistor should be when I look back at the schematic. I connected it to the RESET line, then to a 3.3V. I also added a pullup resistor to SWDCLK.

Then, I added a USB connection. I used CONN_USBPCB. I connected it to ground and 5V, and added USBdata plus and data minus.

Then I added a voltage regulator, VR_REGULATOR-SOT23. I connected it to 5V, ground, and added a bypass capacitor, CAP_UNPOLARIZED FAB, and gave it a value of 10 uF.

Then I just connected VDD to 3.3V.

This is my final diagram with the two pullup resistors.

I decided now to remove the switch/resistors so that I could match Neil's original diagram.

Here is the one I decided on:

Here is the PCB before routing:

  1. /drc is Design Rule Checking. This sets the minimum spacing between two traces, the distance between the trace and the edge of the board, and the size of the minimum drill, and so on.

I opened up the fab.dru file (in the same place where the fab Eagle library was located) and inputted it to design rules.

Jake said in the video that in general he likes to make the rules such as minimum drill a little bigger, so I also adjusted them like he did in the video.

At any point, if I run DRC, it will tell me any errors I have. (neat!)

  1. /route is the command that actually routes something!

I used trace width .254.

  1. /ripup lets you unroute, and it can rip up different segments or the whole line depending on the setting chosen.

Vias are layer traversal tools (part of route), which let you traverse between the bottom of the board and the top of the board. However, we don't want to mill on both sides of the board. I did not know what he was talking about so I just ignored it (i will figure it out when it is necessary).

In order to deal with crossing lines, add a resistor and set the value to 0R, which is a 0 Ohm resistor that basically allows you to cross the wires. Then add two wires coming out of it that have the same name, in order to connect the wire to itself.

  1. /display deals with the display. typing display -tvalues and display -tnames shows a much cleaner display.

I ended up adding three 0 Ohm resistors. i am sure there is a way to do it with fewer but I don't know what that way is.

Here is the final routed board:

To route the 5V, I can use a trace width calculator found online. Jake used .4 mm for the 5V connection so I also did that.

Now, I put /line on the dimension layer, which is where the board shape will be. I set the width to be 0, traced the USB line, and traced around the entire board. Then I clicked /delete to delete the rest of the black part.

Now, I export as PNG.

  • Traces:

      display none #to make the layers invisible
      display top vias pads # to display the top copper layers
      export image #to export a PNG: use DPI 1000 and use the monochrome option
    
  • Outline:

      display none #to make the layers invisible
      display bottom dimension vias 
      export image #to export a PNG: use SAME DPI 1000 and use the monochrome option
    

I had issues with exporting the outline but I finally figured out that I should convert the lines to a polygon for them to be filled.

Here are the results:

Adding a Button and an LED

I actually have no idea how to do this. I am afraid.

I read through Anthony's primer: https://docs.google.com/document/d/1iZU-KLs-s20nsQZU1Glbm4PiRDW4mIrg5NofNMod_VY/edit which I found from a previous student's website: http://fab.cba.mit.edu/classes/863.21/EECS/people/katherine/pages/week5.html in order to learn about adding an LED and a button.

I referenced this image: and picked a 10K pullup resistor, and used a 1K resistor in series with the LED.

I added the button and the LED, making sure to use components from the FAB library (resistor 1206). I put the LED on pin PA05 and the button on PA14.

Here is after routing, with three 0Ohm resistors:

(I ended up changing the width for the 5V connection from 0.254 to 0.4 mm.)

I will not lie my board is kind of ugly but it's okay. as long as it works (although it probably doesn't work either.)

Now, I export this as an image as well.

I drew the outline in dimension, converted to a polygon, and exported.

These are my files:

I uploaded these to dropbox and I go to the archshop to mill and solder the board.

Milling

I found the PCB copper boards:

Then I glued it to the milling machine.

I uploaded the PNG to mods and clicked on mill traces(1/64"). It said that the size should be around 2 by 2 in, which fits on the boards that the archshop has. I stuck the board on with double-sided tape which is to the right of the machine. Then I swapped out the endmill for 1/64" using the hex key in the drawer on the bottom of the machine. Then i set the origin to be (100, 2, 0), which is the bottom left corner of where I put the board. Then I hit calculate and then send file to device.

On the first try, I realized that the board size was slightly too small for my design, although the traces looked pretty good to me, so I made it a little more compact. I also realized I forgot to adjust the z-position, which is crucial. (my bad).

I tried again with the more compact design. I uploaded the png, clicked mill traces, set the origin to be (101, 1, 0) and adjusted the z-position of the endmill by hand, clicked calculate, and then send file to device. I did the same thing for the outline but swapped out for the 1/32" endmill. (I got an error with opening the socket but I just turned it off and on. Then I set z = 10 and moved to origin again.) Then, I ran into an issue where I had to actually add an outline around my design in Photoshop in order to cut.

I decided to try and just bandsaw the edges for this time (although for next time I will remember to add an outline.)

I bandsawed and then sanded the edges of the PCB. Then I washed it with soap. It looks pretty good! Time to solder.

Stuffing the Board

The parts I need are:

  • 10uF capacitor
  • voltage regulator (5V to 3.3V)
  • 10 pin SWD connector (the thing with 10 feet that looks like a bug)
  • microcontroller (SAMD11C)
  • three 0 ohm resistors
  • 1K resistor
  • 10K resistor (this is the pullup resistor)
  • LED
  • button

I wrote these down on cardboard and found them and stuck them on.

Then I soldered according to my schematic. I oriented the small dot on the microcontroller with the dot in the PCB on Eagle. The switch is a rectangle, not a square. For the LED, the side with the green line is the negative electrode (anode), so I solder that on the side connected to ground.

Here is the result:

Communicating

Then, I tried programming the board.

It didn't work with the archshop computers, so I ended up continuing during week 7, and it did eventually program/communicate.