7. Electronics design

This week I worked on how to design a PCB board.

Assignement

   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

The hello board

The principle of an hello board is to have plus and minus power, and a few components more, to be able to make the echo software; the board doesn’t do anything at all.

USB is 5 V and it is too much power for the microcontroller SAMD11C, that is why there is other components, to protect the board and also the computer. Microcontroller don’t like 5V, we have to read some stuff about it, in the datasheet, to learn more about microcontrollers.

The regulator takes a certain tension and reduce it to a value, here 3.3V. It has in, out, GND. When we transform 5V in 3.3V it does warm. The regulator transform 5V in 3.3V and a groundref.

VDD bring power and the power goes out by thz ground on the other side. Electricity has to flow inside the microcontroller

About the connection, VCC is connected to VVD. GND are connected all together.

The 0 ohm resistor makes the link between two wires, in the example we can’t go directly to trace the wire, the 0 ohm is making a bridge.

Condensator is used between the ground and the out to filtrate the noise.

We can check the component on digikey.

The hello.D11C.blink.reset.clock board is advice to work with.

Kicad

KiCad is a software that gather many softwares, like Eeschematic and PCBnew that I mostly use.

First to create the PCB board, I have to draw the schematic, it is the idea of what is connect to what. To do that, click on shematic button.

When we are on the eschematic window, to place a symbol, select the tool and do a left click on the board, it is going to download the components.

The fabacademy components (fab) that are in the inventory will be download as a library for the software to be more easy to use, and more accessible.

Click to put the component, click again and I can add the component. R on the keyboard will rotate the component.

Sparkfun can help to find the schematic.

By convention we put + at the top and - at the ground

Place symbol is for the component (1), Place power port can place the power and the ground (2). It can be GNDREF, a ground reference. I have to add a source of power too (on the same button) (for example 3.3V). Place wire is to place connection (3).

The circle means there can be a connection, click on a place and click on another place to put wires.

On kicad put the microcontroller, we have to do the usb plug, put the ground, also add the regulator.

To work with the button and led, we need to write code. We use the right’s pins on the schematic of the microcontroller to do the connection.

To improve the reading, we separate stuff with global label, named for example out4, and put wire between the label and the component.

Kicad will help to not forget the ground and the power when we want to finish the schema.

If we don’t want to connect some pins we use the cross, it takes time but it will be useful.

We can check the electrical rules in the inspect’s checker.

There are warnings but not errors so it is still ok to start the PCB building.

So first we put components, then wire, then power, we still need to assign footprint.

In tools, assign footprint, annotate. Normally the software does it automatically but it can happen that we have problem then we have to say the correct footprints for the component. For example the LED is 1206 smd, the resistor is also smd 1206.

Then we generate netlist file.

To design the board, click to jump to another software, Pcbnew

First import the netlist that was previously saved.

To load netlist select the file and update. It put all the components but we need to replace them, move them. We have to rotate some components (R on keyboard)

The two points are not connecting, it is just a remaidner, we have to put the real connection traces with route tracks.

There are design rules we made previously week. We cannot design tracks to thin. We have to edit the track, it is good to make wider trace.

We have to be careful of the clearance. Next to the components pad, there is a small line, we can set it to tell the software to not go to close.

The settings are very important to do before the tracks. In file, board setup we can design rules. If we already have designed some tracks and after changed the settings, the tracks wont changed.

Width track can make more current, too thin tracks heat to much. There are many parameters, including clearance, that will be set at 0.4 mm, the size of the drill. Change the rules don’t change what it is made. We can play with the grid. Because it snaps to it, it helps to align stuff, and do the traces easily better.

To sum up, we made a schematic, assign the correct footprints, made the netlist, change the software, import the netlist, place the components and make the connections.

Now about the layers. We have to select the good layer to make connections for example if we use double side PCB. We can show or hide the layers.

After the paths, make the shape of the board, on the edge cut layer. We can also import svg file, for example like the cow shape during bootcamp.

When we are done, we can 3d viewer.

The last step is to export the design for mods. In file we can export the design as svg.

We select the layer want to export, export the cut and the copper. Usually we use black and white for mods but we can export in colors for documentation. We have to be careful to have one file per layer.

