Compare commits

...

106 Commits

Author SHA1 Message Date
King Kévin a8810edd3b make: improve panelization 2024-04-27 10:40:12 +02:00
King Kévin 0038c3bdf3 lib: update repo 2024-04-19 04:20:05 +02:00
King Kévin 209b5852e0 brd: add contraints and predefined sizes 2024-04-19 04:18:14 +02:00
King Kévin 870be28af6 sch/brd: save as KiCAD v8 2024-04-19 04:01:49 +02:00
King Kévin bf94fcb10c make: fix clean 2024-04-19 04:00:26 +02:00
King Kévin 6823a71175 doc: update dev notes to KiCAD v8 2024-04-19 04:00:26 +02:00
King Kévin 9b8c48a33c make: add svg render 2024-04-19 04:00:26 +02:00
King Kévin 2497f9d94b make: use ibom from kicad8 2024-04-19 04:00:26 +02:00
King Kévin 88deb003a6 lib: update repo 2024-03-18 23:44:10 +01:00
King Kévin 529880abb4 make dragon kicad compatible 2024-03-18 23:43:19 +01:00
King Kévin fa16059e46 add old and new year logo 2024-03-08 07:24:21 +01:00
King Kévin 200f8b179d make: remove components from 2d rendering 2024-03-08 07:14:50 +01:00
King Kévin 07570f2911 make: update bom tool 2024-03-08 07:14:21 +01:00
King Kévin 0830600044 make: include DNF parts 2024-03-08 07:14:21 +01:00
King Kévin 3933cbccf8 make: export 3d model 2024-03-08 07:14:21 +01:00
King Kévin 89b65b72de make: add MPN in BoM 2024-03-08 07:13:47 +01:00
King Kévin 9e186892e5 make: ignore DRC 2024-03-08 07:12:31 +01:00
King Kévin ddf9deb7fc lib: update repo 2024-03-08 07:07:09 +01:00
King Kévin 0d73e5171d remove refdes2fab.py and this is a just a gloabal plugin for me 2023-12-18 20:47:12 +01:00
King Kévin 3e78d6beb5 lib: update logo properties 2023-10-01 10:12:16 +02:00
King Kévin c133c944de lib: add silk logo (less DRC errors) 2023-10-01 10:12:16 +02:00
King Kévin 16b19cc0d4 lib: update repo 2023-10-01 10:09:52 +02:00
King Kévin 7310a8173a lib: update repo 2023-09-19 05:12:28 +02:00
King Kévin e97b5bf01f lib: update part database 2023-09-19 05:11:40 +02:00
King Kévin 4aef742dc5 lib: generate Kicad7 library 2023-09-19 05:11:17 +02:00
King Kévin f84deb30b8 lib: remove JLCPCB correction info as it is in the database now 2023-09-19 05:10:41 +02:00
King Kévin 50444cd555 bom: ignore some fields 2023-08-11 11:06:14 +02:00
King Kévin cedd9571ee lib: update repo 2023-08-11 11:05:29 +02:00
King Kévin 7ba4b33939 make: use JLCPCB field in bom fabrication export 2023-08-11 11:04:37 +02:00
King Kévin 6fe5a0e425 make: prevent bom backup 2023-08-11 11:04:37 +02:00
King Kévin 6eb31f0646 ignore kicad lock files 2023-08-11 11:04:37 +02:00
King Kévin b893e7b57d make: ignore DRC for export 2023-08-11 11:04:37 +02:00
King Kévin ffbdffdf48 kicad: update files to v7 2023-03-30 22:32:40 +02:00
King Kévin 59b145d66e doc: better list dependencies 2023-03-30 22:30:26 +02:00
King Kévin c63fbf1689 make: use kikit again to generate fabrication 2023-03-30 22:30:26 +02:00
King Kévin d0d4203d20 make: add bom generator (not included in pip) 2023-03-30 22:30:26 +02:00
King Kévin cacdcb4ceb make: update bom generation 2023-03-30 22:30:26 +02:00
King Kévin 87cb8cb49b make: now use ibom plugin 2023-03-30 22:30:26 +02:00
King Kévin 99ab15f5eb make: switch back from kicad nightly 2023-03-30 22:30:26 +02:00
King Kévin 253f301eb0 lib: update database 2023-03-30 22:30:26 +02:00
King Kévin f1227afdcb make: fabrication does not need schematic 2023-03-30 22:30:26 +02:00
King Kévin 33f9b2cb87 make: add subsheet support 2023-03-30 22:29:07 +02:00
King Kévin 8fa5152b25 make: use kicad-cli to export fabrication (kikit does not support v7 yet) 2023-03-30 22:26:57 +02:00
King Kévin b066d8b473 make: update pcbdraw call 2023-03-30 22:26:57 +02:00
King Kévin d6ed8e8f86 make: use kicad-cli to generate bom 2023-03-30 22:26:57 +02:00
King Kévin ad93fccfcd make: use kicad-cli to render schematic 2023-03-30 22:26:54 +02:00
King Kévin 5849e04d54 lib: update partdb library 2023-03-30 22:25:49 +02:00
King Kévin 0b268fef02 lib: add logos 2023-03-30 22:25:49 +02:00
King Kévin cf6e95493f lib: switch kicad footprint to v7 2023-03-30 22:25:49 +02:00
King Kévin 58e504ea47 lib: disable qeda pin shapes 2023-03-30 22:23:41 +02:00
King Kévin 87819cd3e6 lib: add partdb library 2023-03-30 22:23:41 +02:00
King Kévin 5d9a596047 lib: enable audio connector library 2023-03-30 22:23:41 +02:00
King Kévin 8992163da1 lib: switch to version 7 2023-03-30 22:23:41 +02:00
King Kévin 4e8d15f64c sch: set kicad6 library 2022-12-24 03:09:46 +01:00
King Kévin 9b313a227c lib: update repo 2022-12-24 03:08:33 +01:00
King Kévin 283b18e1e9 lib: switch output to KiCad 6 2022-12-24 03:08:20 +01:00
King Kévin 9490a25e50 lib: add JLCPCB corrections for USB connectors 2022-12-24 03:05:45 +01:00
King Kévin f69a88300f brd: add material propertires 2022-09-13 12:19:22 +02:00
King Kévin f558b68515 add script to put refdes in fab layer 2022-09-13 12:14:21 +02:00
King Kévin b612622310 make: specify ibom generator 2022-08-10 17:43:30 +02:00
King Kévin c3ce63cbcd make: output iteractive bom 2022-08-10 14:45:31 +02:00
King Kévin 1d561046dd doc: add JLCPCB position correction 2022-08-10 12:39:29 +02:00
King Kévin 4636a6508b doc: replace rake with make 2022-08-10 12:37:46 +02:00
King Kévin e787a3412e add parts placement corrections 2022-07-13 11:10:43 +02:00
King Kévin dc767e3e37 make: output panel fab sooner 2022-07-13 11:10:21 +02:00
King Kévin ac4807e5ac make: remove git hash from revision 2022-07-04 10:17:51 +02:00
King Kévin df2e0df1d7 lib: update repo 2022-06-22 09:13:01 +02:00
King Kévin 54dfc1d55d rake: replace with more common make file 2022-06-22 09:12:23 +02:00
King Kévin 991fb55439 lib: rename generated lib to qeda 2022-06-17 18:06:46 +02:00
King Kévin d00955e75d brd: add net sizes 2022-06-17 17:55:41 +02:00
King Kévin 025d70af1b sch/brd: add template kicad schematic and board layout 2022-06-10 19:56:34 +02:00
King Kévin 8b216cf9ff lib: add most common components 2022-06-10 19:55:18 +02:00
King Kévin b1c719eebb git: remove cache file 2022-06-10 19:54:18 +02:00
King Kévin 4fdef09f30 sch/brd: remove lepton and ringdove files 2022-06-10 19:32:19 +02:00
King Kévin 4699c6b609 lib: update repo 2022-06-10 19:32:19 +02:00
King Kévin 88b9e8eb72 doc: update development doc for kicad toolchain 2022-06-10 19:32:19 +02:00
King Kévin ecb253e18b save JLC PnP corrections 2022-06-10 19:32:19 +02:00
King Kévin 2e982048c5 lib: document correction 2022-06-10 19:32:19 +02:00
King Kévin fc17a5abe3 rake: version panel configuration 2022-06-10 19:32:19 +02:00
King Kévin 0d85bfb90a rake: add panelization target 2022-06-10 19:32:19 +02:00
King Kévin 2882cb46c8 lib: remove date information 2022-06-10 19:32:19 +02:00
King Kévin 834f8c6f51 rake: use custom bom generator configuration 2022-06-10 19:32:19 +02:00
King Kévin 118fcf108c rake: change Rakefile for KiCAD processing 2022-06-10 19:32:13 +02:00
King Kévin 932d8f9a39 git: ignore KiCAD output and cache 2022-06-10 19:31:54 +02:00
King Kévin 097ceb5efc lib: add kikit footprints 2022-06-10 19:31:54 +02:00
King Kévin 26d6478b5c lib: add kicad library config 2022-06-10 19:31:54 +02:00
King Kévin acabbdfa31 lib: remove lepton and ringdove files 2022-06-10 19:31:49 +02:00
King Kévin baecb40eaf lib: allow generating kicad library 2022-06-10 19:31:41 +02:00
King Kévin 2f285de510 doc: add empty changelog file 2022-06-10 19:14:56 +02:00
King Kévin 479d64bc6a rake: export gerber in a directory 2022-05-18 17:42:13 +02:00
King Kévin 531206e2b3 rake: ignore stdout when exporting svg 2022-05-18 17:42:13 +02:00
King Kévin b9d4fabffd lib: update repo 2022-05-17 11:14:21 +02:00
King Kévin 5d0de1ee87 brd: fix footprint paths 2022-03-27 16:26:01 +02:00
King Kévin 865d7a899e README: development moved to other file 2022-03-23 10:49:07 +01:00
King Kévin 38466530e1 pnp: fix USB-C orientation 2022-03-23 10:34:20 +01:00
King Kévin 6e6ff34b51 pnp: adjust USB-C and CR1220 offset 2022-03-23 10:34:20 +01:00
King Kévin b3200d6e6e fab: add rotation for SOT23 2022-03-23 10:34:20 +01:00
King Kévin 93783e1682 qeda: set polarity mark to none 2022-03-23 10:34:20 +01:00
King Kévin 832e954f1e put development instructions in seperate file 2022-03-23 10:32:24 +01:00
King Kévin 9298df7acf update library 2022-03-07 14:42:51 +01:00
King Kévin 2e69c48388 update library url 2022-03-07 14:40:01 +01:00
King Kévin bb05a4bf7a lib: update to master 2022-02-02 16:42:09 +01:00
King Kévin fd34b256e2 Makefile: fix lepton CLI call 2022-02-02 16:42:09 +01:00
King Kévin e62773bfa1 Rakefile: minor, show error on empty BOM 2022-02-02 16:42:09 +01:00
King Kévin b38e271a1e Rakefile: minor, improve readability 2022-02-02 16:42:09 +01:00
King Kévin 8b0c84366a ignore other manual fabrication export (not from Rakefile) 2022-02-02 15:29:48 +01:00
51 changed files with 8427 additions and 1611 deletions

