7. Electronics design

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 it
      extra credit: simulate its operation

First Design

First exercice of electronic design, for this I use Kicad, I learn this software on training by Luc, the instructor at AgriLab. I have never used it before this week.

In Kicad, you have 2 softwares :

  • Eeschema where you create your “theorical” design by adding all components and wiring together, verify connections, create a BoM
  • PcbNew to create “real life” design using your theorical design made in Eeschema, here you define the board, physical position of components and routing

image-20200305151254166

I create a new project

image-20200305152136671

image-20200305152257888

I add symbols

image-20200305152505324

I can rotate symbol by press “R”. I place a wire by pressing this button.

image-20200305152618462

image-20200305152702470

I can edit symbol properties by right clicking on it.

image-20200305152756898

And setting footprint

image-20200305153435590

I add a LED and then a ground ref

image-20200305153618429

Then a +5v and I wire all.

image-20200305153715321

And also settings other components properties (name, footprint, value) and here the result :

image-20200305154213663

Then I verify footprints

image-20200305154328409

image-20200305154438697

Then I generate NetList file

image-20200305154509927

Then I go to PCB editor

image-20200305154853251

And I open NetList previously generated

image-20200305155007282

And I update PCB and then close.

image-20200305155457409

And I have my components on the PCB. Because I haven’t set footprint for +5V and GND REF, I have only my components.

I place them and put beautiful wires ^^

image-20200305155849537

I switch Edge.Cuts Layer

image-20200305161519548

And I draw a lovely board

image-20200305161640371

And I open 3d view

image-20200305161709923

So beautiful !

image-20200305161745485

And I go to silk layer

image-20200305161833054

And add some text

image-20200305162035341

And now I have felix the cat’s board

image-20200305162055951

Create my real board for this week

Drawing

I start by adding libraries in kicad https://forum.digikey.com/t/importing-the-digi-key-kicad-library-into-kicad-5-0-0/4075

For my board, I need a SAMD11C

image-20200306120426099

I verify if the component is in the inventory

image-20200306120223751

For building the board, I need to find good component, so I find them in inventory.

image-20200306140957592

image-20200306141011892

image-20200306141059999

When making my board, I use “electrical rules checker”

image-20200308123312230

I have severals warning for non connected PIN on some components, for reduce them I place “no connection flags” where I’m sure to connect nothing

image-20200308123454030

Here the result at this time

image-20200308123517908

I still have 2 remaining defauts but it’s more a bug than a real defaut

image-20200308124331348

All my pins are connected but sometimes it says it’s not connected or not driven. For example, the PIN11 is the ground and it’s already connected to… ground

image-20200308124555788

I have problem when assigning footprints, some components in fab librairy haven’t footprints, I have to assign footprint manually.

image-20200308133934621

I assign footprints

image-20200308134427930

I try remove and reimporting fab librairies, still the problem. Finally I manually assign component and it seems ok.

image-20200308150158164

After i select “update PCB from schematics” and I go to PCBnew

image-20200308150326535

I click and I finally have all my components

image-20200308150422857

For the cutting, I’ve made my own profile of one of my car, a Subaru WRX 06

image-20200308194531568

I vectorize in Inscape

image-20200308194950252 I clean the vectors to avoid double line and artefacts

image-20200308200124279

Save in dxf format and import in layer “Edge.Cuts” in PCBnew.

image-20200308195114827

image-20200308200223611

I haven’t found any footprint for an USB port integrated on the PCB like example on week05 so I use the traces in PNG, I put layers on Paint.net with transparency then I merge them.

image-20200309131951679

With Inkscape, I transform in vector

image-20200309132323520

And now for the world premiere, the SubarUSB :)

image-20200309140400016

I have now to make all the traces inside this design.

With help of CNC board of previous week. I choose 0.4mm for tracks and 0.2 mm if I have to make mini track. I also define vias even if I won’t use them this week (maybe later ^^).

image-20200309145841237

I use “route track” to design tracks of my board.

image-20200309150023572

I have problem with USB connector, I don’t want to draw it manually in the SVG output so I finish after hours or searching.

I found this page https://forum.kicad.info/t/standard-github-usb-trace-on-pcb-footprint-available/1800/6

