Electronics Design

This assignment gives the student experience on connecting devices such as a switch and a LED to a Micro-Controller Unit (MCU). It also goes through PCB fabrication by milling with a CNC mill. This is an important experience as an introduction to automating machines by creating a circuit which receives programming instructions in order to control output to and receive input from external devices.

I could find freedom-enabling software to design electronic circuits: KiCAD and Fritzing. I have tested the former. But the later looks very easy to use and could be a better introduction for newbies.

Design the electronic circuit and the PCB with KiCAD

KiCAD is libre software suite of programs for automation of electronic design. Each program of the suite is independent. But it works with the workflow of the others. It is an advantage for its modularity. Nevertheless, it is a problem for learning because the workflow from one program to the other is not as intuitive as I would like. But the most important for me is that it is libre software. So, it is under my control to learn and contribute the functionality I need or the funds for developing them. KiCAD also has the advantage of being able to use group edited libraries.

Install the necessary software

Install KiCAD

guix package -i kicad

Then I installed a dependency for KiCAD to function properly (Guix is beta software).

guix package -i libxslt

I also installed other PCB manufacturing softwares for testing purposes.

guix package -s pcb
guix package -s qucs-s
guix package -s fritzing

Add the FabAcademy component library for KiCAD

Libraries of the components in the FabAcademy inventory are available. They contain the files needed for the placement of the electronic connection pads, the type of component they are and the way they look along with labels to their function and their connection pads.

Download the libraries for KiCAD. You can also clone the git repository with: git clone https://gitlab.cba.mit.edu/pub/libraries.git . If you clone you can collaborate and get the latest versions easily. But I only downloaded the libraries.

Then I decompressed the libraries with tar xvf libraries-master.tar

Entered the decompressed directory cd libraries-master/

And moved only the KiCAD libraries to my website repo:

mv kicad ../../ramiro-ordonez/skizoj/kicad_libraries

Then I changed to the upper directory and deleted all the other libraries.

cd ..
rm -fr libraries-master

I later found out there was an update to the FabAcademy libraries for KiCAD on Emanuele Goldoni's FabAcademy 2017 website. I have described how to intall it on my Input Devices page.

You can either add a local file or a web file. The latter allows automatic update of parts' libraries. It is a handy resource.

 bildo  bildo

Add the electronic components

In order to use a component, we must be sure to feed it the right voltage and that the current that goes through it does not exceed its capacity.

The MCU datasheet specifies the Micro-Controller Unit operation voltage. We can use it for calculating the value of the resistor that is connected in series with a LED we want to use.

VR = V MCU - VLED

R = VR / iLED

If you want the LED to glow dimmer, you can add a higher value resistor. Just multiply the calculated value by the factor of brightness you want ( 0.1 ~ 1.0 ).

Then you can draw the schematic with KiCAD's Eschema. You can open it from the project window.

Once there, add each component by pressing the Add symbol icon on the left of Eeschema window.

Anotate the components

In order to have the software relate the component footprint to their names and values, we must anotate the components by clicking the following icon.

 image of CvPCB (associates footprints to symbols) button in Eeschema

So it asks the way and order to label the components.

 bildo

Label some of the interconnected pads

It is easy to connect one component with one or more other components by placing the same label on them. Then you do not have to bloat the schematic diagram with spagetti connection traces.

Add traces between the other interconnected pads

With the threads and the labels we connect all components.

 bildo

Control electrical rules

ERC (Electrical Rules Control) icon allows the software to check that all components are connected.

 bildo

It opens a window which reports the errors encountered.

 bildo

And signals the places in the schematic diagram.

 bildo

This power flag had no component to power.

 bildo

This switch had one of its connectors disconnected.

 bildo

I proceeded to connect the power flag to a component and to mark the switch connector as unconnected. So the software gave no more errors after these 2 corrections.

 bildo

Asociate components with their footprints in CvPCB

In order for the software to create a view of the real PCB, we must asociate the components in the schematic with the footprints showing their shapes and their connectors. Each component has a specific drawing that must be related to it.

 bildo

Generate the netlist

