\documentclass[12pt,trans]{beamer}
\usepackage{color}
\usepackage{url}
\usepackage{colortbl}
%\usepackage{soul}
%\usepackage{verbatim}
\usefonttheme{structurebold}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{items}[ball] 
%\setbeamersize{sidebar width left=-5mm}
\title{\Large Making Hardware \\ with KiCad and Friends}
\author{Werner Almesberger \\\url{werner@almesberger.net}}
\date{July 27, 2012}

%\setul{}{1.5pt}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

% --- Overview ----------------------------------------------------------------

\begin{frame}{Overview}
\begin{itemize}
  \item KiCad introduction
  \item Collaborative design in Qi-Hardware
  \item Tools to improve KiCad
  \item Workflow overview
\end{itemize}

{\small \url{downloads.qi-hardware.com/people/werner/fisl13.pdf}}
\end{frame}

% --- KiCad Introduction ------------------------------------------------------

\begin{frame}{KiCad}
\begin{itemize}
  \item Complete EDA solution
  \item Free Software: GPL, LGPL
  \item Development team by Jean-Pierre Charras, \\
    Dick Hollenbeck, and many others
  \item C++, wxWidgets
  \item Multi-platform: Linux, Windows, Mac
  \item Text files $\rightarrow$ extensible
\end{itemize}

\vskip5mm
{\small \url{www.kicad-pcb.org}}
\end{frame}

% --- Schematics --------------------------------------------------------------

\begin{frame}{KiCad: Schematics}
\begin{center}
  \includegraphics[width=1.0\textwidth]{schem.pdf}
\end{center}
\end{frame}

% --- Footprints --------------------------------------------------------------

\begin{frame}{KiCad: Footprints}
\begin{center}
  \includegraphics[width=1.0\textwidth]{assoc.pdf}
\end{center}
\end{frame}

% --- Layout ------------------------------------------------------------------

\begin{frame}{KiCad: Layout}
\begin{center}
  \includegraphics[width=1.0\textwidth]{layout.pdf}
\end{center}
\end{frame}

% --- Qi-Hardware -------------------------------------------------------------

\begin{frame}{Qi-Hardware}
Structure and goals:
\begin{itemize}
  \item Collection of loosely connected projects
  \item Informal gathering of like-minded developers
  \item Copyleft Hardware with Free Software
  \item Development and manufacturing
  \item Toolmaking
\end{itemize}

Products:
\begin{itemize}
  \item Ben NanoNote (Handheld computer)
  \item Ben-WPAN (IEEE 802.15.4 wireless)
  \item Milkymist One (FPGA-based Video synthesizer)
\end{itemize}

\vskip2mm
{\small \url{www.qi-hardware.com}}
\end{frame}

% --- Collaborative Design ----------------------------------------------------

\begin{frame}{Collaborative Design}
\begin{itemize}
  \item Follow other people's work
  \item Review other people's work (projects and libraries)
  \item Shared design information
  \item Shared version control (git)
  \item Shared procedures and rules
\end{itemize}
\end{frame}

% --- KiCad Limitations -------------------------------------------------------

\begin{frame}{KiCad Limitations}
\begin{itemize}
  \item No integrated version control system support
  \item Integration leads to weak peripheral tools
    \begin{itemize}
      \item Footprint editor
      \item Component catalog
      \item Module catalog
    \end{itemize}
  \item No scripting (coming)
  \item Scattered libraries
\end{itemize}
\end{frame}

% --- Qi-Hardware Adaptation --------------------------------------------------

\begin{frame}{Qi-Hardware Adaptation}
\begin{itemize}
  \item Command-line-oriented use
  \item Extend KiCad with patches
  \item External scripts/programs
  \item Own component and module libraries with common rules
\end{itemize}
\end{frame}

% --- Libraries ---------------------------------------------------------------

\begin{frame}{Libraries}
Goals:
\begin{itemize}
  \item Consistent naming
  \item Known origin of design information \\
     E.g., IPC-7351
  \item Documented development process
\end{itemize}

To do:
\begin{itemize}
  \item Improve organization
  \item Better integrate background information
  \item Reviews !
\end{itemize}

