My personal all-around blog
My personal all-around blog

KiCad to NeoDen part 2

In a previous post, I tackled the conversion of a CAD program (KiCad) output position file, to the pick and place machine’s (NeoDen 4) needs.

The script I provided there did a great job in formatting the .CSV output file according to Neoden input requirements, and converting the component coordinates from the kicad reference to the p’n’p machine’s work space coordinates reference. The scale was not an issue, both are in millimeters, so it was only a matter of offset in both axles x and y.

All would work fine as long as the PCB would be affixed on the machine exactly as in the CAD program, its sides completely parallel with the machine’s x and y coordinate system. Since this is not easy, there was a need for some manual fiddling to correct the positions of each component in the machine’s software. This was done much easier through this script as the provided positions were very close to the actual and one could recognize very easily each component and perform the correction fast.

This was not so good though, and since Neoden’s software recognizes the angle the PCB differs from perfect alignment, and gives this number, I decided to make some enhancements to the script.

In the image below you can see a PCB placed in some random angle (red rectangle). The black rectangle shows where the angle-uncompensated KiCad position would be.

Theta_error is the angle the PCB orientation differs from the expected. I will spare you (and me) the math, it is obvious from just looking at the image that the same angle error is applicable to all the points in the PCB’s area, if your vectors are referenced on the PCB itself. In addition the length of vector r1 is equal to the length of vector r1′, the same with r2 and r2′. In contrast, the lengths of the vectors referenced to the machine coordinate system do not have the same length.

The above shows clearly the course of action I took. I converted all Cartesian coordinates to polar, referenced on the already needed Chip_1 position as the zero point. I kept all r coordinates as were, and applied the theta_error given by the machine (and manually given as an input to the script) to all theta coordinates. Then I converted back to Cartesian all coordinates, referenced to machine’s zero point.

Not so hard after all, I should have done it sooner, not waiting for a board with many components to remind me the work involved in manually correcting all the positions!

I usually export the positions for a single board from KiCad, and then use the Neoden’s software to create the panel. You can try if you wish to export all the panel but I don’t recommend it. You still have to manually check rotations, KiCad libraries don’t always agree with the actual rotation on the machine! Anyway the software on the machine does a good job paneling, even does boards with 180 degrees rotation in the same panel, as many of mine are. Still this script saves me a lot of work, I am pleased!

The new script is on the following link:

https://drive.google.com/file/d/1uaIgWoXoJV1Y0pTPP80v1X_5H6G4rwG0/view?usp=sharing

Use it as you see fit, no guaranties whatsoever but always have fun!

P.S. KiCad in version 6 didn’t change the position file format, so the script works just fine!

Update: the script is modified as per comments below!

Leave a comment

Your email address will not be published. Required fields are marked *

Spam repellent: * Time limit is exhausted. Please reload CAPTCHA.

5 thoughts on “KiCad to NeoDen part 2”