Skip to content

6. Electronics Design

This week was the easiest for me so far, as I have some hobby-level background with electronics and KiCad.

KiCad preparation

KiCad is open source software suite for printed circuit board design. After downloading KiCad, it is necessary is copy Fab Academy’s ‘fab’ library to KiCad to utilize readymade components and footprints.

I downloaded library and followed instructions from https://gitlab.fabcloud.org/pub/libraries/electronics/kicad

KiCad library setting

I later encountered problems with footprints not mapping correctly. This got solved by selecting one footprint manually and checking that all maps correctly. My fab libraries had nickname “Fab” while KiCad tried mapping some of them with nickname “fab”. I renamed the footprint library in KiCad library settings.

Let’s make a pcb!

All local students were introduced to KiCad by making schematic and layout of echohello board that has ATtiny412, capacitor for VCC stability and 2-pin connector for UPDI and 6-pin for FTDI. Echohello board is capable of being programmed via UPDI and it can communicate via UART (FTDI header).

ATtiny412/212 pinout Pinout of ATtiny412 and ATtiny212 looks like this. Compact, but “maker-relevant” info-package about ATtiny412/212 can be found at SpenceKonde’s Github.

ATtiny212/412 Datasheet

Pcb creation

However we modified the original echohello design by including VCC to UPDI header making it 3-pin header and adding a led with current-limiting resistor and a push-button switch without pull-up resistor (we will use ATtiny’s internal pull-ups). I was tempted to utilize unused ATtiny pin 7, so just before pcb manufacturing I modified schematic by adding another pair of led and resistor and making relative modifications to schematic.

Schematic editor

In KiCad a new project was created and schematic editor was opened. Components can be placed with “Place symbol” button on the right sidepanel, or hotkey “A” or “Shift-A”. Components can be rotated via right mouse-button menu or hotkey “R”. FTDI-header was mirrored, again via right mouse-button menu. Wires can be placed either from the right sidepanel or hotkey “W”.

Schematic done Annotation means that components are given an “ID” to separate same type of components of each others. I run automatic annotation from top sidepanel, marked with number 1.

Number 2 marks Electrical Rules Checker (ERC) button. ERC checks that designer hasn’t done anything (unintended) stupidity. For me it marked unused FTDI header pins CTS and RTS, and also VCC and GND for not specifying something power input/output things. To clear Electric Rules Check warnings about unconnected pins, I placed not-connected marks on unused FTDI-header pins from the right sidepanel.

Number 3 opens Assign footprints tool that will time it’s sweet time to launch on first time.

Assign footprints Here I can select what kind of footprints I want to use. This is also the tool that helped me to solve library mapping. Because we used fab library symbols, all the footprints were correct match for the available components.

Finally, remember to save and then I can move on to Layout Editor by pressing Pcbnew-icon, marked with number 4 in the schematic editor screenshot.

Layout editor

Documentation in progress..

PCB milling with LPKF machine

Pretty straight-forward, have a look at Ken’s or Mona’s pages.

Populating my echo board

Like in the electronics production week, I used same tools, but this board was a lot easier on footprints, so I didn’t use flux this time.

Picture of a populated board I wanted to mark VCC and GND of headers, so I used paint-like pencil to mark them like Adrián Torres did.

Testing out the echo board

Board was programmed with the programmer I made on electronics production week with Neil’s blink code and it works!

Photo of Arduino program with Tools menu open Hero shot of my board

Group work: signal and power measurements

Our group consisted of me, Kenichi and Mona.

Signal measurement with oscilloscope

We want to measure UART communication from/to our newly-made boards. Antti Mäntyniemi gave us a brief introduction to UART communication basics.

Photo of UART basics

Oscilloscope probe was connected between ground and UART TX pin to see communication. (yes, that jumper header has a pin connected to UART TX via 4.99kOhm resistor. Because the other side of resistor is unconnected, we can use the pin to probe TX signals)

Photo of the connection we did

To communicate via UART we used Arduino sketch available at Fab Academy Embedded programming page.

//
// hello.t412.echo.ino
//
// tiny412 echo hello-world
//    115200 baud
//
// Neil Gershenfeld 12/8/19
//
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose, but must
// acknowledge this project. Copyright is retained and
// must be preserved. The work is provided as is; no
// warranty is provided, and users accept all liability.
//

#define max_buffer 25

static int index = 0;
static char chr;
static char buffer[max_buffer] = {0};

void setup() {
   Serial.swap(1);
   Serial.begin(115200);
   }

void loop() {
   if (Serial.available() > 0) {
      chr = Serial.read();
      Serial.print("hello.t412.echo: you typed \"");
      buffer[index++] = chr;
      if (index == (max_buffer-1))
         index = 0;
      Serial.print(buffer);
      Serial.println("\"");
      }
   }

Oscilloscope was set to single trigger mode and with one bit sent, we could zoom to it. Quickly it became apparent that oscilloscope we are using (Tektronix TBS 1202B) does not have a lot of memory, which was determined from low number of signal points of the zoomed in signal. Skewed signal

With appropriate zoom, new single trigger measurement was done with much better results. Good signal, no cursors

Bit length can also be measured using cursors. With cursors set to start and end of single bit we can see a duration of 8.4-8.8 us which matches our baud rate (115200, 8.68 us per bit). Note how oscilloscope recognizes frequency of 57.6 kHz when letter U is sent (hex code 55) which happens to be half of our baud rate. Letter U (0x55) sent with cursors doing measurement

Power measurement with lab bench power supply

Programmer was connected to computer as usual, but echo board was connected to programmer via jumper wires so that only tx, rx and ground were connected. Lab power supply was connected to VCC and GND of echo board. Photo of connections

Power supply was set to 5.00 volts with current limit of 31 mA. Photo of power supply screen with values set

When echo board was running idle current consumption reading of power supply was 11 mA. When continuously receiving and sending bytes the reading varied between 11-12 mA.


Last update: February 14, 2022