\vskip4mm
% URL http://projects.qi-hardware.com/index.php/p/kicad-libs/source/tree/master/components/
{\small \url{tiny.cc/kicad-libs-components}} \\
% URL http://projects.qi-hardware.com/index.php/p/kicad-libs/source/tree/master/modules/
{\small \url{tiny.cc/kicad-libs-modules}}
\end{frame}

% --- What goes into git ------------------------------------------------------

\begin{frame}{What goes into git}
KiCad:
\begin{itemize}
  \item Project file: {\tt {\em project}.{\color{red}pro}}
  \item Schematics: {\tt {\em project}.{\color{red}sch}},
    {\tt {\em subsheet}.{\color{red}sch}}
  \item Footprint mapping: {\tt {\em project}.{\color{red}cmp}}
  \item Layout: {\tt {\em project}.{\color{red}brd}}
\end{itemize}

Qi-Hardware:
\begin{itemize}
  \item Makefile ({\tt sch}, {\tt brd}, {\tt fab}, {\tt clean})
  \item Bookshelf (for dsv)
  \item Project-local libraries
\end{itemize}
\end{frame}

% --- What doesn't ------------------------------------------------------------

\begin{frame}{What doesn't}
\begin{itemize}
  \item Netlist: {\tt {\em project}.{\color{red}net}} \\
    Generated with eeschema from
    {\tt *.{\color{red}sch}}
    and
    {\tt {\em project}.{\color{red}cmp}}
  \item Caches and backups:
    {\tt {\em sheet}.{\color{red}bak}},
    {\tt {\em project}.{\color{red}000}},
    {\tt {\em project}-cache.lib}
  \item Postscript:
    {\tt {\em project}-{\em sheet}.{\color{red}ps}},
    {\tt {\em project}-{\em layer}.{\color{red}ps}}
  \item Gerbers:
    {\tt {\em project}-{\em layer}.{\color{red}g{\em ??}}}
  \item BOMs: {\tt {\em project}.{\color{red}lst}},
    {\tt {\em project}.{\color{red}cvs}}
  \item Fab outputs: {\tt {\em project}.{\color{red}drl}},
    {\tt {\em project}.{\color{red}pos}}
  \item And so on: {\tt {\em project}.{\color{red}cad}},
    {\tt {\em project}.{\color{red}erc}},
    {\tt {\em project}.{\color{red}dsn}},
    {\tt {\em project}.{\color{red}rpt}},
    {\tt {\em project}.{\color{red}wrl}}, $\ldots$
\end{itemize}
\end{frame}

% --- Project File ------------------------------------------------------------

\begin{frame}{Project File ({\tt {\em project}.pro})}

Contains:
\begin{itemize}
  \item Project settings
  \item Lists of libraries
\end{itemize}

Issues:
\begin{itemize}
  \item Local absolute paths
  \item Default libraries
  \item Timestamps $\rightarrow$ commit noise
\end{itemize}

Solution:
\begin{itemize}
  \item Maintain manually
  \item {\tt purge} script: \\
% URL http://projects.qi-hw.com/index.phpp/wernermisc/source/tree/master/bin/purge
{\small \url{tiny.cc/wernermisc-bin-purge}}
\end{itemize}
\end{frame}

% --- Makefile ----------------------------------------------------------------

\begin{frame}[fragile]{Makefile}
Objectives:
\begin{itemize}
  \item Convenience shortcuts
  \item Combine tools
  \item Share common procedures
  \item Avoid mistakes
\end{itemize}

{\small
\begin{verbatim}
front:
    pcbnew --plot=ps --plot-fill-all-zones \
       --layers=Front --plot-mirror \
       $(PROJECT).brd
    lpr $(PROJECT)-Front.ps
\end{verbatim}
}
\end{frame}

% --- KiCad Command-Line Patches ----------------------------------------------

\begin{frame}{KiCad Command-Line Patches}
Original hack by Werner Almesberger, clean rewrite by Wolfgang Spraul,
soon rewrite for scripting.
\begin{itemize}
  \item Idea: command-line access to main output functions
  \item eeschema
    \begin{itemize}
      \item Visualization: Postscript (and SVG, DXF)
      \item BOM $\rightarrow$ BOOM
      \item Netlist, ERC
    \end{itemize}
  \item pcbnew
    \begin{itemize}
      \item Fabrication: Gerbers, drill (Excellon), component positions
      \item Visualization and DIY: Postscript
      \item Attributes: mirror, size, origin, fill zones, $\ldots$
    \end{itemize}
\end{itemize}

\vskip5mm
% URL http://projects.qi-hardware.com/index.php/p/eda-tools/source/tree/master/kicad-patches/
{\small \url{tiny.cc/eda-tools-kicad-patches}}
\end{frame}

% --- Data Sheet Viewer (dsv) -------------------------------------------------

\begin{frame}[fragile]{Data Sheet Viewer (dsv)}
\begin{itemize}
  \item Bookshelf: name and aliases $\rightarrow$ PDF or ZIP with PDF
  \item Download (wget) to local cache
  \item Hierarchical lookup by name or alias
  \item Example: \\
    {\tt dsv avr} $\rightarrow$ ATtiny87 ({\tt doc8265.pdf})
      $\rightarrow$ xpdf
\end{itemize}

\vskip5mm
Bookshelf example:

\begin{verbatim}
N: attiny87
A: attiny167
A: avr
D: http://www.atmel.com/Images/doc8265.pdf
\end{verbatim}
\end{frame}

% --- Data Sheet Viewer (dsv) -------------------------------------------------

\begin{frame}{dsv Motivation}
\begin{itemize}
  \item Make sure everybody uses the same data sheet
    \begin{itemize}
      \item Same component
      \item Same manufacturer
      \item Same data sheet revision
    \end{itemize}
  \item Copyright: can't just check in PDF
  \item Industrial pragmatism: private mail or ``internal'' repository
  \item Qi-Hardware: share {\tt BOOKSHELF}
\end{itemize}

\vskip10mm
% URL http://projects.qi-hardware.com/index.php/p/eda-tools/source/tree/master/dsv/
{\small \url{tiny.cc/eda-tools-dsv}}
\end{frame}

% --- Schematics Symbol Catalog  ----------------------------------------------

\begin{frame}{Schematics Symbol Catalog}
\begin{itemize}
  \item For selection, review
  \item Hierarchical order with alphabetical index
  \item Short descriptions and data sheet links \\
    To do: connect to dsv
  \item Added value: indicate pin types
\end{itemize}

\begin{center}
  \includegraphics[width=1.0\textwidth]{cat-comp.pdf}
\end{center}
\end{frame}

% --- Schematics History ------------------------------------------------------

\begin{frame}{Schematics History}
\begin{itemize}
  \item Schematics revision history
  \item {\tt git diff} produces gibberish
\end{itemize}

\begin{center}
  \includegraphics[height=4.5cm]{../fisl2011/schhist.png}
  \qquad
  \includegraphics[height=4cm]{../fisl2011/USB.png}
\end{center}

{\small \url{projects.qi-hardware.com/schhist/}}
\end{frame}

% --- Schematics History (cont'd) ---------------------------------------------

\begin{frame}{Schematics History (cont'd)}
How it works:
\begin{itemize}
  \item Walk git revision history
  \item Check out project whenever schematics change
  \item Run eeschema to make Postscript
  \item Convert to PNG (find diffs, with highlighting) and PDF
  \item Wrap in HTML
\end{itemize}

Issues:
\begin{itemize}
  \item Nasty shell script
  \item Resource-hungry (partial caching)
  \item Large schematics get confusing
  \item Projects spanning multiple repositories
\end{itemize}

% URL http://projects.qi-hardware.com/index.php/p/eda-tools/source/tree/master/schhist/
{\small \url{tiny.cc/eda-tools-schhist}}
\end{frame}

% --- Fped --------------------------------------------------------------------

\begin{frame}{Footprint Editor (fped)}
\begin{center}
  \includegraphics[height=45mm]{../fisl2011/fped.png}
\end{center}

\begin{itemize}
  \item Fully parametric
  \item Automated repetition (loops, tables, sub-frames)
  \item GUI or text-based
  \item Automatic measurements
  \item Output: KiCad, Postscript, Gnuplot
\end{itemize}
\end{frame}

% --- Footprint Catalog  ------------------------------------------------------

\begin{frame}{Footprint Catalog}
\begin{itemize}
  \item Like schematics symbol catalog, but for footprints
  \item Added value: measurements, pad types
\end{itemize}

\begin{center}
  \includegraphics[width=1.0\textwidth]{cat-mod.pdf}
\end{center}

% URL http://projects.qi-hardware.com/index.php/p/eda-tools/source/tree/master/genkicat/
{\small \url{tiny.cc/eda-tools-genkicat}}
\end{frame}

% --- Layout History ----------------------------------------------------------

\begin{frame}{Layout History}
\begin{itemize}
  \item Layout revision history
  \item To do $\ldots$
\end{itemize}

\vskip5cm
%% URL http://projects.qi-hardware.com/index.php/p/eda-tools/source/tree/master/brdhist/
% {\small \url{tiny.cc/eda-tools-brdhist}}
\end{frame}

% --- Gerber Renderer ---------------------------------------------------------

\begin{frame}{Gerber Renderer (prettygerbv)}
\begin{columns}
  \begin{column}[l]{8.5cm}
    \begin{itemize}
      \item ``Photorealistic'' view of PCB
      \item Combines Gerber (traces, drawings) and Excellon (holes)
      \item Easy to see issues with solder paste, silk screen,
        solder mask, $\ldots$
      \item Uses gerbv for rendering
    \end{itemize}
\vskip10mm
% URL http://projects.qi-hardware.com/index.php/p/eda-tools/source/tree/master/fab/prettygerbv/
{\small \url{tiny.cc/eda-tools-fab-prettygerbv}}
% MORE ??
% URL http://projects.qi-hardware.com/index.php/p/eda-tools/source/tree/master/fab/
{\small \url{tiny.cc/eda-tools-fab}}
  \end{column}

  \begin{column}[r]{4cm}
    \includegraphics[width=3cm]{../fisl2011/atusb-front.png}
  \end{column}
\end{columns}

\end{frame}

% --- BOM Processor -----------------------------------------------------------

\begin{frame}{BOM Processor (BOOM)}
\begin{itemize}
  \item BOM $\rightarrow$ select components $\rightarrow$ find supplier
     $\rightarrow$ \\
     shopping list
  \item Work in progress. Rewrite from Perl to C
    \begin{itemize}
      \item Faster
      \item Less headache with data structures
      \item Better parsing
    \end{itemize}
  \item Snag: Digi-Key spider no longer works
  \item Future: Help with component selection
\end{itemize}

% URL http://projects.qi-hardware.com/index.php/p/eda-tools/source/tree/master/b2/
{\small \url{tiny.cc/eda-tools-b2}}
\end{frame}

% --- BOOM Data Flow ----------------------------------------------------------

%\begin{frame}{BOOM Data Flow}
%DRAWING
%\end{frame}

% --- Schematics Design Rules -------------------------------------------------

\begin{frame}{Schematics Design Rules}
Work in progress. First compilation by Adam Wang.

\begin{itemize}
  \item Clean visual representation
  \item Compatibility with post-processors (e.g., BOOM)
\end{itemize}

Examples:
\begin{itemize}
  \item Value naming (4k7, 10uH, $\ldots$)
  \item Junction style
  \item Naming of negated pins
  \item Text placement and size
  \item Checklists for reviews
\end{itemize}

{\small \url{en.qi-hardware.com/wiki/Rules_on_Editing_Schematics}}
\end{frame}

% --- Qi-Hardware Workflow ----------------------------------------------------

\begin{frame}{Qi-Hardware Workflow}
\begin{center}
  \includegraphics[width=1.0\textwidth]{all.pdf}
\end{center}
\end{frame}

% --- Conclusion --------------------------------------------------------------

\begin{frame}{Conclusion}
Experience this far:
\begin{itemize}
  \item KiCad is a good basis for collaborative projects
  \item Open design allows extension with scripts
  \item Workflow is complex and needs careful consideration
\end{itemize}

To do:
\begin{itemize}
  \item Spread the word
  \item Finish BOOM and write brdhist
  \item Unify meta-data (bookshelf, etc.)
  \item Improve quality of libraries
  \item Integrate patches into mainline KiCad
\end{itemize}

\vskip2mm
{\small \url{downloads.qi-hardware.com/people/werner/fisl13.pdf}}
\end{frame}

\end{document}
