Skip to main content
# Circuit Description Library

## Getting started

`joule_thief.py`
```python
from pycircuit.circuit import *
from pycircuit.library import *


Device('BAT0805', 'BAT', '0805',
Map('1', '+'),
Map('2', '-'))

Package('TDK ACT45B', RectCrtyd(5.9, 3.4), DualPads(4, 2.5, radius=2.275),
package_size=(5.9, 3.4), pad_size=(0.9, 1.35))

Device('TDK ACT45B', 'Transformer_1P_1S', 'TDK ACT45B',
Map('1', 'L1.1'), Map('2', 'L2.1'), Map('3', 'L2.2'), Map('4', 'L1.2'))


@circuit('TOP')
def top():
vcc, gnd, n1, n2, n3 = nets('VCC GND n1 n2 n3')

with Inst('TR1', 'Transformer_1P_1S') as tr1:
tr1['L1', 'L1'] = n1, n2
tr1['L2', 'L2'] = vcc, n3

Inst('BAT1', 'BAT')['+', '-'] = vcc, gnd
Inst('R1', 'R', '10k 0805')['~', '~'] = vcc, n1
Inst('Q1', 'Q', 'npn sot23')['B', 'C', 'E'] = n2, n3, gnd
Inst('LED1', 'D', 'led red 0805')['A', 'C'] = n3, gnd
```

`build.py`
```python
import joule_thief
from pycircuit.build import Builder
from pycircuit.compiler import Compiler
from pycircuit.library.design_rules import oshpark_4layer
from placer import Placer
from router import Router
from pykicad.pcb import Zone


def compile(filein, fileout):
compiler = Compiler()
compiler.compile(filein, fileout)


def place(filein, fileout):
placer = Placer()
placer.place(filein, fileout)


def route(filein, fileout):
router = Router()
router.route(filein, fileout)


def post_process(pcb, kpcb):
xmin, ymin, xmax, ymax = pcb.boundary()
coords = [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)]

zone = Zone(net_name='GND', layer='F.Cu',
polygon=coords, clearance=0.3)

kpcb.zones.append(zone)
return kpcb


if __name__ == '__main__':
Builder('joule_thief', joule_thief.top, oshpark_4layer,
compile, place, route, post_process).build()
```

`Makefile`
```make
PYCIRCUIT = ../..

build:
python3 build.py

view:
node $(PYCIRCUIT)/viewer/app.js 3000 net.dot.svg pcb.svg

kicad:
pcbnew *.kicad_pcb &>/dev/null &

clean:
rm -f *.net *.hash *.dot *.svg *.place *.route *.pro *.kicad_pcb

.PHONY: build view kicad clean
```

![Viewer](https://user-images.githubusercontent.com/741807/34364054-39b1362e-ea82-11e7-94b7-baf712e1aeab.png)
![KiCad](https://user-images.githubusercontent.com/741807/34364057-43e7ee62-ea82-11e7-9787-84fefaecbc49.png)

# License
ISC License

Copyright (c) 2017, David Craven

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

Metadata

Release files for pycircuit 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycircuit 0.0.2
File Size Uploaded Provenance Actions
pycircuit-0.0.2.tar.gz 20.7 kB Without provenance Details for pycircuit-0.0.2.tar.gz

Release files / pycircuit-0.0.2.tar.gz

Download URL pycircuit-0.0.2.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
854eb499dd3dcb7e73d7114d8b4d03453c328d6f49b78b77047bc0a88c51f2c7
BLAKE2b-256 checksum
How to use checksums
b6b8f91697a4ae53e9461df48b926466f36d424c4101c69b7ac865f1cb903374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pycircuit 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page