I download Board shematics and layout here

I open the project on KiCAD

image-20200309174851918

I extract the footprint of the PCB/USB plug and I import it on my own KiCAD library.

image-20200309174932322

So I modify my schematic and replace with an USB A plug

image-20200309175509333

And I will plug with the new footprint I got :)

image-20200309180952950

On the updated PCB with the correct footprint I see my USB port is wrong. So I have to redraw the rear USBumper of the car.

image-20200309194115381

I see I need a bridge, so I add a 0 resistor to pass over a trace.

image-20200309194101363

image-20200309194743177

And now all the board is wired.

image-20200309194806132

I export F.Cu and Edge.Cut layers in svg

image-20200309194956789

I go to mods, I select SRM20 > svg file. I import, I put my setting and … noooo

image-20200309195707085

Some of my routes are not correctly cut, clearance is wrong. So I need to modify my design rules. It’s in File > Board Setup…

image-20200309200033352

And I modify clearance to be 0.4 mm (the mill size obviously)

image-20200309200252980

And I run design rules checker to verify all my board

image-20200309200350841

Clearance problems… I can’t put more than 4 traces under the SAMD11C with 0.4mm of clearance

image-20200309202353066

I have to find a way to put my trace. I put another 0 resistor to make another bridge. Slightly modify design of the board, playing with different trace width.

image-20200309203620686

Finally after many try and retry and retry and redesign, the final version. I have to move the +3.3V all around the board and then I can bridge over 1 trace. If I use vias, circuit will be more easy to design.

I have my 3 LED, my button, Let’s go back to mod and verify if all it’s ok.

image-20200310000828761

A quick 3D view

image-20200310001650989

I haven’t all components in 3D but it’s great. I generate files in svg. I put in mods the traces in F.Cu. All Good.

image-20200310002250562

Here all the settings I use like in week05.

image-20200310003024513

“Invert image” in convert module. Mill diameter 0.4mm, cut depth & max depth 0.1mm, speed 4mm/s, x&y&z @ 0, change output to “file>save” module.

Cut lines don’t works in mods. I use Inkscape to open svg and fill the board with black.

image-20200310004446681

Then I go back to mods and it’s works.

image-20200310004550544

Settings applied : “Invert image” in convert module. Mill diameter 1mm, cut depth 0.3mm, max depth 1.7 mm (a board is 1.5mm thick), speed 2mm/s, x&y&z @ 0, change output to “file>save” module.

But when I verify mill path, I see it’s not gonna pass everywhere around my board. Why? It’s seems it’s also need “clearance” in my image to have milling going on all edges.

image-20200310004857016

To bypass this problem, I export my 2 layers in one file. I modify marging by adding 2mm on each side. And then I export 2 different files I can import in mod and keep same reference.

image-20200310011830269

image-20200310011756537

image-20200310011907592

And now mill path looks good in mods.

image-20200310012232071

MILLING part 1

I’ve got some problems when milling.

1/ 0.4 mill breaks, first time for me, I reuse a old mill, maybe it had a problem in previous milling. I don’t know.

2/ I change for a new 0.4mm mill, all is fine. To be secure, I go at 80% speed. But when looking at the end, one of my track was broken when milling. Only one even if I made many 0.2mm width traces, I have the problem on only one.

3/ When milling outer edges with 1mm mill, it takes very long time. I see that mods generate many traces. So I stop before the end because it has already finish completely one turn.

image-20200310190506342

REWORK

Because I don’t want to put wire (it’s soooo bad) I try rework on faulty track. I remove all traces in the zone and put new ones with 0.25mm width, only one remains in 0.2mm because of lack of space (fingers crossed).

image-20200310142737343

I’ve to redo all transform steps (open in inkscape, create 2 separate layers with correct margin) of course but it’s the game, the show must go on.

Problem is in inkscape, the car shape and the usb port are exported in 2 different objects. I combine them in inkscape and have to use fill tool but it appears it doesn’t fill correctly, I can’t just add black blackground because combined objet may be not fullu close. No solution yet so I keep this barely shape by destroying initial shape.

image-20200310152001152

I’ve still got problem, finally I found!!!

