Skip to content

Electronics Design

  • Use the test equipment in your lab to observe the operation of a microcontroller circuit board
  • 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

This was supposed to be an easy week but what a challenge! I hope you’ll enjoy the result as I did, it was a real treat to get to the end in time!

planning

Test equipment

The slides that were presented during the Debugging Recitation are a great introduction to these equipments. I was especially intrigued by the logic analyzer and was not disappointed by my tests !

Multimeter

Logic Analyzer

A logic analyzer captures multiple signals from your circuit and can convert them into readable informations. You can see on the pictures below the logic analyzer we have at the lab, and how it’s connected to the computer.

We used Pulse View as it’s open source and cross-platform.

Pulse View installation on Ubuntu 20.04

Download binaries are available on this page.

I needed to launch the software with sudo ./PulseView.AppImage (read more here).

Oscilloscope

Designing my own Arduino

I used Arduino boards before and was very happy with them. When I learned that with the Fab Academy course I would be able to make my own, I couldn’t resist.

I was greatly inspired by the work of Adrian Torres who made his own Samdino, and by Quentin Bolsee, who developped a SAMD11C devkit.

I wanted to design my own board according to my final project and my instructor encouraged me to do so. It would be an ideal exercise to learn KiCAD, and I also wanted to dedicate it to the development of dioramas. So I designed it with RGB leds and the possibility of connecting it to an SD card.

Features I want in my Arduino

  • Power outputs: 3.3V, 5V
  • DAC output to test the sound devices
  • Some RGB leds directly on the board
  • One test led
  • Exposure of the SPI port to be able to plug an SD card via another board
  • The possibility of plugging a mini oled screen (we have one on the lab and it’s very cute) via I2C

SAMD11D

As a beginning, I wanted to understand better the SAMD11D I wanted to use. My instructor advised me to use this chip because I want to be able to use a lot of pins. I looked into the datasheet and I wanted to download the pinout for it. I looked into this git repository to find the informations I wanted. I made a schematic to sum up the pins and ease my programmming process later.

KiCAD Design

KiCAD is an open source Electronic Design Automation tool and is cross-platform.

I tried it during the Student Bootcamp and during the Electronic Production week to check which components I needed to produce my boards. I also watched this excellent introduction by Krisjanis Rijnieks from Finland on the Aalto FabLab youtube channel.

I am now no stranger to tracks, vias, in-filled zones and other vocabulary specific to this software and to electronics design. However, there is a long path between understanding the basics and mastering the concepts: good luck to me 😄

The Gettting Started documentation of KiCAD is also a good way of understanding the different possibilities that this software provides. The main point is that KiCAD works by project: each project contains its own files and special parameters.

The two files that we are interested in are the schematic files (.SCH) and the _pcb files (.PCB). We are going to design the logical connections on the schematic file and routing everything as it will be milled in the pcb file.

Fab library

The first thing we need to do is download the fab library into our KiCAD folder to make sure to use the right components. The procedure is well explained in the gitlab repository, so I’m not gonna repeat it here. Just be sure to rename your folder with fab to avoid any issues, and remember to pull the repo once in a while as it’s under active development (thank you again Kris!).

Schematics

KiCAD Schematic

  • A : add a component
  • W : add a wire connection
  • R : rotate

Stephane advised me during the Student Bootcamp to always start with the power management. I added the USB plain connector and connected a 3.3V regulator, as the SAMD11 datasheet tells us that we can’t use more than that to power the MCU. I also added a power led as I saw in the SWD schematic.

I then started to add labels to the MCU: it’s easier to connect everything this way and I was able to divide my schematics in themes. To choose the value for the MCU capacitor, I read this article and looked into the SWD and UPDI designs.

Note

I ended up switching up some of the labels during the week: I came back and forth between schematics and pcb design to choose the right pin according to where my components were on the board.

I added the programmer right away.

For the button, Stephane advised me to connect it directly to the GND as it was the simpliest way (but later I forgot I did that and was stuck to program it: thankfully it was an easy mistake to fix). I also added a test led with a resistor.

We have WS2812B RGB leds in the lab, so I wanted to use them: it’s a step towards my final project as I plan to use them for lightning my diorama. I read the datasheet and this article about the best practices to use them. I also found a very helpful article about dealing with this kind of leds, but it’s in french.

I chose to expose the I2C pins to connect a mini OLED screen to it later: Stephane advised me to add another I2C connection to be able to use these pins too when the OLED screen will be in place.

I added SPI access to be able to connect an SD card (for my final project I want to use some music, and I can’t store it into the MCU). I read this article about SPI and SD cards.

I finally added the left pins: I wanted to use them all, but sadly the number 7 was really inaccessible: I tried a lot and gave up eventually to put a 5V output instead. I also indicated the DAC pin as I want to try it with sound devices during the Output devices week.

You can see the all schematic below: I tried to keep everything sorted to be able to read it more easily later, I hope I didn’t break any conventions!

PCB

KiCAD PCB

  • X : add a wire connection
  • R : rotate

First, we need to import our elements from the schematics with F8 (Update PCB with changes made to schematics). Then we can order them by function: keep the MCU close to the USB connector and the regulator (it’s a rule), keep the programmer close too.

Update PCB from schematics

I tried many configurations (for several hours…) but I ended failing a lot. It’s also learning, but I was a little bit frustrated anyway. You can see below one of my design that ended badly because everything was so crowded.