As a remainder :

  • save a new project
  • create a schematic,
  • add components, ground, power,
  • make the connection
  • with the kind of components it is, assign the footprints
  • generate the netlist
  • on the other software PCB, load the netlist
  • update PCB
  • board setting in the design rules
  • make the connections
  • create the edge (select the layer “edge cuts”)
  • check in 3D viewer
  • export in svg

Download the lirairies for the FabAcademy components

For the libraries download it for kicad from Kris on gitlab. Then we download the file, extract it somewhere. After on preference, we can chose to add it on global or local library, local is only for the project, global is for all the software. Click + to find the path of the files, chose the name. Select the folder if we need the all folder.

All the tutorial is on the GitLab

When we have done that we are supposed to have more symbols, in foot print the community design wider foot print and the space between the footprint is for the mill to pass. In the librabry for footprint, the pad are wider, made by the community fablab, to be able to be solder by hand easier.

Design of the my hello board - hello.D11C.blink.reset.clock

For this week, the individual assignment was to design an hello echo board. My instructor adviced me to work first with the hello.D11C.blink.reset.clock board, and add a LED and a button.

During the electronic production week, I did a programmer with a microcontroller SAMD11C. To do that I first put all the components there is on the board from the example.

Here is the components from the board I start with. All the references come from the Eeschema in KiCad.

  • Microcontroller ATSAMD11C14A
  • Regulator linear 3.3V 100 mA
  • Condensator 1µF
  • Condensator 0.1µF
  • Resistor 10k
  • Resistor 10k
  • Resistor 0 Ohm (this resistor is not absolutely required, it does the bridge over traces if needed, we can add some if we need others)
  • a LED
  • with a Resistor 1k

I added a switch button and a LED

I searched the button I can add in the inventory list. First I choose quite randomly the switch I wanted to add.

I took one in the FabAcademy inventory and I checked on Digikey what kind of button was it.

But when I imported the netlist on the PCBnew software I realized that the button has hole for drilling. That is not the kind of button I imagined, I would like one SMD button.

So I went to the component storage in my lab and found the kind of button I want and change it into the sketch I made.

About the LED, I learnt that a LED has to be paired with a resistor. I took one LED and checked on the datasheet the amperage of the LED.

Thanks to U = RI (where U = 3.3V, and I = 40mA) the resistor should be 110 Ohm. On my sketch I set it at 100 Ohm but I will solder a 1k Ohm to be sure. It doesn”t really matter for the milling of PCB because the footprint of the resistors is still 1206.

I got problems with 2x05 pins. I didn’t find the right symbol I want in the fabacademy library. First I checked on the SnapEDA website if could find the footprints and the symbols but there were too many choices and I don’t know the exact reference of the 10 pins available in my lab.

At the end, my instructor shared us some files for the symbol and the footprints he used during last year FabAcademy. I create the library for the pins according to the tutorial Kris made for downloading libraries, add the symbol and the footprints he gave me.

Then I download the netlist and changed the software to go to PCBnew. Here all the components appear but I have to replace them and trace the route tracks. That part was really messy, I spent a lot of time in ordering the components, trace the tracks, see that I was stuck many times and can’t join the stuff together, delete all the tracks, reordering components, trace again the tracks and do it again and again.

After spent hours to do that I chilled myself, took again the board from Neil and tried to do the same with a clear head. I got some issues with the size of the tracks that were to big to pass through the microcontroller. I created less wide tracks for the microcontroller and ajust my tracks to be able to join all the components. I finally succeed in joining all the stuff in not a messy way.

Now I did the outlines of the board. I set the outlines width at 1 mm because it is the tool I will use to the outlines of the board.

I exported my file in svg to be able to use it with mods to have the paths. I had to find the correct settings to have the files I need, in black and white, one with the traces without the board edges, and one with only the edges. I went through some issues to have the file well positioned, on a corner without stuff around.

Some wrong files I exported:

I print my electric circuit on a paper to check if all the components fit well on the board and it appears that the 10 pins footprints were wrong. I put all the components on the paper to check their location and the size of the footprints.

I checked the footprints on Eeschema but they were wrongs, too big.

I searched some in the fabacademy libraries and found the one I was looking for, and I assigned them.

And I finally I updated my PCB and traced again the tracks.

When we export the files it is in white and black. When we use mods, the file has to be inverted for the software to be able to to the traces of the paths. I select the same the settings as the previous week of electronic production.