35
.gitignore vendored
View File

@ -1,18 +1,37 @@
# schematic lepton-EDA
*.sch
# board layout pcb-rnd
*.lht
*.lht.*
*.versioned.lht
# KiCAD
*.kicad_prl
*.kicad_pro-bak
*.xml
fp-info-cache
# temporary files
*~
*.versioned.sch
\#*\#
~*.lck
# outputs
*.svg
*.png
*.pdf
*.ps
*.zip
*.brd.*
*.tdx
\#*\#
*.notes.txt
*.bom.csv
*.cost.csv
*.cpl.csv
*.3d.step
*.versioned.*
fabrication
# scripts and utilities
*.json
*.rb
geda/footprints/
# panel files
panel.*
panel

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "library"]
path = library
url = http://git.cuvoodoo.info/qeda_library
url = https://git.cuvoodoo.info/kingkevin/qeda_library

View File

@ -1,9 +1,16 @@
config:
output: coraleda
nodate: true
output: kicad7
symbol:
pinIcon: false
pattern:
densityLevel: 'N'
lineWidth:
silkscreen: 0.2
polarityMark: none
preferManufacturer: false
smoothPadCorners: false
library:
- resistor/r0603
- capacitor/c0603
- diode/led0805

0
CHANGELOG.md Normal file
View File

