Author Topic: PCB generator and helper plugin for KiCad  (Read 46183 times)

0 Members and 1 Guest are viewing this topic.

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
PCB generator and helper plugin for KiCad
« on: Thu, 30 April 2020, 07:38:41 »
Hi,

those of you who did PCB design probably know that manual placement of elements is tedious task. For me it was unbearable so I decided to automate this with KiCad API.
My work can be found at https://github.com/adamws/kicad-kbplacer
It is not yet polished but should be usable at this stage. So far I did 4 projects with it and it was a breeze.

I would like to hear your feedback and suggestions about features you would like to see.
« Last Edit: Sat, 20 February 2021, 12:30:47 by adamws »

Offline Zustiur

  • Posts: 235
Re: Helper plugin for KiCad
« Reply #1 on: Mon, 11 May 2020, 18:17:45 »
I did wonder if such a tool existed. I've finished my layout for now but will try to remember this next time.

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: Helper plugin for KiCad
« Reply #2 on: Sat, 20 February 2021, 12:29:38 »
This project was in my backlog for a while but I picked it up again and here are the results: https://github.com/adamws/keyboard-tools
It's yet another PCB generator but with slightly different approach in terms of implementation. It can be played with here http://keyboard-tools.xyz/ - I also prepared short guide: https://adamws.github.io/keyboard-tools/kicad-project-generator/guide.html

Backbone of this project is plugin I shared earlier, but it should be easier to use this way.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4771
  • Location: England