When redoing my designs I found out an helpfull tool in KiCAD that allows to globally delete several components. You can find it under Edit > Global Deletions... and choose which elements you want to get rid of.

I also liked the Design Rule Checker tool: I could check if everything was connected together and correct my mistakes one by one (and there were many!). I also used the Board Setup tool to add clearance checks into the DRC: I wanted to be sure my tracks could be milled correctly. To acces the board setup tool, go to File > Board Setup > Design Rules. The picture below shows you the final DRC where I deleted all my mistakes (I couldn’t resist to make a capture).

DRC

And here is the final design: I added text to remember where were the special pins I needed and a ground plan to ease the process. It’s not perfect and I’ll call it V1 for now.

iBom file

Installing interactive BOM for KiCAD

I used a very handful plugin for KiCAD to generate my iBom file. Just go to Plugin > Install and you will find a green button in your PCB window. Click on it and choose what to export: it’s done!

You can see my iBom file here.

Board production

FlatCAM

To prepare the milling process I used FlatCAM, as it was the software I felt more comfortable with during the Electronic Production week. In KiCAD I exported two Gerber files (File > Fabrication Output > Gerber), one for the tracks and one for the edges. I also exported a Drill file (File > Fabrication Output > Drill Files) for the vias.

Milling

If you reached this page without reading the previous weeks, don’t hesitate to check on the documentation of the SRM 20 to have a full discovery of the milling process.

Flatten you sacrificial board

When I started to calibrate the Z axis on the SRM 20, I noticed that the sacrificial bpard was not flat anymore. Stephane showed me how to mill the sacrificial board to make it flat again and mill without issues.

First of all, be generous on the tape and beware of air bubbles.

Tracks were milled with the 0.2mm, at minus 0.06mm of depth and 50% offset. The job took ~50 minutes.

We were out of 1.3mm drill, so I milled the vias holes with the 0.8mm mill. I read this tutorial to understand how to set up FlatCAM for this. I chose to mill by 0.4mm steps to preserve the mill and set down the feedrate to 100 (instead of 180 as usual). I also read this to choose only special areas to remove copper from.

Finally I cut the edges with our 2mm mill.

The all process lasts more than one hour because of the mill changes.

Checking the board

  1. Remove copper USB

  2. Check MCU connectivity errors > clean excess copper

  3. Check PWR and GND areas

  4. Check randomly

Short story of a long day of shorts

Sadly I made one big mistake during this step: I forgot to check if the MCU was in contact with the GND: the pin connected to the test led was, and would have made a short-circuit. I tried to clean the tracks again but the short was under the MCU: we had to unsolder it, but this way several copper pin were removed: one and a half day lost for one silly mistake, I hope I will remeber that before soldering anything on a board!

Assembling the board

Vias

Soldering (desoldering mostly)

I started by assembling the components needed for the board thanks to the BOM. I then started by soldering the MCU and continued with the power regulator and so on. Every time a component was soldered, I checked the continuity for shorts or problems. When I reached the power led, I realized it was not lighting up with the multimeter, so I thought I made a mistake. I tried to desolder the led with desoldering tweezers but the led broke… When removing the remains of the led I also removed the copper pad. I didn’t know what to do, so I continued soldering waiting for my instructor to give me adive on the next day. But it became messier when I reached the second led: I detected a short with our smart tweezers, and I finally realized it was under the MCU… I eventually started my board all over again.

Two days later, we have a finished board! It was way harder than expected, and I was so afraid to destroy more leds… They both work thankfully.

Board picture

Programming

When plugging my board I saw the power led lightning up: it was such a relief!

I programmed my board thanks to the SWD made during the Electronic Production week. I was careful with the order of the programming pins (the GND is marked by a little dot, it helps). I flashed the board with edbg and the same binary as for the UPDI (sam_ba_SAMD11C14A.bin). I then unplugged the SWD and was able to detect my board in the Arduino IDE. I was so cheerful at that moment (it was Tuesday night, my last chance to finish the assignement in time…)

SWD programming the dioramanino

sudo edbg -ebpv -t samd11 -f sam_ba_SAMD11C14A.bin
Debugger: Alex Taradov Generic CMSIS-DAP Adapter 548B520D v0.1 (S)
Clock frequency: 16.0 MHz
Target: SAM D11D14AS (Rev B)
Erasing... done.
Programming.... done.
Verification.... done.

Following the procedure of Electronic Production week, I managed to make it blink 😄

void setup() {
  pinMode(7, OUTPUT);
}

void loop() {
  digitalWrite(7, HIGH);
  delay(100);
  digitalWrite(7, LOW);
  delay(100);
}

I tried to use the button but was blocked for a while: I forgot I connected the button directly to the GND and that I needed to use INPUT_PULLUP to read the actual state of the button.

const int ledPin =  7;
const int buttonPin = 8;

int buttonState = 0;

void setup() {  
  Serial.begin(9600);

  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP); // Button is connected to GND
}
void loop() {

  buttonState = digitalRead(buttonPin);
  Serial.println(buttonState);

  if (buttonState == 0) {
    digitalWrite(ledPin, HIGH);
  }
  else {
    digitalWrite(ledPin, LOW);
  }

  delay(10);
}

Files

About this week

What a joy to blink an LED on a DIY board!


Last update: April 20, 2022
Back to top