Draw a footprint from a photo

I’m trying to create/edit a footprint for a micro USB connector. That thing needs to go on my PCB. I’ve ordered some on eBay and have them here for exact measurements and inspection. The closest footprint that I’ve found, USB_Micro-B_Wuerth_629105150521, doesn’t have the correct dimensions. The holes have the wrong width, height and position. So I need to fix that.

It’s really troublesome to do that one by one, measuring a distance with a digital caliper and trying to adapt the footprint. To help with that, I’ve made photos of the connector from two directions and scaled them on my phone screen to an even magnification (10x) so I can measure things with a simple ruler. Still it all doesn’t quite fit together. I couldn’t find a 3D model that looks like my real component so I could try to verify my footprint with a 3D model. I found one that’s close and matches the mentioned existing footprint, but it’s not like mine.

Wouldn’t it be a lot easier to use a perfectly orthogonal macro image and place it beneath the footprint so I could simply retrace the image with the holes and stuff? Map drawing on OpenStreetMap used to be really easy with that technique. But I can’t find a way to make KiCad footprint editor insert an image file.

How do you do that? You have a component and need a footprint for it. What tools do you use? Or does everybody here have expert skills and doesn’t even need to think about it? Or should I try to find a better fitting footprint somewhere in that internet? Or buy a different connector with defined dimensions for 100x the price? (This project is a prototype and nothing commercial.)

IMHO one of the most important tools for making footprints is the manufacturer’s datasheet. The datasheet should give dimensional drawings not only for the part but also for a suggested footprint (also sometimes called a land pattern).

This is one of the pitfalls of ordering parts from eBay (and also Amazon). It can be difficult to figure out who the actual manufacturer is and what is the specific part number for the widget you purchased. I suppose you could contact the eBay seller to see if they have a datasheet, but that might be a long shot.

There are probably hundredths of different footprints for USB connectors. Some vendors on Ali sell assortment boxes which have 50 different USB connectors. I assume the main use for these is phone repair shops. you just keep on trying until you find a connector that fits the PCB.

Just for completeness:
The best solution is of course to find a datasheets for your USB connector, then you can just take over some measurements from the datasheet.

Making measurements from photographs is not so easy to do right, but it it can be done fairly accurate.

Follow these steps:

  1. Lay your USB connector on a flat horizontal surface, pads up.
  2. Lay an (accurate!) ruler next to it. Preferably adjust it’s height, so the surface of the ruler is i the same plane as the connector pads you want to photograph. (This reduces parallel distortion).
  3. Use a decent camera. Take the picture from further away to reduce barrel distortion, and then use the zoom function to get more useful pixels of your connector. Do not make Macro photo’s. These have a lot of distortion over the area of the picture and are therefore useless for accurate measurement.
  4. Make sure you make the picture perpendicular to your object. This is the reason I told you to put the connector on a flat / horizontal surface. When you use such a big reference surface is much easier to make the photograph perpendicular from the top. Preferably use a tripod.

Once you’ve got a decent picture, then load it into FreeCAD with the Picture workbench. You can use the measurement ticks of the ruler that is also on the same photograph to calibrate the picture in FreeCAD.

After the picture is properly calibrated in FreeCAD, you can use the StepUp workbench to directly draw pads “over” your photograph. The photograph plane may interfere with the plane of your sketch, so I prefer to give the photograph a small negative Z value. Make sure perspective view is off in FreeCAD.

I have used this method to make measurements on a small gearwheel, which could almost not be measured with calipers or micrometers because it was to small. Measuring it in FreeCAD is easy. The accuracy you can get is mainly dependent on the quality of the photograph, so take some time to make this picture right.

[Edit] Simplified text a bit, removed link, because of @cflin 's remark. I’m not a photo fanatic and all these lenses drive me crazy.



Looks similar to these, but check with calipers:
https://lcsc.com/product-detail/USB-Connectors_Jing-Extension-of-the-Electronic-Co-920-A52A2021S10110_C40943.html
https://lcsc.com/product-detail/USB-Connectors_Korean-Hroparts-Elec-U-F-M5DD-Y-1_C91467.html
I drew a footprint for the first one some time ago: Jing_C40943.kicad_mod (5.9 KB)

All too often, the next time you buy from the same ebay vendor you get a different part.
Micro-usbs are particularly bad for this as many are custom parts for some specific model smartphone and over-runs find their way onto the site.

I agree that the original manufacturer’s datasheet is the best option. But if you only have a sample, you may do well to measure a mostly 2d object by producing a high resolution image with a scanner. I have done this (although the size was more like 5-10 cm) when I measured a bracket so as to replace it on my old lawn mower. If you scan with a high native resolution, you may be able to get accuracy to 0.001 inch for example. No promises but it may be worth a try if you have a scanner available. I have used an old HP3570c.

I think I produced the attached image with my scanner; one of several.

Hmmm,

Just how hard is it to make a USB footprint?
9? equidistant pads of a certain width and length probably in two offset rows: one 5 and the other 4
Maybe 4 more pads of a different size to secure the shield around the edge and a few thin rectangles on different layers to indicate the overall dimensions of the socket.

