Week 8
Input Devices
Overview
This week I designed, fabricated, boot-loaded, and programmed a SAMD21E breakout board with an optical distance sensor. I wanted to shift focus this week and design something that supports my final project. While I don't plan to use the optical distance sensor in my final project, I think the breakout board will help me test the electronics of my design faster. It seemed like I ran into issues every step of the way this week, I was either extremely lucky every other week we worked with electronics or extremely unlucky this week. Regardless, I learned a lot this week and this page documents my experience.
Schematic Design
Similar to the previous weeks, I used KiCad for designing my PCB. I was using a new laptop this week, so I needed to reinstall KiCad again. I ran into an issue with the footprint libraries again, but a slightly different issue than the one I had in Week 4. This time the generic libraries were included in the download (I did not need to download them from KiCad's GitHub separately), but they did not appear when I tried adding components. After some Googling I found a simple fix - change the environment variable for where the part files exist: Preferences → Configure Paths → Update path to KICAD_SYMBOL_DIR.
I built my schematic by referencing the SAMD21E schematic in the MTM guide Jake put together. This guide was extremely helpful throughout this week's assignment and served as a great consolidated reference for all the microcontroller work we've done so far in the class.
Wire Routing
Just like Week 4, routing started out as a deceptively enjoyable process. Quickly (actually several hours later) it turned into a frustrating process. I ended up using 3 jump resistors to get the all the components attached. However, after accomplishing this I realized that I never modified the default track width (0.2 mm) or track spacing (0.25 mm). After updating these to 0.3 mm and 0.4 mm respectively I had quite a bit of rework to do and ended up with a total of 6 jump resistors.
Milling
I have not had any issues with milling so far in this course. The size of my board this week exposed something I think I've been doing incorrectly, but has gone unnoticed because my previous board were much smaller. After exporting my traces and board outline from KiCad, I have been importing both into Adobe Illustrator to touch up - even out the lines and add text. I export a PNG from AI, select "use art board" (to maintain the spacing around the outline) and select the highest preset resolution AI offers (300ppi). The first board I cut this week using this process resulted in several detached traces and some traces that were not separated from neighboring ones. I noticed when exporting from AI it is possible to set a custom resolution. When I bumped this value to 1000ppi, I got a clean tool path in mods and a nicely cut board with evenly spaced and (correctly) attached traces.
Cleaning & Soldering
During the cleaning process I was a little rough with the vacuum and scraped off a couple traces and pads, right under the feet of the microcontroller. Zach helped me save these connections by attaching the microcontroller feet to the pad with some coated copper wire. The rest of the soldering was fairly smooth, shiny and straight forward. I did run into one other issue later, where my laptop would not recognize the successfully boot-loaded board. This ended up being because one of the capacitors was causing a short between the USB data line and the ground. It was a tiny bit of solder that had crept under the capacitor to create the short, not visible from the top, which I identified by probing with a multimeter.
Bootloading & Programming
I already had edbg successfully installed on this Mac, so I downloaded the associated binary file for the SAMD21E and boot-loaded with ths following command:
sudo edbg -b -t samd11 -pv -f sam_ba_Generic_D11C14A_SAMD11C14A.bin
Edbg replied with a success message, and after fixing the solder issue I mentioned above, my laptop recognized my board! To program my board with the Arduino IDE, I first added the board by selecting Arduino → Preferences → Additional Board Managers URLs and adding this link: https://raw.githubusercontent.com/qbolsee/ArduinoCore-fab-sam/master/json/package_Fab_SAM_index.json , thanks to the MTM guide. Then I searched for the board by selecting Tools → Board → Board Manager and searching for "Fab SAM core Arduino" and hit install (again, thanks to the MTM guide). Finally, I was able to select my board within the port menu and push code to my board. For programming my board, I referenced the GitHub page for sensor I used this week (more on this below).
Sensing
I had originally wanted to make a matrix of self-made flex sensors, but given my rockier than expected experience this week, I opted for a simpler sensor. I used one of the breakout boards for the VL53L1X optical distance sensors in the lab to measure distance. After connecting the sensor breakout board to my K-duino breakout board, per the instructions on the GitHub for the VL53L1X Sensor, I did not receive any output on the serial monitor. After some digging in the SAMD21E pinout guide and cross-referencing with my schematic and physical board, I realized that I had incorrectly named a few of the pins on the physical board. These (incorrect) names, which are milled into the copper, also posed another issue. They were causing shorts between some pins, because I used curved headers that stretched out and barely touched the names. The excess copper around the names was the main culprit, which I was able to scrape out with a razor blade. With the clean headers and necessary changes of jumper wires I was able to stream the distance of the optical sensor to the serial monitor and plotter in the Arduino IDE. The GitHub link above also details instructions on how to install the library for this sensor in the Arduino IDE and access a few working examples to test the sensor. A video of the final working setup can be found at the top of this page.