Your project template provides a ready-to-use component that displays a KiCad schematic or PCB directly in a page, with zoom and pan. This tutorial explains how to use it, how to document the bill of materials, and a fallback method using images.
What needs documenting
A well-documented circuit board answers four questions: what each
part of the circuit is for, exactly which components, how it is
wired, and why these choices. This last point ties in with
Recording your technical choices.
Where to store the files
Two locations, two roles:
Location
Content
Role
project/ecad/<board-name>/
The complete KiCad project (.kicad_pro, .kicad_sch, .kicad_pcb)
The sources: this is where you work
docs/assets/kicad/
A copy of the .kicad_sch and .kicad_pcb files
What the site displays
The site only displays what is in the docs/ folder. Copy your
files into docs/assets/kicad/ again at each important change to the
board, otherwise the site shows an old version. Also complete the
README.md of project/ecad/ (a table: board, folder, role).
Displaying the schematic and the PCB
Step 1: Duplicate the example page
The docs/conception/electronique/ folder contains the example page carte-principale.md. Copy it into the same folder, name the copy after your board (for example carte-capteurs.md), then change its title and its nav_order. Its parent (“Électronique”) and its grand_parent (“Conception”) stay the same. See Customising your project template for how the menu works.
Copy the .kicad_sch and the .kicad_pcb of your board into docs/assets/kicad/. As everywhere in the repo, use file names with no spaces or accents: carte-capteurs.kicad_sch, not Carte Capteurs.kicad_sch.
Once your files are displayed, delete from docs/assets/kicad/ the template’s Otto-ESP32-XIAO-REFEREE files (the Otto robot’s board), and the À modifier (to be edited) block from your page.
The display is a read-only viewer, loaded from kicanvas.org: it needs an internet connection, and it neither generates nor modifies anything. In particular, it does not compute a bill of materials: that is generated with KiCad itself (see below).
Fallback method: exporting an image
If your board was not made in KiCad, or if you want a fixed
figure (for a poster, for example), export an image. It is the method
that always works, without installing anything more.
Step 1: Open the export in KiCad
In KiCad’s schematic editor (Eeschema), open the File menu then Plot….
In the window that opens, choose the SVG output format (KiCad does not export directly to PNG from this window; SVG has the advantage of being sharp at any display size, unlike a bitmap image). Choose an output folder, for example docs/assets/images/.
The .svg file must be in docs/assets/images/. Then, in your page (here a page two folder levels deep, such as docs/conception/electronique/carte-capteurs.md):
The number of ../ depends on the depth of the page: a page directly in docs/ needs none (assets/images/schema.svg), a page in docs/fabrication/ needs one (../assets/images/schema.svg).
The bill of materials lists every component of the circuit. It is generated with KiCad,
not by hand.
Generate the bill of materials from KiCad
In the schematic editor (Eeschema), menu Tools > Generate Bill of Materials… (the exact label varies slightly with the version of KiCad). Choose an output format (CSV works everywhere), a folder, then run the generation. You get a file that automatically lists every reference, value and quantity of your schematic: no need to retype them by hand.
Once the CSV is generated, reformat the useful columns as a Markdown table
to include it neatly in your page (exact part number, not just “a
resistor”). It is the table that the template’s example page contains:
If reformatting by hand takes too long, put the generated .csv file in docs/assets/data/ and link to it directly (less pretty than a table, but always exact). Careful: the template’s .gitignore ignores .csv and .xml files everywhere except in docs/. A bill of materials exported into project/ecad/ will therefore not appear in GitHub Desktop and will never be sent to GitHub.
Going further: interactive bill of materials with a KiCad plugin
For those who want to dig deeper
This plugin is installed in KiCad (not in your site), and its output is a standalone HTML file: it is added with a simple link, without changing anything in the site’s configuration.
The InteractiveHtmlBom plugin
generates a standalone HTML file that displays the PCB and the bill of materials
side by side: click a row of the BOM, and the matching component
lights up on the board. Particularly useful for hand soldering
and for Documenting assembly and build.
Install the plugin
In KiCad, open the Plugin and Content Manager (dedicated icon on KiCad’s home screen), search for Interactive Html Bom, click Install then Apply.
Open your PCB in Pcbnew and save it. Click the plugin icon in the toolbar (or menu Tools > External Plugins > Generate Interactive HTML BOM). In the window that opens, click Generate BOM. An .html file is created: it works offline, without an internet connection.
The pinout says which pin of the microcontroller is connected to what. It is
the first question of anyone who picks up your board or your code, and
the place where the hardest bugs to find are born: a pin
changed on the schematic but not in the code, or the reverse.
It is documented in three layers, with one simple rule: the code is the
reference, and the documentation follows it.
Layer
Where
Mandatory?
A pins.h file that gathers all the pins
In the firmware code
Yes
A pinout table
On the board’s page (here)
Yes
A pinout diagram
On the board’s page, below the table
No, but very readable
1. In the code: a single pins.h file
All the pins are declared in a single file,
include/pins.h of the PlatformIO project (for example
project/firmware/mon-robot/include/pins.h), with a meaningful name and one
comment per line:
// Pinout of the main board (ESP32-S3).// Documented on the Carte principale page of the site: update it at the same time.#pragma once
// GripperconstexprintPIN_SERVO_PINCE=18;// PWM output, SG90 servo powered at 5 VconstexprintPIN_FIN_COURSE=19;// input, internal pull-up, pressed = LOW// TCS3200 colour sensorconstexprintPIN_COULEUR_S0=4;// output, choice of frequency scalingconstexprintPIN_COULEUR_OUT=5;// input, frequency signal
The rest of the code never writes a pin number: it uses
PIN_SERVO_PINCE, never 18. Changing a pin then means
editing a single line, and nobody forgets one at the bottom of another
file.
2. In the documentation: a table
On the board’s page, a table mirrors pins.h. The Name in the
code column bridges the KiCad schematic and the firmware:
Pin
Name in the code
Component
Subassembly
Note
GPIO18
PIN_SERVO_PINCE
SG90 servo
Gripper
PWM output, servo powered at 5 V
GPIO19
PIN_FIN_COURSE
Microswitch
Gripper
Input, internal pull-up, pressed = LOW
GPIO4
PIN_COULEUR_S0
TCS3200 (S0)
Colour sensor
Output, frequency scaling
GPIO5
PIN_COULEUR_OUT
TCS3200 (OUT)
Colour sensor
Input, frequency signal
Copy the pinout table (Markdown)
| Pin | Name in the code | Component | Subassembly | Note |
|---|---|---|---|---|
| GPIO18 | `PIN_SERVO_PINCE` | SG90 servo | Gripper | PWM output, servo powered at 5 V |
| GPIO19 | `PIN_FIN_COURSE` | Microswitch | Gripper | Input, internal pull-up, pressed = LOW |
| GPIO4 | `PIN_COULEUR_S0` | TCS3200 (S0) | Colour sensor | Output, frequency scaling |
| GPIO5 | `PIN_COULEUR_OUT` | TCS3200 (OUT) | Colour sensor | Input, frequency signal |
The Note column is the one most often forgotten, even though it
prevents the real mistakes: direction (input or output), pull resistor,
active level, voltage, pins to avoid at board start-up.
3. For readability: a pinout diagram
A Mermaid diagram, written as text like the rest of the documentation,
shows the pinout at a glance. The direction of the arrows indicates the inputs
(towards the board) and the outputs (from the board), and each subgraph
groups the components of one subassembly:
```mermaid
flowchart LR
ESP[ESP32-S3]
subgraph Gripper
SERVO[SG90 servo]
FDC[Limit switch]
end
subgraph Colour sensor
TCS[TCS3200]
end
ESP -- GPIO18 --> SERVO
FDC -- GPIO19 --> ESP
ESP -- GPIO4 : S0 --> TCS
TCS -- GPIO5 : OUT --> ESP```
flowchart LR
ESP[ESP32-S3]
subgraph Gripper
SERVO[SG90 servo]
FDC[Limit switch]
end
subgraph Colour sensor
TCS[TCS3200]
end
ESP -- GPIO18 --> SERVO
FDC -- GPIO19 --> ESP
ESP -- GPIO4 : S0 --> TCS
TCS -- GPIO5 : OUT --> ESP
The KiCad schematic, pins.h and the table say the same thing in three ways: they contradict each other as soon as one is forgotten. Team rule: pins.h is the reference, and any change to a pin updates the table (and the Mermaid diagram if there is one) in the same commit. If the board itself changes, the KiCad schematic in docs/assets/kicad/ is copied again at the same time.
Photos of the real build
The schematic shows the intention, a photo shows the reality, which is often
different (wire colours, position of the components on a breadboard,
temporary fixes). Take these photos at the time of assembly, not
afterwards (see Documenting as you go).
A simple photo taken with a smartphone, placed in docs/assets/images/
(under 2 MB: reduce its resolution if needed) and added with
, is enough.
Exercise
On your electronics: copy your KiCad files into
docs/assets/kicad/ and display the schematic and the PCB on the page of your
board, generate your bill of materials from KiCad and include it (as a table or
as CSV), write the pinout table from your pins.h file
(create it if it does not exist yet), and add at least one photo of the
real build.
Photo credit: circuit board of the Otto robot, MakerSpace UniLaSalle Amiens (see Discover the Otto board!).