When I came to milling the outlines of the boards, because of the thickness of the traces, mods set the tool to go both inside and outside the line.

I wanted to change the width of the lines but when I calculate in mods, it didn’t do at all the lines.

I tried to not invert the file before caculate and here it worked well.

I also checked the traces and they were pretty good, now I have to mill my board.

Here is the final schema of the board.

Milling of the board

So first I mill the traces of the board first. I went pretty well, in only one time. I set the speed of the milling at 70% to be sure to not break the end mill.

I checked the .rml file to know what kind of path the mill is going to do. The outline won’t be done in one time, the endmill is going to do one side, dig 4 times in the PCB, and then going to do another side.

When the milling of the edges had end, we can see that the outlines are not done in one polygon but line by line.

Here is the board without stuffing.

I learnt after milling from my instructor that the button doesn’t match with the assignment because the button has to be an input. I wanted to have a switch like a general on off but it don’t match with the assignement. So I put some wires to make the button be as an input. I link the button on one pin, the 15, and the GND.

To do that I stripped the wire and put some tin at end. I melt the tin on the pin and stick the wire. I did the same on GND trace with putting some tin on it and solder the wire on it.

I put a 0 ohm resistor instead of the place of the button to do the link with the traces.

If I had put the button in the original sport I should have stay press on it during the flashing.

Here is the board with all the soldering.

I solder everything and then it comes to flash the bootloader code.

Flash the board with a programmer

I used the Atmel programmer to flash the board. First I checked the red and the green light. The red light means that the programmer is plugged and the green light means that the electronic board is plugged to an electronic source.

Here is the website where the Bootloader for the SAMD11C I use is. I downloaded the file, and put it where the edbg.exe I use two weeks before, on the same folder.

Here is the line of code I wrote on the commander window.

edbg -b -t samd11 -pv -f sam_ba_Generic_D11C14A_SAMD11C14A.bin

It didn’t work because the computer don’t recognize the programmer.

I changed the side of the cable and try to send the bootloader code. It still don’t work.

I tried to change where all the cable are plugged to my computer on the USB ports and tried to flash the bootloader again but it still didn”t work.

I checked all the paths made the PCB design, comapring to the design from Neil, all the paths looked good but the electronic board don’t want to be flashed. I also checked the footprints, refill them to have a good connetion between the PCB and the components.

I checked again with the electronic microscope, I tested all the traces with the multimeter in continuity mode and they were good.

I filled again the soldering. It didn’t work.

I took the decision to mill again a board, this time with the button on the right place. I designed it from the previous project and just add a button.

Here is the traces the milling will do.

When I milled the traces I got some problems because the FR1 PCB was not flat at all.

The height of the PCB board was not the same and at some point there was a difference of 0.4 mm. I milled the board on an average height (Z) and as expected, only on side of my board was milled.

So I launched a second traces milling a little bit deeper (0.2 mm) but it didn’t mill all. I remove the last line of cooper with a cutter and checked with the multimeter in continous mode if the lines were correctly separated.

I checked all the traces with the multimeter in continuity mode to see if they are conductive because the traces under the microcontroller are very small. Everything was fine.

I stuffed the board with the components and the button. I was really careful with the soldering to not make mistakes and have to reflow some solderor stick some traces together.

Here is the board stuffed, with a button on it.

I was not able to flash with the bootloader the second board, I didn’t want to lose more time in checking all my board again. I also checked the side of the microcontroller on digikey with the datasheet.

I tried to flash this new board with the Atmel programmer. I didn’t work. I took the programmer board I did two weeks before, I flashed my new board and finally the board received the bootloader code.

I also tried to flash the board I did before with my programmer board and here again it worked on the first time.

Finally, it was the Atmel programmer that didn’t work with my board. I did another board thinking that the first board had problems but actually it was the Atmel programmer that was not working with the board I have done.

So now my baords are flashed with the bootloader program, I need to send them a code to make the LEDs blink.

Programming of the board

To program the board I used the Arduino software. I needed to install a board manager Mattertaich.

I used the blinking code available on Arudino.

I checked where the pins are linked with which LED.

On the Arduino IDE, for my board to be able to be flashed byt his software, I added my board in the board manager. I copied this URL in additionnal board manager.