I have forgotten to put offset at 1!!!

MILLING PART 2

I launch another milling, traces was OK. But when I launch EDGES, it was a problem with the offset and board was failed.

image-20200310211144689

No time for verify all and launch a 3rd board, I’ll take the first and add an ugly wire.

In the meantime, I prepare components (finally I take another button that fit better)

image-20200310190739136

Soldering in progress

image-20200310211426868

The board finished (with the wire of shame).

image-20200310190922292

Flashing & little dev

Let’s go to flash. After installing all Atmel drivers for the flash box. Plug the board, green LED. YES!!!

image-20200310190540148

First I have to flash the booloader.

ebdg.exe -b -t samd11 -pv -f sam_ba_Generic_D11C14A_SAMD11C14A.bin

image-20200310172611979

Flash successful! Programmer can be removed because it’s not needed anymore. You can program the board directly with the USB port.

I use the arduino software. You have to install the boards, first add a new URL in arduino software for boards : https://www.mattairtech.com/software/arduino/beta/package_MattairTech_index.json

image-20200310173001374

Now I can install “MattairTech SAM D|L|C core for arduino”.

image-20200310212021929

Correct board doesn’t appear yet. You to go one more time to board manager, see update available et update “MattairTech SAM D|L|C core for arduino” in a beta version (here 1.6.18-beta-b1).

Now you can set the correct board Generic D11C114A

image-20200310173604238

Here my setting before flashing the board with arduino.

image-20200310173823061

I first test the Neil code that blink one of my LED. Then I start from the blink arduino example and referring to the pin I plug my white and red LED, I do my own code :

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize my two led pin as output.
  pinMode(5, OUTPUT);
  pinMode(4, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(5, HIGH);
  digitalWrite(4, HIGH);// turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(5, LOW);
  digitalWrite(4, LOW);// turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}

Then I flash my board.

Le croquis utilise 9400 octets (76%) de l'espace de stockage de programmes. Le maximum est de 12288 octets.
Atmel SMART device 0x10030006 found
Device       : ATSAMD11C14A
Chip ID      : 10030006
Version      : v2.0 Nov 22 2017 12:56:25
Address      : 4096
Pages        : 192
Page Size    : 64 bytes
Total Size   : 12KB
Planes       : 1
Lock Regions : 16
Locked       : none
Security     : false
Boot Flash   : true
BOD          : true
BOR          : true
Erase flash
done in 0.777 seconds

Write 9752 bytes to flash (153 pages)

[                              ] 0% (0/153 pages)
[==                            ] 9% (15/153 pages)
[=====                         ] 19% (30/153 pages)
[========                      ] 29% (45/153 pages)
[===========                   ] 39% (60/153 pages)
[==============                ] 49% (75/153 pages)
[=================             ] 58% (90/153 pages)
[====================          ] 68% (105/153 pages)
[=======================       ] 78% (120/153 pages)
[==========================    ] 88% (135/153 pages)
[============================= ] 98% (150/153 pages)
[==============================] 100% (153/153 pages)
done in 7.142 seconds

Verify 9752 bytes of flash

[                              ] 0% (0/153 pages)
[==                            ] 9% (15/153 pages)
[=====                         ] 19% (30/153 pages)
[========                      ] 29% (45/153 pages)
[===========                   ] 39% (60/153 pages)
[==============                ] 49% (75/153 pages)
[=================             ] 58% (90/153 pages)
[====================          ] 68% (105/153 pages)
[=======================       ] 78% (120/153 pages)
[==========================    ] 88% (135/153 pages)
[============================= ] 98% (150/153 pages)
[==============================] 100% (153/153 pages)
Verify successful
done in 0.059 seconds
CPU reset.

And voilĂ 

GROUP ASSIGNEMENT

Using DC power supply to test LED polarity (with 2.6V)

image-20200310191057455

Using multimeter to verify which group of 2 pins use on the button

image-20200310212929626

Using oscilloscope and frequency generator setting signal and reading it

Using oscilloscope to see frequency of my blink on my board (up 1s, down 1s)

Attachments

car-brd.svg

car-brd-EDGES2.svg

car-brd-TRACES.svg

KiCAD project