diff --git a/README.md b/README.md index 92ab6eabcc5ff7b1553b2ab0ee776a69f3d52544..3435e6cb56aebb9b9e102744880f044c96be9992 100644 --- a/README.md +++ b/README.md @@ -1,292 +1,242 @@ ## ENGINEERING JOURNAL ### Jingyan Ling -### 06/27/2019 (Thur) -- Compile `OldRoCo` [repo](https://git.uclalemur.com/mehtank/oldroco) - - Record of modification: - - ++line 8 of `vstart.sh` - - --> `pip install -r requirements.txt --user` -- Export `paperbot` dxf file : `graph-silhouette.dxf` to `OnShape` - - Record of Tips: - - Onshape does not read dxf file as its own saved unit. Manual settings needed when import. - -  -- Draw circuit diagram as CAD on `Onshape` - - Multiple connection approaches: - - `Cross` shape of `0.039 in` - - `Cross` shape of `0.049 in` - - `Octangular` shape of `0.049 in` - -  - -  - - Note and issue: - - `Octangular` shape is the best connection approach so far, but none of approach has stable conductivity. More research is needed. - - Scratches can be made easily when attaching microcontroller to the sheet. Potential disconnection may occur due to such scratches on metal layer. -- Export 2D CAD drawing with PCB to SVG for silhouette cameo - - Record of Tips: - - `OnShape` unit need to be consisted with unit setting in `Inkscape` (default: mm) - - Plugin `Inkscape-silhouette` cannot take multiple types of trace for cutting. - - Different trace (especially cut and etching) need to be sent separately. Use `coordinate tool` of `Inkscape` to ensure separated cuts have same origin. - - TODO: - - Cut and etching from same `Inkscape` file -### 06/28/2019 (Fri) -##### Connection and fabrication approach confirmed ! -- Confirm that copper tape has better conductivity than aluminum sheet when attaching microcontroller pins through `H-shape` cut - - Copper tape is harder to be scratched, which provides less risk of disconnection during assembly. -- Etching on copper type isolates connections - -- Research on PCB editor - - EAGLE - - EAGLE cannot import `.pcb` file - - `svg` can be exported but not imported - - Custom library needed if doing schematic design - - KiCad - - Can import `.pcb` file - - `svg` can be exported but not imported - - LayoutEditor - - support multiply file type - - `svg` can be exported with different color makers as multiple layers - - include open-sourced auto-router `freerouting` -- Auto-routing package: - - TopoR - - Python-PCB - - FreeRouting +### 08/04/2019 +- Working on parsing routed (wiring section) text information. + - Ref: [pyparsing](https://scipy-cookbook.readthedocs.io/items/Reading_Custom_Text_Files_with_Pyparsing.html) +- Parsing generated `dsn` file back to `DSN` class + - Fail +- Parsing generated `kicad_pcb` file back to `pykicad` package - `pcb` class -- Approaches: - - `A`. convert SVG/DXF file to schematic/board design of PCB. Use KiCAD or EAGLE to do auto routing. - - `B`. develop algorithm on auto routing for single layer svg/dxf file. (path finding problem) - - -##### Approach `A` -- Use regular shape board for PCB in EAGLE/KiCAD - - image processing: divide the shape of `paperbot` to multiple rectangles (ezdxf) - - - Pull required connections and place additional header pins around edges of each rectangle -- Make each connection pin to be two parallel connections so auto-router does parallel trace for each wiring. - - Etching a pair of parallel trace provides isolation, and leave the space between traces to be conductible. +### 08/01/2019 -- Build Library for schematic design - - Schematic design helps with router to know desired connection - - Additional header pins at each side of kink mark +- Scripting Auto-router from python + - Run `.jar` package through python + - Can open GUI with imported file + - Cannot run auto-routing function from script + - Manually click on auto-routing and save is needed (manual approval) -### 06/29 & 06/30/2019 (Sat & Sun) -##### Approach `B` -- Potential needed functions of packages - - - A package draws on DXF file through script - - A script that pulls out pins' coordinate on paper chassis - - Or a image process package (OpenCV) that reads pins' coordinate on paper chassis - - A package solves multi-node path finding problem* +### 07/31/2019 -##### Record of Research -- Python Pathfinding package: - - [pathfinding](https://pypi.org/project/pathfinding/#description) -- Python DXF editor: - - [ezdxf](https://pypi.org/project/ezdxf/) - - [dxfgrabber](https://pypi.org/project/dxfgrabber/) - - `Note`: able to grab simple geometry from file - - [sdxf](http://www.kellbot.com/sdxf-python-library-for-dxf/) -- Going through tutorials of `ezdxf` - - All lines on paper space`layer0` +- Use `dsnwriter` in RoCo -### 07/01/2019 (Mon) -- Continue the dxf processing with `'graph-silhouette.dxf'` -##### Record of tips: - - Put circuit design on a new layer of dxf drawing - - [check doc about layers here](https://ezdxf.readthedocs.io/en/latest/tutorials/layers.html) - - Use block feature to draw similar pattern - - [check doc about block here](https://ezdxf.readthedocs.io/en/latest/tutorials/blocks.html) - - Blocks are `symbol` in Inkscape. Convert `symbol` to `path` - - Edit > Clone > Unlink Clone (Shift+Alt+D), and you have a group, ungroup (Object > Ungroup, or Shift+Ctrl+G) and edit - - Convert `text` to `path` - - Path combine (Ctrl+K) - - msp.delete_enetity('__') to remove existing entity +~~~ -- Test fabrication with different drawing settings - - Layers can be cut separately by toggling visibility - - Set cuts with same `intensity` and `feedrate` on same layer - - Entities' layer can be changed through `Entity.dxf.layer` +Mechanical drawings (dxf/svg)------------| + | +Module Footprints -----------------------| + |----> board design (dsn) +Electrical schematic design (netlist)----| + | +Board design details(rules,parameters)---| -### 07/02/2019 (Tue) -- Continue the dxf processing -- Following tasks can be completed by running the code: - - Able to detect pin center coordinate - - Able to draw arbitrary shape around the pin center - -  - -- - Issue & TODO - - Convert dxf image to matrix - - Explore `pathfinding` package - - `pathfinding` package solve path finding problem by shortest path algorithm, one point to another - - To solve multiple nodes problem, use concept from reinforcement learning - - Build Q function that represents total reward of choosing certain path to be solved first - - Update Q function in a loop with certain amount of episodes - - Choose the order of solving paths randomly, and add possibility of choosing it from Q function - - Exploration-exploitation method -- To solve the problem "convert dxf to matrix" for pathfinding: - - Have tried: - - Export to `png` and read file by `OpenCV` - - Resolution problem: single point does not represented as a pixel in `png` - - TODO: - - create an empty matrix and fill in numbers with the information of each lines' start and end point -### 07/03/2019 (Wed) -- dxf processing completed -- Convert dxf to matrix with resolution (270X210) (mm) - - Potential issue: - - the `pathfinding` package is based on pixel - - When round up the line's start and end point, the accuracy of pin position is low +----> board design (dsn)----> Auto-router (FreeRouting)----> routed board design (dsn) +----> wiring section ----> drawings with mechanical and electrical design (dxf/svg) +~~~ -- Apply single point to point path finding - - Able to draw the path on matrix - - Able to draw the path on original dxf file --  +- The package now can auto-detect padstack information with multiple files -- TODO: - - Write out algorithm for multi-node path finding - - break single circuit trace to parallel traces - - solve the accuracy problem +### 07/30/2019 +- Record of Tips: + - Use `@classmethod` in class to parse information pull out from files (netlist,drawings,footprint) to original class +- Package Dependencies: + - [pykicad](https://github.com/dvc94ch/pykicad) + - numpy +- Class Footprint now can call function `from_file(path,ref)` to load footprint from a `.kicad_mod` file +- Class Padstack now can call function 'auto_detact(path)` to guess information of pads and save as padstack class + - Via information need to be defined by users. (default=None) +- Placement class can be defined after footprint is loaded and able to define the position of each component by calling `ref` of module. +-  +-  -### 07/05/2019 (Fri) -- Write out algorithm for multi-node path finding - - pseudo code: - -~~~~ - for (episode in E): - set initial state s (choose first pair of nodes to connect randomly) - find a path - update map - while not every connection is built: - choose next connection - find a path - update map - retrieve cost (length of path) - update Q (as sum of all cost) - -~~~~ - - Q here represents total cost of certain choice of path finding order. - - Cost defined by length of path - - If path cannot be found, cost 1000 - - Input: NX2X2 array specifies desired pin connections - +- Netclass is easy to write from script. +- Test auto-routing on generated `dsn` +-  +- Test on wire width change +-  -- Research on KiCAD import needs and python API +- TODO: Easier API to generate netlist. -### 07/08/2019 (Mon) -- Debug multi-node path finding: - - some obstacles are ignored - - too close to each other -- Able to show the learning process: - - Trying different combination of solving order - - Try to give the best order of solving multiple path +### 07/29/2019 -##### Auto-routing learning process: - -  +- Was working on 'dsn_python' Python Library. +- Latest package can be found at [personal github](https://github.com/monkalynn813/dsn_python) +- Class tree: -- Comparison between episodes and choose best combo of paths --  +~~~ + |--dsnwritter.py (top and second level structure) + |--dsn_module.py + |--module class + |--load module functions + |--dsn_rule.py + |--dsn_geo.py + |--boundary class + |--keepout class + |--load drawing functions + |--dsn_net.py + |--net class + |--netclass class + |--load netlist functions +~~~ -##### Issues and TODO -- Path export from optimization is messed up -- Obstacles setting are incorrect -### 07/09/2019 -- Finish up path-finding approach (Approach B) -- Only draw the best path on `dxf` when solution is found for every route. --  -- Throw warning once a route cannot be found --  +- Text tree structure is done. + - Documentation and notes for code needed +- Functions are needed to help user use library. + - Function that load `dxf` file + - Function that load `footprint` file + - Function that load `netlist` file +- For board outline/footprint/netlist not loaded from file but define through this library manually, it works very well for now. +- Pull out those information from low-level file and convert it to proper text for `dsn` file -- Research on Approach A - - KiCAD 5 does not have built-in auto-router - - Have to use `FreeRouting` +- Record of Tips: + - `Freerouting` cannot take more than one boundary. (error: exact 1 bounding expected) - - `FreeRouting` does not have python API - - Parent package of `FreeRouting`, `LayoutEditor` has multiple editions - - Part of `LayoutEditor` is open- source - - A large amount of of its website are broken, source and interface are unavailable +- Able to use functions to load `dxf` drawings +- "internal cut issue" solved + - Treat every line individually as polygon and labeled as keepout in `dsn` library + -  + -  -- Other auto-routers are not open-source -##### Approach A -- 1. Use `LayoutEditor` python API to use `FreeRouting` -- 2. Use `KiCAD 5` python API to sue `FreeRouting` -- 3. Use `KiCAD 4` python API to use builtin auto-routing -###### 1 -- `FreeRouting` input format: `dsn`, `lef`, `def` -- `FreeRouting` output format: `ses`, `def` -- `FreeRouting` can take arbitrary board outlines shape -- Edit `library` manually and test routing --  -- TODO: - - If can run KiCAD 4 from python - - Check `FreeRouting` API, see if a acceptable file can be generated from things on hand - -### 07/10/2019 -##### Approach A -- Import to PCBnew issue: - - Dimension of board outlines are incorrect - - Pins does not fit in original drawings - - (solved. Microcontroller footprint was incorrect) -- pipeline confirmed: - - - 1. Build symbol and footprint library for all required electrical element - - 2. Sketch schematic design - - `.sch` file - - 3. Place elements in required position - - `.dsn` file - - 4. Import `dsn` file into `FreeRouting` and do auto-routing - - `.ses` file - - 5. Import `ses` file back to `KiCAD` and export as `dxf` file - - `.dxf` file -- Manually tested pipeline till step 4 +### 07/24/2019 + +- Pipeline change: (skipping `KiCAD`) + - Use (`dxf`+ `pretty` (footprint library) + `net` information ) to generate `dsn` file + - Send `dsn` file to auto-router, save as new `dsn` file + - Read `dsn` file `wiring` information and draw it back on `dxf` + +- Analysis on `dsn` file format: +~~~ + |--pcb + | |--parser + | |--resolution + | |--unit + | |--structure + | | |--layer 1 + | | |-- ... + | | |--boundary + | | |--keepout 1 + | | |-- ... + | | |--via + | | |--rule + | |--placement + | | |--component 1 + | | |-- ... + | |--library + | | |--image [ref**] 1 + | | | |--outline + | | | |--pin + | | |-- ... + | | |--padstack + | | |--... + | |--network + | | |--net [name] 1 + | | | |--pins + | | |-- ... + | |--wiring + | | |--wire +~~~ + + + +- TODO: functions that load modules and footprints + + +### 07/23/2019 + +- Solving issue: export `.kicad_brd` file to `dsn` file for auto-router +- No known Python API so far. +- [schematic-file-converter](https://github.com/ljmljz/schematic-file-converter) + - Take `.sch` file from `KiCAD` instead of `.kicad_brd` file + +- Official bug report has been requested. Not targeted in current `KiCAD` scripting version + - [bug report](https://bugs.launchpad.net/kicad/+bug/1824668) + +- Potential Solutions: + - 1. Explore existing supported export API, and see if modification can be made based on existing API structure + - 2. Learn `dsn` file specification and python library to generate `dsn` file based on design information + +### 07/22/2019 + +- Research on multiple KiCAD Python packages +- [package 3rd party list](https://github.com/xesscorp/kicad-3rd-party-tools/blob/master/README.md#footprint-library-tools) +- None can import `dxf` into `pcbnew` +- To import `dxf` into `pcbnew` automatically: + - Create a python API by myself based on the `c++` code + - Draw lines directly in `pcbnew` by using line information in `dxf` + +- Create a python script serving as Python API by drawing everything on `pcbnew` +- Dependencies: + - ezdxf + - pykicad +- Successfully import `dxf` as outlines from script +-  + +### 07/18/2019 + +- Research on pcbnew API + - Using package [pykicad](https://github.com/dvc94ch/pykicad) + - Record of Tips: + - Do not add segments, which will route connections + - Different reference name need to be set for `dsn` export + + - Able to add footprint and net list into pcbnew. + - TODO: + - Import dxf as outlines from script + - Export board as `dsn` + +### 07/17/2019 + +- Notice that even the drawings cannot be imported onto 'wiring' layer, but can be changed manually to 'wiring' layer after importing onto 'edge.cut' layer + - `Freerouting` does not recognize wires that does not connect to any pins as obstacles. + -  + -  + +- Work on script doing board design + - Create New Board + - Import DXF + - Load Netlist `.net` file + - Place modules + - Export to `.dsn` file -- Step 3 --  +### 07/16/2019 -- Step 4 --  - - ISSUE: - - Board outlines are not exported correctly to `FreeRouting` - - Error: `unable to find segment with an endpoint` - - - Record of Tips: - - To run `FreeRouting` from command line: - ~~~ - java -jar freeRouting.jar [proj.dsn] - ~~~ -- TODO: - - Finish with testing the pipeline manually - - Achieve steps directly from script (Python API) +- Fill and Stroke (Shift + Ctrl + F) +- Stroke to Path +- Union +- Break Apart +- Remove each outer layer (manually) +- Export +-  +-  +-  -### 07/11/2019 +- Consider success when export for auto-routing manually. Huge challenge expected when doing it from script. -- Solved Error `unable to find segment with an endpoint` - - `DSN` file can only be exported for continuous closure outlines - -  +- Work on script doing schematic design + - *Assume symbol and footprint downloaded* + - Package Using: [skidl](https://xesscorp.github.io/skidl/docs/_site/) + - Record of Tips: + - Add custom library path that contains all symbols of electrical devices needed (`NodeMCU`) + - Use attribute `footprint` to add footprint for such symbol + - footprint syntax: 'footprint= libname.pretty: foot_print_name + - footprint directory should be under the same directory where `.lib` file is. - - Drawings like this drawing for paper cut is not acceptable for `dsn` file. - - Change it either to close shape or remove it when import to KiCAD - -- Solving Issue: `FreeRouting` is not reading edge cut layer from `dsn` - - - Work well on a sample `dsn` file - - Issue with KiCAD output - - Sample KiCAD project can output outlines properly. -- Issue found: - - KiCAD cannot take single line cut. Closed shape needed. - ### 07/15/2019 - 3 potential ways to solve the issue on KiCAD with internal cut @@ -324,226 +274,298 @@ -  -  -### 07/16/2019 -- Fill and Stroke (Shift + Ctrl + F) -- Stroke to Path -- Union -- Break Apart -- Remove each outer layer (manually) -- Export --  --  --  +### 07/11/2019 + +- Solved Error `unable to find segment with an endpoint` + - `DSN` file can only be exported for continuous closure outlines + -  -- Consider success when export for auto-routing manually. Huge challenge expected when doing it from script. + - Drawings like this drawing for paper cut is not acceptable for `dsn` file. + - Change it either to close shape or remove it when import to KiCAD -- Work on script doing schematic design - - *Assume symbol and footprint downloaded* - - Package Using: [skidl](https://xesscorp.github.io/skidl/docs/_site/) - - Record of Tips: - - Add custom library path that contains all symbols of electrical devices needed (`NodeMCU`) - - Use attribute `footprint` to add footprint for such symbol - - footprint syntax: 'footprint= libname.pretty: foot_print_name - - footprint directory should be under the same directory where `.lib` file is. +- Solving Issue: `FreeRouting` is not reading edge cut layer from `dsn` + + - Work well on a sample `dsn` file + - Issue with KiCAD output + - Sample KiCAD project can output outlines properly. + +- Issue found: + - KiCAD cannot take single line cut. Closed shape needed. -### 07/17/2019 -- Notice that even the drawings cannot be imported onto 'wiring' layer, but can be changed manually to 'wiring' layer after importing onto 'edge.cut' layer - - `Freerouting` does not recognize wires that does not connect to any pins as obstacles. - -  - -  -- Work on script doing board design - - Create New Board - - Import DXF - - Load Netlist `.net` file - - Place modules - - Export to `.dsn` file +### 07/10/2019 -### 07/18/2019 +##### Approach A -- Research on pcbnew API - - Using package [pykicad](https://github.com/dvc94ch/pykicad) - - Record of Tips: - - Do not add segments, which will route connections - - Different reference name need to be set for `dsn` export - - Able to add footprint and net list into pcbnew. - - TODO: - - Import dxf as outlines from script - - Export board as `dsn` +- Import to PCBnew issue: + - Dimension of board outlines are incorrect + - Pins does not fit in original drawings + - (solved. Microcontroller footprint was incorrect) -### 07/22/2019 +- pipeline confirmed: + + - 1. Build symbol and footprint library for all required electrical element + - 2. Sketch schematic design + - `.sch` file + - 3. Place elements in required position + - `.dsn` file + - 4. Import `dsn` file into `FreeRouting` and do auto-routing + - `.ses` file + - 5. Import `ses` file back to `KiCAD` and export as `dxf` file + - `.dxf` file -- Research on multiple KiCAD Python packages -- [package 3rd party list](https://github.com/xesscorp/kicad-3rd-party-tools/blob/master/README.md#footprint-library-tools) -- None can import `dxf` into `pcbnew` -- To import `dxf` into `pcbnew` automatically: - - Create a python API by myself based on the `c++` code - - Draw lines directly in `pcbnew` by using line information in `dxf` +- Manually tested pipeline till step 4 -- Create a python script serving as Python API by drawing everything on `pcbnew` -- Dependencies: - - ezdxf - - pykicad -- Successfully import `dxf` as outlines from script --  +- Step 3 +-  -### 07/23/2019 +- Step 4 +-  + - ISSUE: + - Board outlines are not exported correctly to `FreeRouting` + - Error: `unable to find segment with an endpoint` + + - Record of Tips: + - To run `FreeRouting` from command line: + ~~~ + java -jar freeRouting.jar [proj.dsn] + ~~~ +- TODO: + - Finish with testing the pipeline manually + - Achieve steps directly from script (Python API) + +### 07/09/2019 +- Finish up path-finding approach (Approach B) +- Only draw the best path on `dxf` when solution is found for every route. +-  +- Throw warning once a route cannot be found +-  -- Solving issue: export `.kicad_brd` file to `dsn` file for auto-router -- No known Python API so far. -- [schematic-file-converter](https://github.com/ljmljz/schematic-file-converter) - - Take `.sch` file from `KiCAD` instead of `.kicad_brd` file +- Research on Approach A + - KiCAD 5 does not have built-in auto-router + - Have to use `FreeRouting` -- Official bug report has been requested. Not targeted in current `KiCAD` scripting version - - [bug report](https://bugs.launchpad.net/kicad/+bug/1824668) + - `FreeRouting` does not have python API + - Parent package of `FreeRouting`, `LayoutEditor` has multiple editions + - Part of `LayoutEditor` is open- source + - A large amount of of its website are broken, source and interface are unavailable -- Potential Solutions: - - 1. Explore existing supported export API, and see if modification can be made based on existing API structure - - 2. Learn `dsn` file specification and python library to generate `dsn` file based on design information +- Other auto-routers are not open-source -### 07/24/2019 +##### Approach A +- 1. Use `LayoutEditor` python API to use `FreeRouting` +- 2. Use `KiCAD 5` python API to sue `FreeRouting` +- 3. Use `KiCAD 4` python API to use builtin auto-routing -- Pipeline change: (skipping `KiCAD`) - - Use (`dxf`+ `pretty` (footprint library) + `net` information ) to generate `dsn` file - - Send `dsn` file to auto-router, save as new `dsn` file - - Read `dsn` file `wiring` information and draw it back on `dxf` +###### 1 +- `FreeRouting` input format: `dsn`, `lef`, `def` +- `FreeRouting` output format: `ses`, `def` +- `FreeRouting` can take arbitrary board outlines shape -- Analysis on `dsn` file format: -~~~ - |--pcb - | |--parser - | |--resolution - | |--unit - | |--structure - | | |--layer 1 - | | |-- ... - | | |--boundary - | | |--keepout 1 - | | |-- ... - | | |--via - | | |--rule - | |--placement - | | |--component 1 - | | |-- ... - | |--library - | | |--image [ref**] 1 - | | | |--outline - | | | |--pin - | | |-- ... - | | |--padstack - | | |--... - | |--network - | | |--net [name] 1 - | | | |--pins - | | |-- ... - | |--wiring - | | |--wire -~~~ +- Edit `library` manually and test routing +-  +- TODO: + - If can run KiCAD 4 from python + - Check `FreeRouting` API, see if a acceptable file can be generated from things on hand + -### 07/29/2019 -- Was working on 'dsn_python' Python Library. -- Latest package can be found at [personal github](https://github.com/monkalynn813/dsn_python) -- Class tree: +### 07/08/2019 (Mon) -~~~ - |--dsnwritter.py (top and second level structure) - |--dsn_module.py - |--module class - |--load module functions - |--dsn_rule.py - |--dsn_geo.py - |--boundary class - |--keepout class - |--load drawing functions - |--dsn_net.py - |--net class - |--netclass class - |--load netlist functions -~~~ +- Debug multi-node path finding: + - some obstacles are ignored + - too close to each other +- Able to show the learning process: + - Trying different combination of solving order + - Try to give the best order of solving multiple path +##### Auto-routing learning process: + -  -- Text tree structure is done. - - Documentation and notes for code needed -- Functions are needed to help user use library. - - Function that load `dxf` file - - Function that load `footprint` file - - Function that load `netlist` file -- For board outline/footprint/netlist not loaded from file but define through this library manually, it works very well for now. -- Pull out those information from low-level file and convert it to proper text for `dsn` file +- Comparison between episodes and choose best combo of paths +-  -- Record of Tips: - - `Freerouting` cannot take more than one boundary. (error: exact 1 bounding expected) +##### Issues and TODO +- Path export from optimization is messed up +- Obstacles setting are incorrect -- Able to use functions to load `dxf` drawings -- "internal cut issue" solved - - Treat every line individually as polygon and labeled as keepout in `dsn` library - -  - -  +### 07/05/2019 (Fri) +- Write out algorithm for multi-node path finding + - pseudo code: + +~~~~ + for (episode in E): + set initial state s (choose first pair of nodes to connect randomly) + find a path + update map + while not every connection is built: + choose next connection + find a path + update map + retrieve cost (length of path) + update Q (as sum of all cost) + +~~~~ + - Q here represents total cost of certain choice of path finding order. + - Cost defined by length of path + - If path cannot be found, cost 1000 + - Input: NX2X2 array specifies desired pin connections + +- Research on KiCAD import needs and python API -- TODO: functions that load modules and footprints +### 07/03/2019 (Wed) +- dxf processing completed -### 07/30/2019 -- Record of Tips: - - Use `@classmethod` in class to parse information pull out from files (netlist,drawings,footprint) to original class -- Package Dependencies: - - [pykicad](https://github.com/dvc94ch/pykicad) - - numpy -- Class Footprint now can call function `from_file(path,ref)` to load footprint from a `.kicad_mod` file -- Class Padstack now can call function 'auto_detact(path)` to guess information of pads and save as padstack class - - Via information need to be defined by users. (default=None) -- Placement class can be defined after footprint is loaded and able to define the position of each component by calling `ref` of module. --  --  +- Convert dxf to matrix with resolution (270X210) (mm) + - Potential issue: + - the `pathfinding` package is based on pixel + - When round up the line's start and end point, the accuracy of pin position is low -- Netclass is easy to write from script. -- Test auto-routing on generated `dsn` --  -- Test on wire width change --  +- Apply single point to point path finding + - Able to draw the path on matrix + - Able to draw the path on original dxf file +-  -- TODO: Easier API to generate netlist. +- TODO: + - Write out algorithm for multi-node path finding + - break single circuit trace to parallel traces + - solve the accuracy problem -### 07/31/2019 -- Use `dsnwriter` in RoCo +### 07/02/2019 (Tue) +- Continue the dxf processing +- Following tasks can be completed by running the code: + - Able to detect pin center coordinate + - Able to draw arbitrary shape around the pin center + -  + +- - Issue & TODO + - Convert dxf image to matrix + - Explore `pathfinding` package -~~~ + - `pathfinding` package solve path finding problem by shortest path algorithm, one point to another + - To solve multiple nodes problem, use concept from reinforcement learning + - Build Q function that represents total reward of choosing certain path to be solved first + - Update Q function in a loop with certain amount of episodes + - Choose the order of solving paths randomly, and add possibility of choosing it from Q function + - Exploration-exploitation method +- To solve the problem "convert dxf to matrix" for pathfinding: + - Have tried: + - Export to `png` and read file by `OpenCV` + - Resolution problem: single point does not represented as a pixel in `png` + - TODO: + - create an empty matrix and fill in numbers with the information of each lines' start and end point -Mechanical drawings (dxf/svg)------------| - | -Module Footprints -----------------------| - |----> board design (dsn) -Electrical schematic design (netlist)----| - | -Board design details(rules,parameters)---| +### 07/01/2019 (Mon) +- Continue the dxf processing with `'graph-silhouette.dxf'` +##### Record of tips: + - Put circuit design on a new layer of dxf drawing + - [check doc about layers here](https://ezdxf.readthedocs.io/en/latest/tutorials/layers.html) + - Use block feature to draw similar pattern + - [check doc about block here](https://ezdxf.readthedocs.io/en/latest/tutorials/blocks.html) + - Blocks are `symbol` in Inkscape. Convert `symbol` to `path` + - Edit > Clone > Unlink Clone (Shift+Alt+D), and you have a group, ungroup (Object > Ungroup, or Shift+Ctrl+G) and edit + - Convert `text` to `path` + - Path combine (Ctrl+K) + - msp.delete_enetity('__') to remove existing entity +- Test fabrication with different drawing settings + - Layers can be cut separately by toggling visibility + - Set cuts with same `intensity` and `feedrate` on same layer + - Entities' layer can be changed through `Entity.dxf.layer` -----> board design (dsn)----> Auto-router (FreeRouting)----> routed board design (dsn) -----> wiring section ----> drawings with mechanical and electrical design (dxf/svg) -~~~ +### 06/29 & 06/30/2019 (Sat & Sun) +##### Approach `B` +- Potential needed functions of packages + + - A package draws on DXF file through script + - A script that pulls out pins' coordinate on paper chassis + - Or a image process package (OpenCV) that reads pins' coordinate on paper chassis + - A package solves multi-node path finding problem* -- The package now can auto-detect padstack information with multiple files +##### Record of Research +- Python Pathfinding package: + - [pathfinding](https://pypi.org/project/pathfinding/#description) +- Python DXF editor: + - [ezdxf](https://pypi.org/project/ezdxf/) + - [dxfgrabber](https://pypi.org/project/dxfgrabber/) + - `Note`: able to grab simple geometry from file + - [sdxf](http://www.kellbot.com/sdxf-python-library-for-dxf/) +- Going through tutorials of `ezdxf` + - All lines on paper space`layer0` -### 08/01/2019 -- Scripting Auto-router from python - - Run `.jar` package through python - - Can open GUI with imported file - - Cannot run auto-routing function from script - - Manually click on auto-routing and save is needed (manual approval) +### 06/28/2019 (Fri) +##### Connection and fabrication approach confirmed ! +- Confirm that copper tape has better conductivity than aluminum sheet when attaching microcontroller pins through `H-shape` cut + - Copper tape is harder to be scratched, which provides less risk of disconnection during assembly. +- Etching on copper type isolates connections + +- Research on PCB editor + - EAGLE + - EAGLE cannot import `.pcb` file + - `svg` can be exported but not imported + - Custom library needed if doing schematic design + - KiCad + - Can import `.pcb` file + - `svg` can be exported but not imported + - LayoutEditor + - support multiply file type + - `svg` can be exported with different color makers as multiple layers + - include open-sourced auto-router `freerouting` +- Auto-routing package: + - TopoR + - Python-PCB + - FreeRouting -### 08/04/2019 -- Working on parsing routed (wiring section) text information. - - Ref: [pyparsing](https://scipy-cookbook.readthedocs.io/items/Reading_Custom_Text_Files_with_Pyparsing.html) -- Parsing generated `dsn` file back to `DSN` class - - Fail -- Parsing generated `kicad_pcb` file back to `pykicad` package - `pcb` class - - \ No newline at end of file +- Approaches: + - `A`. convert SVG/DXF file to schematic/board design of PCB. Use KiCAD or EAGLE to do auto routing. + - `B`. develop algorithm on auto routing for single layer svg/dxf file. (path finding problem) + + +##### Approach `A` +- Use regular shape board for PCB in EAGLE/KiCAD + - image processing: divide the shape of `paperbot` to multiple rectangles (ezdxf) + + - Pull required connections and place additional header pins around edges of each rectangle + +- Make each connection pin to be two parallel connections so auto-router does parallel trace for each wiring. + - Etching a pair of parallel trace provides isolation, and leave the space between traces to be conductible. + +- Build Library for schematic design + - Schematic design helps with router to know desired connection + - Additional header pins at each side of kink mark + +### 06/27/2019 (Thur) +- Compile `OldRoCo` [repo](https://git.uclalemur.com/mehtank/oldroco) + - Record of modification: + - ++line 8 of `vstart.sh` + - --> `pip install -r requirements.txt --user` +- Export `paperbot` dxf file : `graph-silhouette.dxf` to `OnShape` + - Record of Tips: + - Onshape does not read dxf file as its own saved unit. Manual settings needed when import. + -  +- Draw circuit diagram as CAD on `Onshape` + - Multiple connection approaches: + - `Cross` shape of `0.039 in` + - `Cross` shape of `0.049 in` + - `Octangular` shape of `0.049 in` + -  + -  + - Note and issue: + - `Octangular` shape is the best connection approach so far, but none of approach has stable conductivity. More research is needed. + - Scratches can be made easily when attaching microcontroller to the sheet. Potential disconnection may occur due to such scratches on metal layer. +- Export 2D CAD drawing with PCB to SVG for silhouette cameo + - Record of Tips: + - `OnShape` unit need to be consisted with unit setting in `Inkscape` (default: mm) + - Plugin `Inkscape-silhouette` cannot take multiple types of trace for cutting. + - Different trace (especially cut and etching) need to be sent separately. Use `coordinate tool` of `Inkscape` to ensure separated cuts have same origin. + - TODO: + - Cut and etching from same `Inkscape` file