Scanning Parts Into KiCad

You do not know how to make a PCB unless you can make your own parts. [Jan] knows this, but like everyone else he checked out the usual online sources for a footprint for an SD card socket before making his own. It turns out, this SD card socket bought from an online marketplace was completely undocumented. Not only was an Eagle or KiCad footprint unavailable, but CAD files showing the dimensions of the part were non-existent. A solution had to be devised.

Instead of taking calipers and finely measuring all the pads on this SD card socket – a process that would surely fail – [Jan] decided to use a flatbed scanner to trace out the part. The part was placed on the glass and scanned at 300 dpi with a convenient reference object (a public transport card) in the same picture. This picture was imported into a CAD package, scaled to the correct ratio, and exported as a DXF. Since KiCad readily accepts importing DXFs, the CAD file was easily accessed, traced over, and a new part created.

From start to finish, making the footprint for this no-name, off-brand SD card socket took fifteen minutes. That’s nothing compared to the time it would take to manually measure each of the pads, draw a footprint, and print out the footprint at 1:1 scale to see if it matched up several times. It’s awesome work, and a great reminder that the best tools are usually right in front of you.

37 thoughts on “Scanning Parts Into KiCad

    1. Definitely a good idea, but the article does read like one of those infomercials where someone can’t use a common kitchen implement. “Nobody can get their fork to stick into their vegetables! (fork stabbing, flying food) Introducing the fork-o-matic 2000! (smiles all-round)”

      If caliper measurements are unreliable, you’re doing it wrong.

  1. Very nice solution, but I still swear by calipers and experience … Being sure to print packages out to scale to test or even etching to copper if critical

    It’s strange just how many things have documentation that’s either
    A) non existent by any reasonable search
    B) not in English
    C) totally wrong

    But I must add I do want some of these micro sd sockets … Looks far easier to hand solder!

    1. Though there’s
      B) Not in English;
      i) In some other language.
      ii) In some language that has a passing resemblance to English in that English sounding words seem to be used as cypher symbols for some other meaning, inconsistently. c.f. Engrish.

  2. “Instead of taking calipers and finely measuring all the pads on this SD card socket – a process that would surely fail …”
    Why would it fail? It would be error prone, sure, but it wouldn’t fail. That’s why its recommended to print out a new footprint on paper and check placement

    1. Sounds like a horrible way to waste your time and introduce slight inaccuracy.

      Just get the land pattern from the datasheet and draw it as specified.

      Personally, the annoying thing about micro-SD card libraries is the extremely weird, non-intuitive way that the numbered pins correspond to the physical arrangement.

    2. I used calipers to measure a 3D plastic part for a machine, then 3D printed it. It fit everything perfectly the first time. If you know what you’re doing and can run a calculator, there’s no reason to “surely fail”.

      I have also scanned things for 2D re-creation and 3D modeling. When accurate measurements are required I put a small steel rule on the scanner. Then in editing the rule can be cut and copied and pasted to other locations.

  3. On Github several EAGLE projects use this SD cardholder. Some time ago I scraped Github for EAGLE for schematics and boards, and extracted all the parts from it. Made a simple frontend to the database. Too bad I ended up with a superlarge Database otherwise I had hosted on my site (no big database). If someone knows a mega cheap reliable hoster with 5MB web space and 2GB database for I consider to make it public.

    This method looks nice alternative to this (and way more reliable :)) Gotta try this

      1. Unfortunately not :(

        It was a bit of a nightmare. Basicly you use the same search function as a normal user uses (with some tweaks) and parse that result into a list of repo’s. Then download the files and put that through a eagle parser.

  4. Good idea! The same can be done in Eagle. Using Illustrator or ink scape, convert the scanned picture to vector, cleanup, export as dxf and use Eagle file->Run ULP->import dxf. Draw the proper pads and you’re done.

    1. Heck I’ve done it this way for parts with footprints in the datasheet. Sometime dimensions aren’t easily referenced back to an origin. Placing pads over the DXF layer while not perfect is good enough. Works great for silkscreen too!

  5. Did a similar Thing with a pcb. I had some ps2 optical mouses from an Admin Job und wanted to put an arduino in it. Wanted to add autofire, and other Features for fps-shooters. So desoldered All component Off an Pat it on an flat bed Scanner. Got a Programm to make Eagle half transparent and the odd shape and component placements where easy Tasks.

    1. I’m doing something similar at the moment. Did you use the optimouse library? I’m just going to hide a digispark in the mouse rather than make a board. Care to share the source code?

      1. It was a cheap Typhoon mouse with an ADNS 2610. The main tasks of the pcb where to hold the components like the sensor, microswitch, mousewheel assemby and a arduino micro in place.

        I wrote the driver with a datasheet but after comparison with the code of https://www.sparkfun.com/products/retired/10105 it was almost equal (ADNS 2620). The USB-Stuff was handled by the arduino libs from the micro/leonardo. The status lights like capslock are missing but mouse and keyboard inputs are very easy.

        Overall it worked but wasn’t finished, couldn aim while a macro was running, macros where hardcoded, mousemovement was sh*tty (?unfiltered?). Still was one of my best projects and autofire was working better than expected. reaching high scores at speed clicking online games where easy. At some points the browser and even windows 7 crashed. The symptomes where really funny, it startet to do some sort of morsecode over the speakers.

        I planned to do it again on my Logitech MX510 wich has much better specs but couldnt find the datasheets needed.

        The source is on a flying hdd and i dont know which one, so sorry.

        One last advice if you using a usb-bootloader: Add some sort of arming procedure at the beginning of your code, because hitting the programming button is hard when the mousepointer turns into an animal.

        1. Thanks for replying. I have plenty of example source code from all the optical mouse camera hacks. I just want to add debouncing to my own mouse, and change the wheel encoder. nothing fancy. my mouse uses the 2610 also which is fairly low res nowadays for gaming.

  6. Nice, I did a similar thing with a PCB. We made a new “brain” for an old appliance. We Scanned the PCB, Made an outline and marked all the pads and holes we wanted (buttons, LEDs) Connectors. Then we imported it as a DXF and used it as a board outline and guide.

  7. That is a novel idea except that without a mechanical datasheet you don’t know the MMC of the various dimensions and if you are designing something that is packed it, the first part might fit and the hundredth part might fit but the next batch might not fit at all. Not knowing what the MMC is, give yourself room for other parts.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.