Fab Academy 2018 - Thierry Dassé

Week 7 : Electronics Design

Kicad installation

To learn how to design a board, I first choose Kicad because it's an open source software and its development seems to be mature.

To install it on linux mint 18.3, I read kicad tutorial on http://kicad-pcb.org/download/linux-mint/ and follow 4.0.7 Stable realease installation guide.
When I tried to do my first project following a tutorial,in EESCHEMA I encountered a librairies not found error.
After several research on websites, I also installed kicad-library package and this first problem was solved.
When I tried to associate components to my schema, I had a No PCB footprint libraries are listed in the current footprint library table.
Those libraries ared .pretty files and well installed in a kicad folder but not automaticallyassociated in Kicad. I tried to install manually but it was a very long.
At the end, I removed Kicad and reinstall it to see recommended packages. I installed all of them and my problems were solved.

Kicad complete installation :

sudo add-apt-repository --yes ppa:js-reynaud/kicad-4
sudo apt-get update
sudo apt-get install kicad kicad-library kicad-demo extra-xdg-menus kicad-locale-fr kicad-doc-fr

This installation is for french users. Other language are available for kicad-local and kicad-doc packages.

Getting started in Kicad

As I have never used an electronic design software, I started with the Getting started in Kicad tutorial. it's a good tutorial. I learned to make schema and pcb but also to make a component library and footprints. It was usefull because I didn't find some components and most of the footprints I needed for the hello world board and designed them.

If you installed kicad-doc-xx package (where xx is you language), Getting started in Kicad tutorial is in help menu.

Hello board

I had to make a board based on hello board
I decided to add a led on pin number 6 (PA7) and a switch button on pin number 10 (PA3). I will have a sensor and an actuator.

Hello world project

First, run Kicad and click New project.

First step : electronic schematic editor.

On this part, you choose components and define links between them.
Title, page size and orientation can be sets in Page settings.

Type a key or use to place a new component like ATtiny, Resonator, LED, Resistor.
You can move it with g, rotate it with r, change resistor value with v.

You can link pins with wires ( or w) or put the same label ( or l) on two different pins.

I couldn't find FTIheader, ISP connector and a switch with 4 pins. So, I made a library to create them.

Second step : Library editor.

On this part, you can create or edit components.

Click on add component. Type Component name and Default reference designator.
Zomm in to see name and grid (to modify grid, click right and choos grid select).
Add pins to component ( or p) and set parameters. Most usefull are Pin name, Pin number and Orientation.
You can also add graphic lines to draw your component with , or .
At the end, save component to new library or select working library and save it

FTDIheader AVR-ISP-SMD Switch button

library file exemple : FTDIheader

EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# AVR-ISP-SMD
#
DEF AVR-ISP-SMD CONN 0 40 Y Y 1 F N
F0 "CONN" 0 -500 60 H V C CNN
F1 "AVR-ISP-SMD" 0 0 60 H V C CNN
F2 "" 0 0 60 H I C CNN
F3 "" 0 0 60 H I C CNN
DRAW
S -250 -100 250 -400 0 1 0 N
X MISO 1 -450 -150 200 R 50 50 1 1 I
X VCC 2 450 -150 200 L 50 50 1 1 I
X SCK 3 -450 -250 200 R 50 50 1 1 I
X MOSI 4 450 -250 200 L 50 50 1 1 I
X RST 5 -450 -350 200 R 50 50 1 1 I
X GND 6 450 -350 200 L 50 50 1 1 I
ENDDRAW
ENDDEF

Complete libray file

Hello world board schematic

When your schematic is finished, annotate your component to give all a unique name like R1, R2, ...
Then check you schematic .
After, you have to associate logical component in schematic to footprint to be able to make your PCB. If some are missing, you have to create them in the foot print editor .

Schematic

Thirdstep : Footprint editor.

Select active library and then new Footprint .
Use pad settings to define Pad type (SMD, ...) Shape (Rectangular, ...) and size.
Then place pads, change Pad number if necessary and save the footprint in the library . It will add each component in a .kicad_mod file in a .pretty folder.

C_SMD.kicad_mod
R_SMD.kicad_mod
FTDIheader.kicad_mod
SWITCH_SMD.kicad_mod
ATTINY44_SMD.kicad_mod
LED_SMD.kicad_mod
AVR-ISP-SMD.kicad_mod
Resonator_SMD_4.3x3.5mm.kicad_mod

Hello world board netlist

When you finished to associate all components to footprint, generate netlist and run Pcbnew .

Footprints association

Fourth step : Pcbnew.

First read netlist . It will place foot prints and connection line between them.
Then, you have to design tracks between pins on F.Cu laryer if you use SMD components and B.Cu layer for through hole components.
After, you can design board outline with add line and polygon on Edge.Cuts layer.
At the end, export your PCB .

Hello world Board

Hello world board

Board I engrave my board using the same way than with Fab ISP board.
When I verified my board (first with a magnifying lens and second track insulation with a multimeter), I found a small jonction between two tracks. I cut it with a cutter and verified each track with a multimeter.
I sold components on it, after cutting switch button middle ground because of VCC line under the component.

Hello world board Hello world board Hello world board

Hello world board programming

After making my board, I started to program it. All programs can be found on week 9 : Embedded programming

Examine with a scope

I looked electrical activity on my board with a scope.
To use a scope, I used only chanel 1. With a coaxial cable, I connected black wire to ground and red one to the pin I want to examine.

First try on a simple blink program, red wire on pin number 6 (PA7).

Scope blink Scope blink Scope blink

Second try on a program sending 0 character 5 times a second.

/*
 * Hello board
 * FTDI scope test
 */

#include<SoftwareSerial.h>
#define rxPin 0
#define txPin 1

int ledPin = 7;

SoftwareSerial serial(rxPin,txPin);

void setup() {
  pinMode(ledPin,OUTPUT);
  serial.begin(9600);
}

void loop() {
  serial.println("0");
  digitalWrite(ledPin,HIGH);
  delay(100);
  digitalWrite(ledPin,LOW);
  delay(100);
}

Result on the scope (red wire on TX pin) :

Scope FTDI Scope FTDI Scope FTDI