Re: PCB generator and helper plugin for KiCad
« Reply #3 on: Tue, 23 February 2021, 04:22:34 »
Looks like an easy way to get most of the traces done, thanks for sharing :thumb:
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #4 on: Tue, 09 March 2021, 13:13:53 »
I've just added new feature. My netlist generation script is now able to include simple atmega32u4 circuit (https://github.com/adamws/kle2netlist/blob/master/kle2netlist/skidl.py#L218) which can be copied to generated kicad project from template file (https://github.com/adamws/kle2netlist/blob/master/kicad-templates/atmega32u4-au-v1/atmega32u4-au-v1.kicad_pcb). This is how PCB looks like straight out of my website:
264094-0
so in theory, user does not have to design controller circuit in separate step (described here https://adamws.github.io/keyboard-tools/kicad-project-generator/guide.html) if simple generic one is sufficient.
Once I figure out how to copy everything from template (including tracks which are right now missing) the only manual part would be controller-matrix routing and usb routing.
This will remain as an option and old workflow is still working.
I might also add some parameter options to controller circuit but at this stage, from functional point of view, project does pretty much what I wanted.

Offline Gorbon

  • Posts: 42
  • Location: Greece
Re: PCB generator and helper plugin for KiCad
« Reply #5 on: Tue, 09 March 2021, 16:16:22 »
Hi adamws and thank you for making this. It's such a great tool and I've used quite often lately.

One thing I found, is that when selecting the ai03 library, it causes an exception, halfway through the process.

264139-0

Also, as you mention in your guide, routing seems to fail for some rotated switches.

264141-1

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #6 on: Tue, 09 March 2021, 17:34:16 »
thanks for feedback!
One of the big issues is that I do not have any tests at this moment and I'm checking things manually - indeed ai03 lib is not working anymore and I didn't catch that.
Also, I still need to improve error reporting mechanism - because some of the processing steps are started as sub-processes, the error message in popup is not very helpful (it only points to failed step but exact reason is lost - I do not store job history on the server).

Routing for rotations is another part to be improved, I will try to fix it somewhere down the line.

and just a note, to anyone using it - github issues are welcome. Posting it here is also fine.

edit: ai03 is fixed now
« Last Edit: Tue, 09 March 2021, 17:46:31 by adamws »

Offline npeng

  • Posts: 2
Re: PCB generator and helper plugin for KiCad
« Reply #7 on: Sun, 14 March 2021, 06:05:30 »
I had this error but I figured it out.
« Last Edit: Sun, 14 March 2021, 06:10:31 by npeng »

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #8 on: Wed, 17 March 2021, 18:12:36 »
Improved switch-diode routing for rotated switches:
before:
264644-0
after (track is rotated same as switch/diode):
264646-1

started some quality checking/examples: https://github.com/adamws/kicad-kbplacer/tree/master/examples

Offline StormyMonday

  • Posts: 148
  • Location: Republic of Texas
Re: PCB generator and helper plugin for KiCad
« Reply #9 on: Mon, 06 December 2021, 06:09:12 »
Sorry to necro this, but more folks need to be aware of and use this project.

I just stumbled on this tool and it looks very promising. But, being a noob, I have failed to convince it to function correctly for me.

Issues
I uploaded perhaps a half dozen JSON files files from the Keyboard Layout Editor, but a few of them do not render at all and one rendered incorrectly, no matter which Project Options I chose.
For instance:
My Kyria layout will not render at all, nor did another layout that I am currently working on, which is a 60% ortholinear layout that resembles a Planck, but with staggered columns. In each case I received an error message that wasn't particularly helpful. Here is an example:
Code: [Select]
{ "exc_message": "Traceback (most recent call last):\n File \"/kicad/src/tasks.py\", line 69, in generate_kicad_project\n log_path = kicad.new_pcb(task_id, task_request, __update_percentage)\nException: Preview render failed\n", "exc_type": "Exception" }
My Iris layout does render, but both haves of this split board render as one single, large PCB, instead of two separate pieces. I suppose that this makes sense and I should have submitted this layout one half (one PCB) at a time..
Other layouts, such as a standard 60% and a Cherry 1800 layout render just fine.

That said, of all of the layouts that did render, I had a problem when clicking on the "Download Project" button. In each case, all I received was a zero length file. I tried temporarily disabling my firewall, but this brought me no joy.

Anywho, this is a brilliant project that more folks should be test driving, so I thought that I'd offer some feedback.

Thanks for your efforts!!!
« Last Edit: Mon, 06 December 2021, 07:42:18 by StormyMonday »

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #10 on: Sun, 01 January 2023, 11:57:47 »
After almost two years since last update I released v0.2 of https://github.com/adamws/kicad-kbplacer which is now KiCad 6.0 compatible and available on official KiCad's plugin repository.

There has been some updates on http://keyboard-tools.xyz/ as well. Although functionality is unchanged, I updated dependencies and fixed storage related bug which was causing space issues on server.
Website still uses previous kicad-kbplacer version (KiCad 5.1 compatible) but I'm planning to update it as well and keep it alive.

In case you encounter any bugs I encourage to open issue on github, that's best way to get my attention. I'm checking it far more often than this forum.

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #11 on: Wed, 22 March 2023, 15:17:40 »
I released v0.3 and v0.4 since last post.
Main changes:
- add KiCad 7 compatibility
- add support for customizable diode positions:



- improved 'router' algorithm and add track collision prevention.

I also finally updated version running on http://keyboard-tools.xyz/ website and added some extra features like preview of both sides of generated PCB.

Offline KiserDesigns

  • Posts: 31
    • Kiser Designs Store
Re: PCB generator and helper plugin for KiCad
« Reply #12 on: Thu, 06 April 2023, 09:08:08 »
I just stumbled upon this, and I am absolutely amazed!
I could see this working well to automatically place (and maybe route) a pro-micro footprint as well, going from KLE to working PCB in just a few clicks!
Love that it is open sourced too, very nice.

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #13 on: Fri, 07 April 2023, 09:00:51 »
I could see this working well to automatically place (and maybe route) a pro-micro footprint as well, going from KLE to working PCB in just a few clicks!

I already played with that idea. When running via web-interface you can select 'Controller circuit'
298065-0
and you would get something like this:
298067-1

template is located here: https://github.com/adamws/kle2netlist/tree/master/kicad-templates/atmega32u4-au-v1 (includes tracks as well)

It works well with 'whole-project-generator' (website) because then it have full control over netlist and saved template matches the netlist which is generated with skidl.
When using as kicad plugin (locally) there is this option:

but then it is up to the user to ensure netlist-template compatibility.

Offline KiserDesigns

  • Posts: 31
    • Kiser Designs Store
Re: PCB generator and helper plugin for KiCad
« Reply #14 on: Fri, 07 April 2023, 11:36:59 »
Wow, that is quite impressive!
Since AVR's aren't quite as popular for new designs, could you see yourself adding pre-generated RP2040 circuitry instead?

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #15 on: Fri, 07 April 2023, 14:06:54 »
Since AVR's aren't quite as popular for new designs, could you see yourself adding pre-generated RP2040 circuitry instead?

there was a plan to add more templates but that's not something I will do soon.

My current priorities for keyboaard-tools.xyz are:
- improve service stability. Based on server logs some jobs fail - need to investigate why
- fix memory leak (?) - server sometimes needs to be rebooted due to oom
- add more footprints (kailh hotswap)
- add optional selection of diode footprint and diode location

For kicad-kbplacer I plan to:
- add option to set non-default 1U switch distance
- add option to ignore diode placement (place switches only)
- support 'raw-data' from keyboard-layout-editor (and not only parsed json)
- support multi-layout (?)

Offline Im_Pigeon

  • Posts: 6
  • Location: UK
Re: PCB generator and helper plugin for KiCad
« Reply #16 on: Tue, 11 April 2023, 05:49:05 »
Thank you for making this available. It really makes the process of making my first MK PCB less daunting.

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #17 on: Tue, 20 June 2023, 11:29:03 »
New release just dropped, you can get it from here: https://github.com/adamws/kicad-kbplacer/releases/tag/v0.5
Should be available via KiCad's PCM soon.

You can now change 1U distance between switches (so it is usable for Kailh Choc designs) and define placement rules for additional elements (probably LEDs but perhaps someone will find other use-case - there is no limit to number of extra elements).


Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #18 on: Sat, 19 August 2023, 16:10:25 »
Just deployed https://github.com/adamws/keyboard-tools/releases/tag/v0.3 to the server.
There are no new features, just some bug fixes and performance improvements.

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #19 on: Tue, 22 August 2023, 16:12:10 »
Release v0.6 of kicad-kbplacer is out. It includes KiCad 7.0.7 compatibility fix and some new features.
Plugin now accepts raw kle layout files (as downloaded from keyboard-layout-editor, converting to internal form with another tool) and there is new experimental ergogen support.

Release notes can be found here: https://github.com/adamws/kicad-kbplacer/releases/tag/v0.6

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #20 on: Sat, 23 September 2023, 09:41:59 »
Next release will get better track template support, hopefully making it viable choice for ergogen users:


so far it was not possible to define template between more than two pads, making it unsuitable for reversible footprints.

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #21 on: Mon, 02 October 2023, 15:33:37 »
Release of kbplacer v0.7 is almost there (wait for merge into KiCad's PCM).
In the meantime I've written script which scraps via layouts and automatically generates (and routes) PCBs based on them. I did it for demo purposes and too see how router is working with variety of layouts.
Anyway, results can be found here https://adamws.github.io/keyboard-pcbs/

Some selected results:







As you may see it is not perfect but it is not terrible either.

I've also written python renderer for kle-layouts and ported obscure https://github.com/cerebral/urlon js package (keyboard-layout-editor uses that) to python so I can have nice images (and links) on that site. So even if you find those PCB files not interesting. https://adamws.github.io/keyboard-pcbs/ could still be usable as layout viewer.

Offline 2keys

  • Posts: 1
Re: PCB generator and helper plugin for KiCad
« Reply #22 on: Tue, 17 October 2023, 11:41:07 »
Thank you for this great tool, it helped me a lot with positioning key switches in bulk (though I had to move them around in designs where rows are offset). I noticed that the reason was it places each switch cluster in the order it appears in the provided json. I managed to get around it by following a design schema where I declare the position of each switch manually in the json starting left to right and figured out the way KLE does the positioning (before it refactors it for efficiency). Looking forward for new updates

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #23 on: Sat, 23 December 2023, 02:36:28 »
New kbplacer release is up https://github.com/adamws/kicad-kbplacer/releases/tag/v0.8
Just a minor bugfix this time.

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #24 on: Thu, 11 January 2024, 16:29:49 »

Offline adamws

  • Thread Starter
  • Posts: 19
    • keyboard-tools
Re: PCB generator and helper plugin for KiCad
« Reply #25 on: Sat, 24 February 2024, 09:50:54 »
kbplacer v0.9 is out, it is quite big release: https://github.com/adamws/kicad-kbplacer/releases/tag/v0.9

I also drafted some guide about usage with ergogen https://adamws.github.io/keyboard-pcb-design-with-ergogen-and-kbplacer/
306300-0
« Last Edit: Sat, 24 February 2024, 09:52:49 by adamws »