The footprint could probably be made in the time it takes to read this thread, let alone surfing the 'net for a footprint or data sheet, or diving into FreeCAD, or breaking out a camera or scanner.

Does the OP know just how easy it is to make a footprint with the Kicad tools?

JMHO,
cheers

I make footprints routinely, given dimensions from the datasheet. But what do you do if you have the physical component and cannot get a datasheet?

not for nothing, however… it was a poor decision to order a product with conflicting information. the title and the details are mentioning ‘mini’ that is a micro usb connector. they didn’t even bother to get basic data correct. that is a sign to keep looking. What i would do is a parametric search on digikey or lcsc like above and use the process of elimination while using photos as a guide to see if i’am on the right track. the part mentioned above looks pretty dead on “C40943”

making footprints are a significant part of the process. it isn’t that bad. i actually enjoy doing it while making a living out of it. however, i can see how it is not fun for everyone’s tastes.

hope it works out for you and just let this be something to watch out for next time your shopping. if it doesn’t have a actual part number or conflicting information, skip it.

Thanks for the find, they really do look just like what I have here. But my KiCad cannot open your footprint. There’s an error in the file.

Anyway, I sat down again and made a simple drawing of the relevant parts and wrote all required measurements in it. Then I modified the existing footprint so that it should match my measurements. I figued out that typing in the position numbers is easier than trying to drag things around in the designer. I made all holes 20–30% larger in diameter as this seems to be the case with other through holes for things like pin headers or terminal blocks. That digital caliper is surprisingly precise, all partial measurements sum up to the total. I hope I did it right. I’ll see if the PCB works.

Those tiny plastic pins at the bottom are very fragile. (Or a caliper is very rough.) While taking the third measure, one of them just broke off. Well, I’m not expecting to need them and if those two holes were wrong, I’d just break them off on purpose.

And yes, I’ll best order as many as I have PCBs (will be 20 for now). For the next production run (no plans yet) I’ll have to check again if I have the same components or need to update the footprint again.

Thanks for all your experiences and ideas!

PS: This is what I made:

The 5 pads may be a bit long but I think I’m going to need them for hand-soldering. That tiny size will be challenging! I only worked down to 1.2 mm pitch until now, this is 0.65 mm.

My footprint was made with the new V6 nightly, should have mentioned that. The plastic pins are for more precise positioning during automated manufacturing, if you do it by hand, they are not that important. To me, buying parts off eBay is not worth the headache, at least for jelly bean parts that cost pennies on LCSC and co, with guaranteed part number and datasheet.

Definitely buy some flux for hand soldering fine pitch. Electronics rework flux is often advertised as no-clean and works really well, but be aware that “no clean” also means “can’t clean”, even with alcohol. If you absolutely need to get this stuff back off, say for a high impedance analog circuit, you want traditional rosin based flux.

I completely agree with you if working on something professionally. But if you are working on a home project, the price is really good, and you will not have to apologize to anyone other than yourself if your plans go awry, it might be OK. These days some small 2 layer offshore made pcbs can be really cheap so you may not have a lot of risk.

Every once in a while I encounter a weird malfunction of a new board. Cleaning the board magically eliminates the probelm. I use solder and flux with mildly activated rosin core; never tried the no-clean flux. Sounds like a good warning. I suspect that unless you can maintain cleanliness in a good industrial process, the no clean flux might be a bad idea.

It is possible to draw a footprint from a part in hand - PaulVDH’s approach/advice is spot on. However, USB connectors are pretty cheap, even from mainstream distributors like Mouser/DigiKey. Why go to all the trouble when you can buy Q1 with a datasheet for well less than a quid/buck/euro. If you really want cheap, LCSC has them for pennies/pence/cents though shipping can eat up your savings.

Seems like a false economy to use undocumented components.

1 Like

That’s easy: If this component is all you need, you’ll pay 1 € for the parts and 20 € for the shipping. Welcome to the world of the hobby.

But most of us usually aren’t buying just one type of part so shipping get’s spread over multiple parts. Nobody orders just one connector or what ever. There are a number of things, like connectors, that I have standardized on for all/most of my projects. I order headers, USB connectors, screw terminals, etc in multiples of 10 or more.

To put it more succinctly, buy 60 $/€ worth of parts and 20 $/€ shipping. Then it doesn’t hurt quite so bad. And you probably needed other parts for your project(s) anyway.

In the US, shipping is usually less ($8 for a typical Mouser/DigiKey order) but ordering from China is more ($20-30). In the end, my orders from either are surprisingly close in total cost.

@paulvdh: Do you mean a telecentric lens?

https://en.wikipedia.org/wiki/Telecentric_lens

Are you having the board assembled or are you assembling it yourself? If you are assembling them yourself, just make the footprint close enough to fit. Fit it to the holes and if the pads don’t line up perfectly, rework it until it does. Then, cover everything with hot glue.
If you are making many boards and having them assembled, then you may want to get new parts with proper documentation if you are not confident in the footprints you create from measurements. Otherwise you will be making multiple PCB revisions as you refine the footprint to match the actual part.

You can also print out the connector footprint you created 1:1 and see if the part aligns reasonably well with the new footprint you created. You should probably always do this for connectors anyway to catch missing alignment pins, shorts to the connector frame, and reversed pinouts.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.