PCB Photography for Reverse Engineering

Поделиться
HTML-код
  • Опубликовано: 11 окт 2024

Комментарии • 46

  • @Graham_Wideman
    @Graham_Wideman 3 года назад +3

    Hi Kent. I've done a similar process a number of times, so I appreciated you taking the time to share your process! I was unclear why the need for taking multiple photos and then (laboriously) stitching them together, at least for reverse engineering. Could well be useful for inspection documentation, I suppose. If there's a concern about distortion, or about getting an unwanted partial side-view of components that are off-axis, then I would think that simply positioning the camera further way and using more zoom would reduce both those enough to avoid needing multiple images. For example, if you need three shots to cover the board as in this demo, then positioning the camera at three times the distance should accomplish the same improvement. Of course, at further distance, more light or longer exposure will be needed, but both camera and subject are stationary. Also, mounting the board in a rigidly positioned adjustable board holder would allow both front and back to be positioned flat relative to the camera, and at the same distance.
    Finally, as I'm sure you're aware, if you're going all out to reverse a board, then photos with the components on, and then with the components removed, really accelerates the process!

    • @kentvandervelden
      @kentvandervelden  3 года назад +3

      Thank you Graham, these are all great ideas! I make small instruments for imaging that move the camera, so I'm probably always in the mindset of scanning the PCB and stitching. It would coming back to this and incorporating your ideas and those from others here. I've thought of making a program for inferring nets from a unpopulated board, but fewer boards are amenable to this today. Maybe there is a historical value to imaging boards for discarded equipment. There are some very impressive examples of PCB REing on RUclips. I particularly enjoy surface grinding multilayer boards. (I read your note right away; sorry to take so long to respond.)

  • @kentvandervelden
    @kentvandervelden  4 года назад +8

    A huge welcome to the viewers from Hackaday!

    • @swolebro
      @swolebro 4 года назад +1

      I've got an older Osmo - have only shot a few videos with it so far, but it is definitely a big step up from any of hardware OIS, in-app software stabilization, or stabilization in post-processing. You're going to enjoy it.
      The one time I tried ffmpeg's vidstabdetect... Whooh. Nope. Nope nope nope.

    • @kentvandervelden
      @kentvandervelden  4 года назад

      Argh, the software. To piece together videos, I use Magix Vegas. It's stabilization was super fast but the result was worse than handheld. The result was only the center 1/3 remained, less shake, but looked like the video was of a flexible mirror that someone kept flexing. Some amusement-park mirror stuff. I tried Adobe Premiere, but that ran for hours and hours before I gave up. I'll check out vidstabdetect. Peace

    • @swolebro
      @swolebro 4 года назад +1

      Well, it sounds like vidstabdetect is going to give you more configurability than Magix Vegas, but the principal of the thing is going to be similar. As the motion vectors between frames grow, zoom the viewbox in, have it track the motion, and discard anything outside of the zoombox.
      When an app has built-in software stabilization, it's doing the same thing, only in real-time, and recording a wider viewbox to begin with, so it has extra to discard. So, for example, on the LG G5 I have, it *can* record in 4K, but if you record in 1080p instead, then you have the option for software stabilization, which is really doing 4K and cropping it down to reduce the shakiness. (And in a far less painful way than recording 4K and chugging through that in post...)
      I'd suggest giving the gimbal a shot first. Then you can mess around with ffmpeg if that's not good enough, or something like the LG G5 is already very old by now and available used for cheap.

  • @brainkod
    @brainkod 4 года назад +5

    This whole setup is so amenable to having it mounted on a 3D printer: stepper-driven precision image stitching with the board moving along with the bed, Z axis controlling focus at different focus planes to stitch tall components. There I said it, I bet someone is implementing it somewhere already :P

    • @kentvandervelden
      @kentvandervelden  4 года назад +1

      I like the way you think! :) I plan to revamp an XY camera stage that I previously made, to make it lower cost. The original was for photographing plants, but it should become a reusable module. Here's the original video if you'd like to take a look. Thank you for all your suggestions!
      ruclips.net/video/3pwe0BwWVpE/видео.html

  • @gorak9000
    @gorak9000 4 года назад +5

    Have you tried capturing the images using a flatbed scanner instead of a camera? That might help remove a lot of the lens distortion, and might make the alignment of the top and bottom a lot easier. There are some other tricks you can do to correct that using camera images (look into how to create a lens correction matrix, and using it on each image before you merge them), but I've been capturing high quality images of boards for long before digital cameras were decent using a flat bed scanner. I never thought to overlay the top and bottom images like this though! Depth of field might be a slight problem if there are high components, but scanners seem to be able to focus further off the glass sheet (wider depth of field) than you'd expect.

    • @kentvandervelden
      @kentvandervelden  4 года назад +2

      That's a great idea! For bare boards, it would work perfectly. Flat bed scanners are appealing because they have high resolution compared to fixed cameras. I've used flatbed scanners to scan plant roots suspended in water. The important and fine roots hairs were visible. Trouble comes when there is depth to the subject; scanners are extremely near sighted. At the time I did my root research, few scanners had adjustable focus, and so needed to be modified, increasing the cost of the scanner 50x. If I remember correctly, all the modification did was to adjust the focal point to be at the container-water plane instead of the platen-container plane. I still needed to squish the roots. Unless scanner tech has changed, the lack of depth of field could still be a problem. But bare boards would work well as would near-flat boards like cell-phone boards where the scanner's resolution would be greatly appreciated.

    • @janbeck8269
      @janbeck8269 3 года назад +1

      @@kentvandervelden there is exactly one line of scanners with software adjustable focus. The epson expression XL scanners. Models 10000xl 11000xl and 12000xl. Have been waiting for one to come up at reasonable prices on eBay to do focus stacking for pcb scanning.

    • @kentvandervelden
      @kentvandervelden  3 года назад +1

      @@janbeck8269 Ouch, added emphasis on "reasonable price"

    • @janbeck8269
      @janbeck8269 3 года назад +1

      @@kentvandervelden Definitely! However, a used eBay unit seems competitive with the price of your setup. I think the deciding factor may be whether one needs the camera for anything else. In any case, as soon another job come in that needs a PCB reversing I'll spring for one of those eBay units and see if the focus adjustment is sufficient....

  • @swolebro
    @swolebro 4 года назад +2

    Kent, since you've already got a CNC mill, you should consider putting that to use as well. I've done some surprisingly good tests using my plasma table as a large flatbed scanner - basically mounting the camera and taking photos at many points in a grid. This helped minimize any perspective or lens distortion, and was a fun project in over-engineering. lol
    For combining the photos, I was originally using the Python OpenCV bindings, but found their API for merging to be a little lacking. Many of my images lacked strong detail, so while I knew where they should go in relation to each other, I didn't have any way to provide those "hints," and then the underlying library would just do a best-effort guess (and poorly, due to the lack of detail). The C++ API *does* have that ability to add hints, but I didn't go down that rabbit hole.
    In the end, I found that that machine's motion was precise enough that I could crop a fixed-size rectangle out of the middle of each image, slap them side by side as arrays, and call it a day.
    Photoshop does seem to do a better job at merging than my hack job with OpenCV, but the fixed-grid approach might avoid those small boundary quirks.

    • @kentvandervelden
      @kentvandervelden  4 года назад

      I love the idea and I promise to get to this. Did you post a video on your router scanner? My mill is a bit shaky on its small base, but I have a fairly fast global shutter camera that might allow images to be taken without stopping and avoid dwell time. Would be cool to also consider how see the component from different angles, from different positions of the camera, could be used to create a height map.

    • @swolebro
      @swolebro 4 года назад +1

      ​@@kentvandervelden I never did get around to putting together a video on that, because, as I'm sure you know, putting a project on RUclips makes it take 10x longer.
      I tried the photos in two different ways.
      1. Moving along a grid with sufficiently long dwell times and taking photos with a bluetooth shutter button. This works, but is a PITA, and if you miss a photo or get a bad one, it's no fun.
      2. Recording a video, and still pausing at each increment. It's not as high quality, but you can do it unattended. The trick here was to dump frames as images (after the fact), then find the ones were the gantry was paused and the camera in focus. OpenCV's Canny edge detection made that easy, since a moving/shaking/out of focus frame detect very few edges, and a stationary one would pick up 10x more.
      If you wanted to get fancy with it, and control everything in one process (camera shutter, discarding blurry shots, moving the machine, etc), I seem to remember you've had some good videos on that. Hahahah.

    • @swolebro
      @swolebro 4 года назад +1

      @@kentvandervelden Also, general pro-tip. If you're using an Android phone, there's an app called SimpleSSHD that's great for file transfers. It's not the fastest method, and you'll be woefully disappointed if you try to actually use the remote CLI, but being able to `scp` is very convenient.
      Even better, `sshfs` works as well.

    • @kentvandervelden
      @kentvandervelden  4 года назад

      Thank you, that's a great suggestion about determining focus. I may work on a lens with mechanized focus and have been thinking about estimates of focus. I was thinking of focus as a global property (e.g., compressibility) but your method would highlight areas of focus, which would be useful for scanning range of focus for stacking. That's another set of algorithms to look into. Have a great weekend!

  • @jotatsu
    @jotatsu 3 года назад +1

    Don't know if presented in a latter video, but the 3 pcbs i RE i took 3 set of photos, back front and front without the components (i remove them in a hot plate). Then i use Sprint Layout 6 and route them as back front and silkscreen. For a very dense 2 sided audio pcb i used a very intense light behind the pcb on top of cardboard cut, so a total of 5 photos (back, back iluminated, front, front iluminated and components on board).
    Sprint layout is paid, like 50 bucks, but i dont mind, it is very simple and intuitive to diagram the pcbs.

    • @kentvandervelden
      @kentvandervelden  3 года назад

      Thank you, I'll check it out. Back illumination is great idea!

    • @kentvandervelden
      @kentvandervelden  3 года назад

      Should be possible to do the same import of images into layers into other programs? I'm slowly moving from Eagle to FreeCAD.

    • @jotatsu
      @jotatsu 3 года назад +1

      @@kentvandervelden No idea about freecad, i only use it in simple modelling for 3d printing. SprintLayout let you do 2 images at the same time. Currently i'm testing easyeda, apparently it let you import up to 7 layers of images.

    • @kentvandervelden
      @kentvandervelden  3 года назад

      @@jotatsu Sorry, meant KiCad. (Suggesting FreCAD was probably confusing :)

    • @Graham_Wideman
      @Graham_Wideman 3 месяца назад

      +100 for using the hotplate. Just heat the board above solder melt temperature. Then you can knock all the components off at once by turning the board upside down and flicking it against some fixed obstacle. Very satisfying!

  • @mbsingh4597
    @mbsingh4597 2 года назад +2

    Hi Guys, Is it possible to create a new set of PCB if I have scanned images of both sides of the unpopulated PCB? Where can I find the process and if you can suggest the software for the process? Thank you.

  • @filipenicoli_
    @filipenicoli_ 3 года назад +2

    Hi Kent! I'm planing my undergraduate thesis on the subject of PCB reverse engineering using image processing. My goal is to create something that could replace the alignment and "background" removal process you do in Photoshop, then let you name each pad and automatically follow every track to every other pad, even through vias. Would you be interested in chatting about it, suggesting features or helping with hi-res PCB pictures? Thank you!

    • @filipenicoli_
      @filipenicoli_ 3 года назад

      By the way, I would have to use unpopulated boards for the input, so that might set you off. I'm also considering taking pictures from different parts of the electromagnetic spectrum (Infrared) hoping I can get through the soldermask and silkscreen. If I can't, we would have to sand down both to get a clear picture.

    • @kentvandervelden
      @kentvandervelden  3 года назад +2

      Hi Filipe, sounds like a great project for your portfolio to show employers. Maybe your university has an x-ray core facility that would be willing to get you some interesting data to work with. Check existing literature and patents. There's some good stuff on Hackaday and DEFCON. Shoot me an email, glad to help where I can.

  • @davidwillmore
    @davidwillmore 4 года назад +1

    I wonder if Hugin would do a better job of this. You can set control points which are the same on multiple images and it will do whatever transform necessary to keep them all aligned.
    Seems you are using a lot of time to correct the flaws that Photoshop introduces with it's stitching method.

    • @kentvandervelden
      @kentvandervelden  4 года назад

      Thanks David, I'll try Hugin. I've never heard of it before you recommended it. I would have started writing something with OpenCV :)

    • @davidwillmore
      @davidwillmore 4 года назад +2

      @@kentvandervelden I first used it over a decade ago to do some extreme HDR and then some 360 panorama images. I keep hearing about improvements, so I assume it is still in active development.

  • @kingleo6329
    @kingleo6329 2 года назад

    Hi Kent, I appreciate your generosity, but what if I want to reverse a multi layer pcb?! I have heard of some x-ray photography and stuff like that, but do they really work?

  • @timredding6130
    @timredding6130 4 года назад +1

    Have you ever tried the kind of Orthophotography stiching software used for drone Mapping? It might reduce warping you have to correct and make things easier.
    I dont know if it woud work here but it might be worth a shot.

    • @kentvandervelden
      @kentvandervelden  4 года назад

      Hi Tim, please recommend a program to try and I'll check it out. I appreciate the suggestion. Getting access to people's ideas from domains I don't know anything about (e.g., drones) is a wonderful reason to share project videos. Thank you.

    • @timredding6130
      @timredding6130 4 года назад +1

      @@kentvandervelden I myself have only tried open drone map. And it has been a few years since.
      Autodesk (ReCap) and Agisoft (PhotoScan) have some commercial solutions for photogrammetry with Orthophoto output option.
      Both offer Free trials and are probably a lot more versitile.
      You should probably try one of them to see if this usecase is feasibile.
      There is a ton of other software out there if you search for the terms "photogrammetry" and "Orthophoto" or "orthophotograpy".

    • @kentvandervelden
      @kentvandervelden  4 года назад

      Thank you, I'll give them a try. I tried the Autodesk and Agisoft software last year for 3d photometry from images of plants, the green type... that didn't work so well, but the 3d photometry recommendations use plants as an example of the worse possible application :)

  • @esakkiappankalaiarasu290
    @esakkiappankalaiarasu290 3 года назад +1

    Hi sir... I need reverse engineer software for pcb

  • @davidwillmore
    @davidwillmore 4 года назад +1

    Are you using mirror lock up?

    • @kentvandervelden
      @kentvandervelden  4 года назад +1

      Hi David, the 80D's mirror remains up during live view or remote shooting. I'll try Hugin, it looks very promising. Thank you for the suggestion.

    • @brainkod
      @brainkod 4 года назад +1

      I'm using LV (LiveView on my D5200)... afaik that locks up the mirror as well plus I get to see the image/focus live as well :)