https://www.mattairtech.com/software/arduino/package_MattairTech_index.json 

Then I checked in the Boards manager if the mattairtech is installed.

I select some settings, select the right board. On the settings the USB port where the board is plugged don’t appear on the list.

I still stried to flash my board but as expected it didn’t work. I tried to plug it on another computer but the computer still don’t see the electronic board. I tested the continuity with the multimeter on all the traces and the current can flow inside so that is not the problem.

The board was flashed with the bootloader so the board can receive the current. For the next part I got the help of one of my instructor to find where the problems were. We tried a lot of stuff.

First we refill the pad where the D+ and the D- are plugged, try again the flashing but still don’t work. The board has been flashed but it is not recognize by the computers.

We checked the pins of the microcontroller, each one. On both boards I have made, they are both not recognize on the computer.

We checked again the circuit on the schematic.

We tried to send the code via the programmer. To do that we upload the code with the programmer, on Arduino software settings. It dind’t work still.

We also tried to save the code on a .bin file, to send it with the programmer with edbg and it still don’t work.

We change some settings. We changed the USB port where the programmer and the electronic board are plugged. It didn’t work, we test again the continuity. We check the current, the board well received the 5V and transform it into 3.3V.

We test the current from the pin where the LED is connected and after the LED and here there is no current, nothing is going through. The LED doesn’t receive anything.

Then we tried to generate a .bin file without a bootloader and write the code with edbg. Here it broke the board. The board was bricked.

from 0x00 to 0x01

We forced the reset with a wire to fix the board while flashing the board with the bootloader code. We fixed it, the board was not bricked. We are still stuck. We can’t send the blink program into the board but we can still flash it the bootloader code. It is not working but it is not worth.

Here is the error when I wanted to upload the code with Arduino

Without the programmer:

When upload using programmer:

Open On-Chip Debugger 0.9.0-gd4b7679 (2015-06-10-22:24)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
Error: at91samd11c14a.cpu -- clearing lockup after double fault
Polling target at91samd11c14a.cpu failed, trying to reexamine
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x61000000 pc: 0x00010100 msp: 0x464c457c
** Programming Started **
auto erase enabled
wrote 14336 bytes from file C:\Users\Elina\AppData\Local\Temp\arduino_build_226325/Blink2.ino.elf in 4.701332s (2.978 KiB/s)
** Programming Finished **
** Verify Started **
verified 13872 bytes in 1.288106s (10.517 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked

But the LED don’t blink still.

At the end the board can not be flashed with a blink program but only with the bootloader. I am still stuck on this step and we don’t know how to resolve it.

Group assignment (from the group page)

The multimeter

For the group assignment we used the multimeter to check the continuity of our traces but also to check the voltages at the terminals of our components. To do this we powered up Theo’s board and measured the voltage, continuity and resistor values at several points.

  • USB terminal voltage: 5.19 V
  • Transistor terminal voltage: 3.3 V
  • LED terminal voltage: 1.73 V
  • Measured resistance of the 100 ohm resistor: 100.1 ohm
  • Measured resistance of 0 ohm resistor: 0.9 ohm

Logic Analyser

We also used a logic analyser to decode the signal sent to the LED. We understand better the functioning of the microcontroller with this tool

Oscilloscope

The oscilloscope is an instrument to visualize signals in cartesian coordinates. We have a Tektronix TBS1052B-EDU

For this exercise we inspected Antonio’s board.

Every oscilloscope has different interaction, but the principles are the same you have the basic functions for:

  1. Scale the scope in X and Y axis.
  2. Change the pitch.
  3. Make a two channel graph.
  4. Auto-scale and focus the signal.

Some update

Some update on it:

  • We checked with my intructor the schema, and I forgot a trace with VCC/VDD, the microcontroller is only powered with JTAG pins, but when it is not plugged with a programmer, the microcontroller don’t receive power anymore
  • The resistor I used (1k Ohm) might be too big for the LED, I will desolder them and put less big resistor (100 Ohm)

We use some device to do test with the group, here is the link to the group assignment

Update : bootloader is working, programming and veryfying without the electronic board plugged One problem the microship is not powered, one trace missing, second problem the resistor are too big, I have to change them to a less value resistor. The Atmel is working but don’t send power.

Update will be on week 9, for embedded programming.

All the files