So the anotations can place the components on the drawing for connecting the components. We press the netlist icon.

 bildo

The netlist is the list of the components, their footprints and their connections. We press the Generate button in order to produce the netlist.

 bildo

Trace the tracks

We can now trace the tracks. This is done by opening the PCBnew program. The icon is one of the last on the icon bar. So it opens a window with a lot of layers. We will focus on the cut layer (B.Cu) and the copper layer (F.Cu).

 bildo

We choose the Netlist icon in order to import the netlist. And specify the path where the netlist was saved.

 bildo

Then we press the Read Current Netlist button. (I had errors because I did not load the footprint library. What I loaded before was the component library in order to anotate the components.)

 bildo

So I download the component footprints from Emmanuelle Goldoni's Fabacademy website as I mentioned above.

 bildo

I confirm the changes to the library.

 bildo

And add the library to the global configuration.

 bildo

I have this library visible now. It is best to remove the other libraries to avoid confusion.

 bildo

Switch canvas to OpenGL in order for the traces to automatically flow around and into the other connections.

 bildo

The connections were traced.

 bildo

The final traces and the edge cut were drawn. Also the identification marks are visible in this picture.

 bildo

These are the many steps taken to accomodate components and traces in order to connect them all.

GIF animation of trace attempts on PCB design

Check the design rules

The design rules are checked in order to verify that all connections are made. Design Rules Checker (DRC) reports the unconnected components until these problems are solved.

 bildo

Render

A render is shown.

 bildo

Export to SVG

The edge cut layer and the copper layer are exported to SVG.

 bildo

Transform to PNG

On Inkscape, the SVG of the copper layer is transformed to PNG.

 bildo

And the edge cuts layer is also transformed to PNG.

 bildo

Generate the Gcode

The PNG file of the PCB's copper layer is fed to FabModules.

 bildo

These are two files of the rendering of Gcode generated for the edge cuts layer.

 bildo  bildo

Milling the Printed Circuit Board (PCB) and soldering the components

The PCB was milled with a smaller size. Probably it was made in mm and LinuxCNC detected it as inches. Now I know there is a Gcode to define this. But then I did not. This is the picture of the failed trace milling.

 falta bildo

The corrected Gcode is fed to the CNC router. It finally cut a nice board. Of course I made about 10 failed millings before that.

 falta bildo  falta bildo  falta bildo  falta bildo  falta bildo  falta bildo  falta bildo  falta bildo  falta bildo  falta bildo  falta bildo  falta bildo

The first picture below is of two Printed Circuit Boards (PCBs):

The next picture below is of the new PCB (with correct LED polarization; anode common). It is connected to the computer through the In-System Programmer (ISP).

bildoj bildoj

Conclusions

The milling bit must be in mint condition in order to make thin traces. Otherwise the traces break when sanding.

KiCAD is capable of using Git libraries. It can even use Eagle libraries. This way it is possible to keep up-to-date without effort.

Making traces should be very easy with the automatic placing and tracing tools. I was not able to use it. But I look forward to taking the time to do it next time I design a board. If it will not make the best path automatically as well as manual (like I was told), I think it could be fairly trivial to make an algorithm that does. Time will tell.

Making KiCAD more user-friendly looks like a task for a graphic designer. I do not think I am a capable volunteer. But I can look for someone that is. I hope I can find someone.

Sources

AVR AT Tiny 44 Micro-Controller Unit datasheet
All design files for Hello World board
FabAcademy updated libraries for KiCAD
KiCAD importable Eagle libraries

Other unordered information

BUG IN KiCAD MANUAL ==> Getting Started in KiCAD. Please change:
Click on the little circle at the end of pin 7 of the micro-controller and then click on the little circle on pin 2 of the LED. You can zoom in while you are placing the connection. to
Click on the little circle at the end of pin 7 of the micro-controller and then click on the little circle on pin 1 of the LED. You can zoom in while you are placing the connection.

Using plugins

 image of botton to show selected footprint in CvPCB  image of Bill of Materials' generation button in Eeschema  image of symbol libary for annotations editor button in Eeschema

Other photos

 falta bildo