108
DEVELOPMENT.md Normal file
View File

@ -0,0 +1,108 @@
this will describe how to generate the output files form the sources.
requirements
============
to be able to generate the outputs, you need following software:
- [QEDA](http://qeda.org/): to generate footprints for the parts
- [KiCad v8](https://www.kicad.org/): EDA software used for schematic capture and board layout
- [PcbDraw](https://github.com/yaqwsx/PcbDraw): to generate board layout rendering
- [KiKit](https://github.com/yaqwsx/KiKit): to generate fabrications files (Gerber, Excellon)
- [KiBoM](https://github.com/SchrodingersGat/KiBoM): to generate Bill of Material (CSV)
- [Interactive HTML BOM](https://github.com/openscopeproject/InteractiveHtmlBom): to generate placement guide
install Interactive HTML BOM using KiCad's Plugin and Content Manager.
for the others:
~~~
npm install qeda
pip install pcbdraw kibom kikit
~~~
you can additionally install KiKit using KiCad's Plugin and Content Manager for an integrated GUI.
compiling
=========
to generate schematic, BoM, board render, and fabrication output, run `make`.
library
-------
almost all of the symbols and footprints used in the schematic and board layout are defined in the [QEDA](http://qeda.org/) format and generated for the CAD software.
the `library` folder contains the QEDA parts definitions.
to install QEDA using NPM from the official repository:
~~~
sudo npm install -g qeda
~~~
to install QEDA from the sources:
~~~
git clone https://github.com/qeda/qeda
cd qeda
npm install
sudo npm install --global
~~~
to generate the parts:
~~~
make lib
~~~
this will use the parts definition (.yaml files) in the `library` to generate the symbols (.sym files) and footprints used by KiCAD in the `kicad` folder.
schematic
---------
the `.kicad_sch` file is the schematic source file.
it has been drawn using the [KiCAD eeschema](https://www.kicad.org/) schematic editor.
it uses standard symbols, and the ones in the `kicad/` folder.
most symbols are generated by QEDA as described above.
to export as pdf:
~~~
make print
~~~
BOM
---
to export the bill of material (as CSV):
~~~
make bom
~~~
board
-----
the `.kicad_brd` file is the board layout source file.
it has been drawn using the [KiCAD pcbnew](https://docs.kicad.org/6.0/en/pcbnew/pcbnew.html) PCB editor.
it uses the footprints from the `kicad/` folder.
most symbols are generated by QEDA as described above.
to export gerber files for PCB manufacturer (and photo preview + overview document):
~~~
make fabrication
~~~
versioning
----------
the source schematic and board layout do not include version information.
when generating schematic or board fabrication output, a copy of the source files with date and version information is done as `.versioned.` files.
the date corresponds to the last changes (i.e. commit).
the version is formatted as `v.r`:
- `v` corresponds to the major version information defined in `version`
- `r` corresponds to the total number of changes done to the source files

28
KiBOM_CLI.py Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
"""
@package
KiBOM - Bill of Materials generation for KiCad
Generate BOM in xml, csv, txt, tsv, html or xlsx formats.
- Components are automatically grouped into BoM rows (grouping is configurable)
- Component groups count number of components and list component designators
- Rows are automatically sorted by component reference(s)
- Supports board variants
Extended options are available in the "bom.ini" config file in the PCB directory
(this file is auto-generated with default options the first time the script is executed).
For usage help:
python KiBOM_CLI.py -h
"""
import sys
import os
here = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, here)
from kibom.__main__ import main # noqa: E402
main()

112
Makefile Normal file
View File

@ -0,0 +1,112 @@
# project file name (use for schematic and board layout)
NAME ?= template
SUBSHEET ?=
# path to KiCad CLI
KICAD = kicad-cli
# path to qeda
QEDA := qeda
# path to KiBOM
KIBOM := kibom
# path to InteractiveHtmlBom
IBOMGEN := ~/.local/share/kicad/8.0/3rdparty/plugins/org_openscopeproject_InteractiveHtmlBom/generate_interactive_bom.py
# read project version
VERSION := $(shell cat version)
# current date for stamping output
DATE = $(shell date +%Y-%m-%d)
# revision based on number of changes on schematic or board layout
REVISION := $(shell git log --pretty=oneline "${NAME}.kicad_sch" "${NAME}.kicad_pcb" | wc -l)
# generate file with version information
VERSIONED_EXT = kicad_sch kicad_pcb kicad_pro json
define version_rule
%.versioned.$1: %.$1
cp $$< $$@
sed --in-place 's/\$$$$version\$$$$/${VERSION}/g' $$@
sed --in-place 's/\$$$$date\$$$$/${DATE}/g' $$@
sed --in-place 's/\$$$$revision\$$$$/${REVISION}/g' $$@
sed --in-place 's/\.kicad_sch/.versioned.kicad_sch/g' $$@
endef
$(foreach EXT,$(VERSIONED_EXT),$(eval $(call version_rule,$(EXT))))
VERSIONED_SHEET = $(foreach SHEET,$(NAME) $(SUBSHEET),$(SHEET).versioned.kicad_sch)
FABRICATION_DIR := fabrication
IBOM := ${FABRICATION_DIR}/ibom.html
all: $(VERSIONED_SHEET) ${NAME}.sch.pdf ${NAME}.bom.csv render fab
fab: ${FABRICATION_DIR} ${IBOM}
render: ${NAME}.brd-top.png ${NAME}.brd-bot.png ${NAME}.brd-top.svg ${NAME}.brd-bot.svg ${NAME}.3d.step
# generate fabrication files (gerbers/drill/BoM/PnP)
${FABRICATION_DIR}: ${NAME}.versioned.kicad_sch ${NAME}.versioned.kicad_pcb
kikit fab jlcpcb --no-drc --assembly --field JLCPCB,LCSC --schematic $^ $@
# generate fabrication files (gerbers/drill/uncorrected PnP)
#${FABRICATION_DIR}: ${NAME}.versioned.kicad_pcb
# mkdir -p ${FABRICATION_DIR}
# $(KICAD) pcb export gerbers --output ${FABRICATION_DIR} $<
# $(KICAD) pcb export drill --output ${FABRICATION_DIR}/ $<
# $(KICAD) pcb export pos --output ${FABRICATION_DIR}/${NAME}.versioned.pos $<
# generate interactive BoM
${IBOM}: ${NAME}.versioned.kicad_pcb
python $(IBOMGEN) --no-browser --dest-dir `dirname $@` --name-format `basename $@ ".html"` --show-fields "Value" $< &>/dev/null
# generate symbols and footprints from parts
lib:
$(QEDA) generate qeda
# generate printable version (PDF) of schematic
%.sch.pdf: %.versioned.kicad_sch %.versioned.kicad_pro
$(KICAD) sch export pdf --output $@ $<
# generate render from layout (top side)
%.brd-top.png: %.versioned.kicad_pcb
pcbdraw plot --silent --no-components --dpi 600 --side front $< $@
# generate render from layout (bottom side)
%.brd-bot.png: %.versioned.kicad_pcb
pcbdraw plot --silent --no-components --dpi 600 --side back $< $@
# generate render from layout (top side)
%.brd-top.svg: %.versioned.kicad_pcb
$(KICAD) pcb export svg --layers F.Cu,F.Paste,F.Silkscreen,Edge.Cuts --page-size-mode 2 --exclude-drawing-sheet --output $@ $<
# generate render from layout (bottom side)
%.brd-bot.svg: %.versioned.kicad_pcb
$(KICAD) pcb export svg --layers B.Cu,B.Paste,B.Silkscreen,Edge.Cuts --mirror --page-size-mode 2 --exclude-drawing-sheet --output $@ $<
# export Bill of Material (as CSV)
%.bom.xml: %.versioned.kicad_sch %.versioned.kicad_pro
$(KICAD) sch export python-bom --output $@ $<
# export 3D model
%.3d.step: %.versioned.kicad_pcb
$(KICAD) pcb export step --output $@ $<
# export Bill of Material (as CSV)
%.bom.csv: %.bom.xml
$(KIBOM) $< $@
# generate panel
PANEL_DIR := panel_fab
panel: panel.kicad_pcb panel.brd-top.svg panel.brd-bot.svg panel.brd-top.png panel.brd-bot.png ${PANEL_DIR}
panel.kicad_pcb: ${NAME}.versioned.kicad_pcb ${NAME}.versioned.kicad_pro ${NAME}.versioned.kicad_sch panel.versioned.json
kikit panelize -p panel.versioned.json ${NAME}.versioned.kicad_pcb $@
sed --in-place 's/\"missing_courtyard\": \"warning\"/\"missing_courtyard\": \"ignore\"/g' $(patsubst %.kicad_pcb,%.kicad_pro,$@) # the mouse bites don't have a courtyard
${PANEL_DIR}: ${NAME}.versioned.kicad_sch panel.kicad_pcb
kikit fab jlcpcb --assembly --missingError --field JLCPCB,LCSC --schematic $^ $@
clean:
rm -f $(foreach EXT,$(VERSIONED_EXT),${NAME}.versioned.$(EXT))
rm -f ${NAME}.sch.pdf ${NAME}.brd-top.png ${NAME}.brd-bot.png ${NAME}.brd-top.svg ${NAME}.brd-bot.svg ${NAME}.versioned.xml ${NAME}.bom.csv
rm -f ${NAME}.versioned.kicad_prl ${NAME}.versioned.kicad_pro-bak ${NAME}.versioned.xml ${NAME}.versioned.csv
rm -f ${IBOM}
rm -rf ${FABRICATION_DIR}
rm -f panel.versioned.json panel.kicad_pcb panel.kicad_pro panel.brd-top.svg panel.brd-bot.svg panel.brd-top.png panel.brd-bot.png
rm -rf ${PANEL_DIR}

View File

@ -5,84 +5,3 @@ purpose
usage
=====
requirements
============
to be able to generate the outputs you need following software:
- rake: the central script taking care of generating the output files (Makefile is too cumbersome to parse files)
- [QEDA](http://qeda.org/): to generate footprints for the parts
- [Lepton EDA](https://github.com/lepton-eda/lepton-eda): for the schematic capture
- [pcb-rnd](http://repo.hu/projects/pcb-rnd/): for the board layout
the output generation is automatized.
compiling
=========
library
-------
almost all of the symbols and footprints used in the schematic and board layout are defined in the [QEDA](http://qeda.org/) format and generated for the CAD software.
the `library` folder contains the QEDA parts definitions.
to install QEDA using NPM from the official repository:
~~~
sudo npm install -g qeda
~~~
to install QEDA from the sources:
~~~
git clone https://github.com/qeda/qeda
cd qeda
npm install
sudo npm install --global
~~~
to generate the parts:
~~~
rake library
~~~
this will use the parts definition (.yaml files) in the `library` to generate [gEDA gschem](http://wiki.geda-project.org/geda:gaf)/[Lepton EDA](https://github.com/lepton-eda/lepton-eda) symbols (.sym files) in the `geda/symbols` folder, and [coralEDA pcb-rnd](http://repo.hu/projects/pcb-rnd/) footprints (.lht files) in the `coraleda/subc` folder.
only the QEDA parts in subfolders within `library` come from the [QEDA library](https://doc.qeda.org/library/), but the files are included in this project for simplicity and archiving purposes.
all other parts are custom and written for this project.
schematic
---------
the `.sch` file is the schematic source file.
it has been drawn using [Lepton EDA](https://github.com/lepton-eda/lepton-eda).
it uses standard symbols, and the ones in the `geda/symbols/` folder.
most symbols are generated by QEDA as described above.
to export as pdf:
~~~
rake print
~~~
BOM
---
to export the bill of material (as CSV):
~~~
rake bom
~~~
board
-----
the `.lht` file is the board layout source file.
it has been drawn using [coralEDA pcb-rnd](http://repo.hu/projects/pcb-rnd/).
it uses the symbols from the `coraleda/subc/` folder.
most symbols are generated by QEDA as described above.
`oshw_logo.lht` is just the Open Source Hardware Logo.
it been generated from https://oshwlogo.cuvoodoo.info/.
to export gerber files for PCB manufacturer (and photo preview + overview document):
~~~
rake fabrication
~~~

176
Rakefile
View File

@ -1,176 +0,0 @@
# encoding: utf-8
# ruby: 2.1.0
=begin
Rakefile to manage hardware projects
uses Lepton EDA for schematic and pcb-rnd for board layouts.
Rakefile instead of Makefile for better text file parsing capabilities.
=end
require 'rake/clean'
require 'csv' # to export BOM and costs
# =================
# project variables
# =================
# common name used for file names
name = "template"
# project version, read from "version" file
raise "define project version in 'version' file" unless File.exist? "version"
version = IO.read("version").split("\n")[0]
# current date for stamping output
date = Time.now.strftime("%Y-%m-%d")
# revision based on number of changes on schematic or board layout and current git commit
changes = `git log --pretty=oneline "#{name}.sch" "#{name}.lht" | wc -l`.chomp.to_i
commit = `git rev-parse --short HEAD`.chomp
revision = "#{changes} (#{commit})"
# path to qeda"
qeda = "qeda"
# ==========
# main tasks
# ==========
desc "main building task"
task :default => [:print, :fabrication, :bom, :pnp]
desc "print schematic and layout (as pdf)"
prints = [ "#{name}.sch.pdf", "#{name}.brd.pdf", "#{name}.brd-top.svg", "#{name}.brd-bottom.svg" ]
task :print => prints
CLEAN.include([ "#{name}.versioned.sch", "#{name}.versioned.lht" ])
CLOBBER.include(prints)
desc "generate fabrication gerbers (as archive)"
gerbers = [ "#{name}.brd.asb", "#{name}.brd.ast", "#{name}.brd.gbl", "#{name}.brd.gbo", "#{name}.brd.gbp", "#{name}.brd.gbs", "#{name}.brd.gko", "#{name}.brd.gtl", "#{name}.brd.gto", "#{name}.brd.gtp", "#{name}.brd.gts", "#{name}.brd.xln", "#{name}.brd.g2l", "#{name}.brd.g3l" ]
fab = [ "#{name}.brd.zip" ]
task :fabrication => fab
CLEAN.include(gerbers)
CLOBBER.include(fab)
desc "generate symbols and footprints from parts"
task :library do
sh "#{qeda} config output geda"
sh "#{qeda} generate ."
sh "#{qeda} config output coraleda"
sh "#{qeda} generate ."
end
desc "export BOMs from schematic"
boms = [ "#{name}.bom.csv" ]
task :bom => boms
CLOBBER.include(boms)
desc "export PnP placement"
pnps = [ "#{name}.cpl.csv" ]
task :pnp => pnps
CLOBBER.include(pnps)
# ===============
# file generation
# ===============
desc "generate schematic with version information all symbols embedded"
rule ".versioned.sch" => ".sch" do |t|
sh "cp #{t.source} #{t.name}"
sh "lepton-embed --embed #{t.name} 2> /dev/null"
sh "sed --in-place 's/\\$version\\$/#{version}/' #{t.name}"
sh "sed --in-place 's/\\$date\\$/#{date}/' #{t.name}"
sh "sed --in-place 's/\\$revision\\$/#{revision}/' #{t.name}"
end
desc "generate board layout with version information"
rule ".versioned.lht" => ".lht" do |t|
sh "cp #{t.source} #{t.name}"
sh "sed --in-place 's/\\$version\\$/#{version}/' #{t.name}"
sh "sed --in-place 's/\\$date\\$/#{date}/' #{t.name}"
sh "sed --in-place 's/\\$revision\\$/#{revision}/' #{t.name}"
end
desc "generate printable version (PDF) of schematic"
rule ".sch.pdf" => ".versioned.sch" do |t|
sh "lepton-cli export --color --paper iso_a4 --layout landscape --output #{t.name} #{t.source} 2> /dev/null"
end
desc "generate printable version (PostScript) of board layout"
rule ".brd.ps" => ".versioned.lht" do |t|
sh "pcb-rnd -x ps --ps-color --media A4 --psfile #{t.name} #{t.source} 2> /dev/null"
end
desc "generate printable version (PDF) of board layout"
rule ".brd.pdf" => ".brd.ps" do |t|
sh "ps2pdf -sPAPERSIZE=a4 -dEPSCrop #{t.source} #{t.name}"
end
desc "generate photo realistic picture from layout (top side)"
rule ".brd-top.svg" => ".versioned.lht" do |t|
sh "pcb-rnd -x svg --photo-mode --outfile #{t.name} #{t.source} 2> /dev/null"
end
desc "generate photo realistic picture from layout (bottom side)"
rule ".brd-bottom.svg" => ".versioned.lht" do |t|
sh "pcb-rnd -x svg --photo-mode --flip --outfile #{t.name} #{t.source} 2> /dev/null"
end
desc "archive gerbers"
rule ".brd.zip" => ".versioned.lht" do |t|
base = File.basename(t.source, ".versioned.lht")
puts base
sh "pcb-rnd -x cam gerber:JLC_PCB --outfile #{base}.brd #{t.source} 2> /dev/null"
sh "zip --quiet #{t.name} #{base}.brd.xln #{base}.brd.a* #{base}.brd.g*"
end
desc "generate BOM file from schematic"
rule ".bom.csv" => ".sch" do |t|
attributes = ["device", "value", "description", "footprint", "manufacturer", "mpn", "datasheet", "lcsc", "digikey"]
bom_data = bom2(t.prerequisites[0],attributes)
CSV.open(t.name, "wb") do |csv|
all_attributes = ["refdes","qty"]+attributes
csv << all_attributes
bom_data.each do |line|
csv << all_attributes.collect{|attribute| line[attribute]}
end
end
end
desc "generate pick-and-place file from board"
rule ".cpl.csv" => [".versioned.lht", "mass_prop.sh", "pnp_fab.tab"] do |t|
sh "./mass_prop.sh #{t.prerequisites[0]} pnp_fab.tab" # add fab placement offsets
sh "pcb-rnd -x XY --xyfile #{t.name} --xy-unit mm --format 'JLCPCB' --vendor jlcpcb #{t.prerequisites[0]}" # export XY file in JLCPCB format
end
# ================
# helper functions
# ================
# generate gnetlist bom2 and parse them
# arguments: schematic=schematic to use, attributes=attributes to use for generating bom2
# returns an array of hash. key is the attribute name, value is the attribute value
def bom2(schematic, attributes)
to_return = []
# force attributes to be an array
attributes = case attributes
when String
[attributes]
when Array
attributes
else
[attributes.to_s]
end
# generate bom2
list = `lepton-netlist --backend bom2 --backend-option attribs=#{attributes*','} --quiet --output - #{schematic} 2> /dev/null`
list = list.each_line {|l| '"' + l + '"' + '\n' }
list.gsub!(/^(.+)/, '"\1')
list.gsub!(/(.+)$/, '\1"')
list.gsub!(/(?!http):(?!\/\/)/, '\1":"\2') # protect the values between ':' (such as URLs)
# parse bom2
csv = CSV.parse(list, col_sep: ":", quote_char: '"')
csv[1..-1].each do |row|
line = {}
row.each_index do |col|
line[csv[0][col]] = row[col] unless row[col] == "unknown"
end
to_return << line
end
return to_return
end

108
bom.ini Normal file
View File

@ -0,0 +1,108 @@
[BOM_OPTIONS]
; General BoM options here
; If 'ignore_dnf' option is set to 1, rows that are not to be fitted on the PCB will not be written to the BoM file
ignore_dnf = 0
; If 'html_generate_dnf' option is set to 1, also generate a list of components not fitted on the PCB (HTML only)
html_generate_dnf = 1
; If 'use_alt' option is set to 1, grouped references will be printed in the alternate compressed style eg: R1-R7,R18
use_alt = 0
; If 'alt_wrap' option is set to and integer N, the references field will wrap after N entries are printed
alt_wrap = 0
; If 'number_rows' option is set to 1, each row in the BoM will be prepended with an incrementing row number
number_rows = 1
; If 'group_connectors' option is set to 1, connectors with the same footprints will be grouped together, independent of the name of the connector
group_connectors = 1
; If 'test_regex' option is set to 1, each component group will be tested against a number of regular-expressions (specified, per column, below). If any matches are found, the row is ignored in the output file
test_regex = 1
; If 'merge_blank_fields' option is set to 1, component groups with blank fields will be merged into the most compatible group, where possible
merge_blank_fields = 1
; Specify output file name format, %O is the defined output name, %v is the version, %V is the variant name which will be ammended according to 'variant_file_name_format'.
output_file_name = %O%V
; Specify the variant file name format, this is a unique field as the variant is not always used/specified. When it is unused you will want to strip all of this.
variant_file_name_format = _(%V)
; Field name used to determine if a particular part is to be fitted
fit_field = Config
; Make a backup of the bom before generating the new one, using the following template
;make_backup = %O.tmp
; Default number of boards to produce if none given on CLI with -n
number_boards = 1
; Default PCB variant if none given on CLI with -r
board_variant = ['default']
; Whether to hide headers from output file
hide_headers = False
; Whether to hide PCB info from output file
hide_pcb_info = False
[IGNORE_COLUMNS]
; Any column heading that appears here will be excluded from the Generated BoM
; Titles are case-insensitive
Part
Part Lib
Footprint
Footprint Lib
Build Quantity
sheetpath
qeda_part
qeda_variant
name
JLCPCB_CORRECTION
Rating
[COLUMN_ORDER]
; Columns will appear in the order they are listed here
; Titles are case-insensitive
References
Value
Quantity Per PCB
Description
Part
Part Lib
Footprint
Footprint Lib
Build Quantity
Manufacturer
MPN
DigiKey
LCSC
JLCPCB
Datasheet
[GROUP_FIELDS]
; List of fields used for sorting individual components into groups
; Components which match (comparing *all* fields) will be grouped together
; Field names are case-insensitive
Value
Footprint
Footprint Lib
[COMPONENT_ALIASES]
; A series of values which are considered to be equivalent for the part name
; Each line represents a list of equivalent component name values separated by white space
; e.g. 'c c_small cap' will ensure the equivalent capacitor symbols can be grouped together
; Aliases are case-insensitive
c c_small cap capacitor
r r_small res resistor
sw switch
l l_small inductor
zener zenersmall
d diode d_small
[REGEX_INCLUDE]
; A series of regular expressions used to include parts in the BoM
; If there are any regex defined here, only components that match against ANY of them will be included in the BOM
; Column names are case-insensitive
; Format is: "[ColumName] [Regex]" (white-space separated)
[REGEX_EXCLUDE]
; A series of regular expressions used to exclude parts from the BoM
; If a component matches ANY of these, it will be excluded from the BoM
; Column names are case-insensitive
; Format is: "[ColumName] [Regex]" (white-space separated)
References ^TP[0-9]*
References ^FID
Part mount.*hole
Part solder.*bridge
Part test.*point
Footprint test.*point
Footprint mount.*hole
Footprint fiducial

View File

@ -1,421 +0,0 @@
# footprint generated from CuVoodoo Land Pattern
# author: King Kévin
# version: 1
# date: 2019-05-13
li:pcb-rnd-subcircuit-v6 {
ha:subc.1 {
uid = any_24_ASCII_characters_
ha:attributes {
footprint = open source hardware logo
}
ha:data {
li:padstack_prototypes {
}
li:objects {
}
li:layers {
ha:top-silkscreen {
lid = 1
ha:type {
top = 1
silk = 1
}
li:objects {
ha:line.2{
clearance = 0
x1 = 0.15mm
y1 = 1.8mm
x2 = 0.75mm
y2 = 1.8mm
thickness = 0.3mm
}
ha:line.3{
clearance = 0
x1 = 1.8mm
y1 = 5.8500000000000005mm
x2 = 1.8mm
y2 = 6.45mm
thickness = 0.3mm
}
ha:line.4{
clearance = 0
x1 = 5.8500000000000005mm
y1 = 1.8mm
x2 = 6.45mm
y2 = 1.8mm
thickness = 0.3mm
}
ha:line.5{
clearance = 0
x1 = 1.8mm
y1 = 0.15mm
x2 = 1.8mm
y2 = 0.75mm
thickness = 0.3mm
}
ha:line.6{
clearance = 0
x1 = 0.15mm
y1 = 2.4mm
x2 = 0.75mm
y2 = 2.4mm
thickness = 0.3mm
}
ha:line.7{
clearance = 0
x1 = 2.4mm
y1 = 5.8500000000000005mm
x2 = 2.4mm
y2 = 6.45mm
thickness = 0.3mm
}
ha:line.8{
clearance = 0
x1 = 5.8500000000000005mm
y1 = 2.4mm
x2 = 6.45mm
y2 = 2.4mm
thickness = 0.3mm
}
ha:line.9{
clearance = 0
x1 = 2.4mm
y1 = 0.15mm
x2 = 2.4mm
y2 = 0.75mm
thickness = 0.3mm
}
ha:line.10{
clearance = 0
x1 = 0.15mm
y1 = 3mm
x2 = 0.75mm
y2 = 3mm
thickness = 0.3mm
}
ha:line.11{
clearance = 0
x1 = 3mm
y1 = 5.8500000000000005mm
x2 = 3mm
y2 = 6.45mm
thickness = 0.3mm
}
ha:line.12{
clearance = 0
x1 = 5.8500000000000005mm
y1 = 3mm
x2 = 6.45mm
y2 = 3mm
thickness = 0.3mm
}
ha:line.13{
clearance = 0
x1 = 3mm
y1 = 0.15mm
x2 = 3mm
y2 = 0.75mm
thickness = 0.3mm
}
ha:line.14{
clearance = 0
x1 = 0.15mm
y1 = 3.5999999999999996mm
x2 = 0.75mm
y2 = 3.5999999999999996mm
thickness = 0.3mm
}
ha:line.15{
clearance = 0
x1 = 3.5999999999999996mm
y1 = 5.8500000000000005mm
x2 = 3.5999999999999996mm
y2 = 6.45mm
thickness = 0.3mm
}
ha:line.16{
clearance = 0
x1 = 5.8500000000000005mm
y1 = 3.5999999999999996mm
x2 = 6.45mm
y2 = 3.5999999999999996mm
thickness = 0.3mm
}
ha:line.17{
clearance = 0
x1 = 3.5999999999999996mm
y1 = 0.15mm
x2 = 3.5999999999999996mm
y2 = 0.75mm
thickness = 0.3mm
}
ha:line.18{
clearance = 0
x1 = 0.15mm
y1 = 4.2mm
x2 = 0.75mm
y2 = 4.2mm
thickness = 0.3mm
}
ha:line.19{
clearance = 0
x1 = 4.2mm
y1 = 5.8500000000000005mm
x2 = 4.2mm
y2 = 6.45mm
thickness = 0.3mm
}
ha:line.20{
clearance = 0
x1 = 5.8500000000000005mm
y1 = 4.2mm
x2 = 6.45mm
y2 = 4.2mm
thickness = 0.3mm
}
ha:line.21{
clearance = 0
x1 = 4.2mm
y1 = 0.15mm
x2 = 4.2mm
y2 = 0.75mm
thickness = 0.3mm
}
ha:line.22{
clearance = 0
x1 = 0.15mm
y1 = 4.8mm
x2 = 0.75mm
y2 = 4.8mm
thickness = 0.3mm
}
ha:line.23{
clearance = 0
x1 = 4.8mm
y1 = 5.8500000000000005mm
x2 = 4.8mm
y2 = 6.45mm
thickness = 0.3mm
}
ha:line.24{
clearance = 0
x1 = 5.8500000000000005mm
y1 = 4.8mm
x2 = 6.45mm
y2 = 4.8mm
thickness = 0.3mm
}
ha:line.25{
clearance = 0
x1 = 4.8mm
y1 = 0.15mm
x2 = 4.8mm
y2 = 0.75mm
thickness = 0.3mm
}
ha:line.26{
clearance = 0
x1 = 1.8mm
y1 = 1.35mm
x2 = 4.8mm
y2 = 1.35mm
thickness = 0.3mm
}
ha:line.27{
clearance = 0
x1 = 5.25mm
y1 = 1.8mm
x2 = 5.25mm
y2 = 4.8mm
thickness = 0.3mm
}
ha:line.28{
clearance = 0
x1 = 4.8mm
y1 = 5.25mm
x2 = 1.8mm
y2 = 5.25mm
thickness = 0.3mm
}
ha:line.29{
clearance = 0
x1 = 1.35mm
y1 = 4.8mm
x2 = 1.35mm
y2 = 1.8mm
thickness = 0.3mm
}
ha:arc.30{
clearance = 0
x = 1.8mm
y = 1.8mm
width = 0.45mm
height = 0.45mm
thickness = 0.3mm
astart = 0
adelta = -90
}
ha:arc.31{
clearance = 0
x = 4.8mm
y = 1.8mm
width = 0.45mm
height = 0.45mm
thickness = 0.3mm
astart = -90
adelta = -90
}
ha:arc.32{
clearance = 0
x = 4.8mm
y = 4.8mm
width = 0.45mm
height = 0.45mm
thickness = 0.3mm
astart = 180
adelta = -90
}
ha:arc.33{
clearance = 0
x = 1.8mm
y = 4.8mm
width = 0.45mm
height = 0.45mm
thickness = 0.3mm
astart = 90
adelta = -90
}
ha:line.34{
clearance = 0
x1 = 1.8mm
y1 = 1.8mm
x2 = 3mm
y2 = 1.8mm
thickness = 0.3mm
}
ha:line.35{
clearance = 0
x1 = 3mm
y1 = 1.8mm
x2 = 3mm
y2 = 3mm
thickness = 0.3mm
}
ha:line.36{
clearance = 0
x1 = 3mm
y1 = 3mm
x2 = 1.8mm
y2 = 3mm
thickness = 0.3mm
}
ha:line.37{
clearance = 0
x1 = 1.8mm
y1 = 3mm
x2 = 1.8mm
y2 = 1.8mm
thickness = 0.3mm
}
ha:line.38{
clearance = 0
x1 = 4.8mm
y1 = 1.8mm
x2 = 3.5999999999999996mm
y2 = 1.8mm
thickness = 0.3mm
}
ha:line.39{
clearance = 0
x1 = 3.5999999999999996mm
y1 = 1.8mm
x2 = 3.5999999999999996mm
y2 = 2.4mm
thickness = 0.3mm
}
ha:line.40{
clearance = 0
x1 = 3.5999999999999996mm
y1 = 2.4mm
x2 = 4.8mm
y2 = 2.4mm
thickness = 0.3mm
}
ha:line.41{
clearance = 0
x1 = 4.8mm
y1 = 2.4mm
x2 = 4.8mm
y2 = 3mm
thickness = 0.3mm
}
ha:line.42{
clearance = 0
x1 = 4.8mm
y1 = 3mm
x2 = 3.5999999999999996mm
y2 = 3mm
thickness = 0.3mm
}
ha:line.43{
clearance = 0
x1 = 1.8mm
y1 = 3.5999999999999996mm
x2 = 1.8mm
y2 = 4.8mm
thickness = 0.3mm
}
ha:line.44{
clearance = 0
x1 = 1.8mm
y1 = 4.199999999999999mm
x2 = 3mm
y2 = 4.199999999999999mm
thickness = 0.3mm
}
ha:line.45{
clearance = 0
x1 = 3mm
y1 = 3.5999999999999996mm
x2 = 3mm
y2 = 4.8mm
thickness = 0.3mm
}
ha:line.46{
clearance = 0
x1 = 3.5999999999999996mm
y1 = 3.5999999999999996mm
x2 = 3.5999999999999996mm
y2 = 4.8mm
thickness = 0.3mm
}
ha:line.47{
clearance = 0
x1 = 3.5999999999999996mm
y1 = 4.8mm
x2 = 4.199999999999999mm
y2 = 4.2mm
thickness = 0.3mm
}
ha:line.48{
clearance = 0
x1 = 4.199999999999999mm
y1 = 4.2mm
x2 = 4.799999999999999mm
y2 = 4.8mm
thickness = 0.3mm
}
ha:line.49{
clearance = 0
x1 = 4.799999999999999mm
y1 = 4.8mm
x2 = 4.799999999999999mm
y2 = 3.5999999999999996mm
thickness = 0.3mm
}
}
}
}
}
}
}

View File

@ -1,39 +0,0 @@
#!/bin/sh
#@@example qr(hello world, 1mm)
#@@purpose Generate QR code on silk
#@@desc Generate the specified QR code as silk lines
#@@params text,pixel_size,level
#@@thumbsize 2
#@@param:text ASCII text to encode
#@@param:pixel_size width and height of each pixel
#@@dim:pixel_size
#@@param:level error correction level
#@@optional:level
#@@enum:level:L low
#@@enum:level:H high
#@@default:L
libdir=""
for n in $PCB_RND_PCBLIB/parametric `dirname $0` /usr/local/share/pcb-rnd/pcblib/parametric /usr/share/pcb-rnd/pcblib/parametric
do
if test -f "$n/common.awk"
then
libdir="$n"
break
fi
done
if test -z "$libdir"
then
echo "pcblib/parametric/common.awk not found." >&2
exit 1
fi
awk -f $libdir/common.awk -f `dirname $0`/qr.awk -v "args=$*" -v gen=`basename $0` -v "genfull=$0"

View File

@ -1,62 +0,0 @@
function flush_line(x1, x2, y, w ,n,yy)
{
x1/=2
x2/=2
for(n = 0; n < 3; n++) {
yy = y*w + w/6 + w/3 * n
element_line(x1*w + w/6, yy, x2*w - w/6, yy, w/3)
}
element_line(x1*w + w/6, y*w + w/6, x1*w + w/6, (y+1)*w - w/6, w/3)
element_line(x2*w - w/6, y*w + w/6, x2*w - w/6, (y+1)*w - w/6, w/3)
}
BEGIN {
help_auto()
set_arg(P, "?pixel_size", "1mm")
proc_args(P, "text,pixel_size,level", "text")
pixel_size = parse_dim(P["pixel_size"])
element_begin("", "QR1", "qr(" P["text"] "," P["pixel_size"] "," P["level"] ")" ,0,0, 0,-mil(50))
print "# text=" P["text"]
cmd = "echo '" P["text"] "' | qrencode -t ASCII"
if (P["level"] != "") {
if (tolower(P["level"]) == "h")
cmd = cmd " -l H"
else if (tolower(P["level"]) == "l")
cmd = cmd " -l L"
}
y = 0;
while((cmd | getline line) > 0) {
line = line "-"
# print line
len = length(line)
start = ""
for(x = 1; x < len; x++) {
if (substr(line, x, 1) == "#") {
if (start == "")
start = x;
}
else {
if (start != "") {
flush_line(start, x, y, pixel_size)
start = ""
}
}
}
if (start != "")
flush_line(start, x, y, pixel_size)
y++;
}
# dimension(+spacing/aspect, -dia, +spacing/aspect, dia, "@" spacing*1.2 ";0", "dia")
element_end()
}

6
fp-lib-table Normal file
View File

@ -0,0 +1,6 @@
(fp_lib_table
(version 7)
(lib (name "qeda")(type "KiCad")(uri "${KIPRJMOD}/kicad/qeda.pretty")(options "")(descr ""))
(lib (name "kikit")(type "KiCad")(uri "${KIPRJMOD}/kicad/kikit.pretty")(options "")(descr ""))
(lib (name "logo")(type "KiCad")(uri "${KIPRJMOD}/kicad/logo.pretty")(options "")(descr ""))
)

2
gafrc
View File

@ -1,2 +0,0 @@
(source-library ".")
(component-library "./geda/symbols/")

View File

@ -1,18 +0,0 @@
v 20210407 2
P 200 0 200 200 1 0 0
{
T 250 50 5 6 0 1 0 0 1
pinnumber=1
T 250 50 5 6 0 0 0 0 1
pinseq=1
T 250 50 5 6 0 1 0 0 1
pinlabel=1
T 250 50 5 6 0 1 0 0 1
pintype=pwr
}
T 200 250 9 8 1 0 0 3 1
1V8
T 300 0 8 8 0 0 0 0 1
net=1V8:1
L 150 100 200 200 3 10 1 0 -1 -1
L 200 200 250 100 3 10 1 0 -1 -1

View File

@ -1,18 +0,0 @@
v 20210407 2
P 200 0 200 200 1 0 0
{
T 250 50 5 6 0 1 0 0 1
pinnumber=1
T 250 50 5 6 0 0 0 0 1
pinseq=1
T 250 50 5 6 0 1 0 0 1
pinlabel=1
T 250 50 5 6 0 1 0 0 1
pintype=pwr
}
T 200 250 9 8 1 0 0 3 1
3V3
T 300 0 8 8 0 0 0 0 1
net=3V3:1
L 150 100 200 200 3 10 1 0 -1 -1
L 200 200 250 100 3 10 1 0 -1 -1

View File

@ -1,18 +0,0 @@
v 20210407 2
P 200 0 200 200 1 0 0
{
T 250 50 5 6 0 1 0 0 1
pinnumber=1
T 250 50 5 6 0 0 0 0 1
pinseq=1
T 250 50 5 6 0 1 0 0 1
pinlabel=1
T 250 50 5 6 0 1 0 0 1
pintype=pwr
}
T 200 250 9 8 1 0 0 3 1
5V