Author Topic: Advice req'd for reverse engineering a TTL logic PCB.  (Read 1546 times)

0 Members and 1 Guest are viewing this topic.

Offline wilfredTopic starter

  • Super Contributor
  • ***
  • Posts: 1252
  • Country: au
Advice req'd for reverse engineering a TTL logic PCB.
« on: May 31, 2018, 12:31:45 pm »
Does anyone have some advice and or links to places where others have tried to re-create a circuit from just the top and bottom images of a PCB.

I just want to pick up some ideas for what others tried and the software they used. I particularly want to know what seemed like a good idea but really wasn't.

Since it is a 2 layer board I expect getting both sides as transparent layers in a graphics package will be a good place to start.

I'm not looking to reproduce the PCB just draw up a schematic.

 

Offline TerraHertz

  • Super Contributor
  • ***
  • Posts: 3958
  • Country: au
  • Why shouldn't we question everything?
    • It's not really a Blog
Re: Advice req'd for reverse engineering a TTL logic PCB.
« Reply #1 on: May 31, 2018, 03:22:57 pm »
Some questions:
Do you have a decent hi-res camera, and some way to arrange fairly even illumination of the board for photos?
Are you familiar with using Photoshop?
Is it feasible to desolder and remove any components from the board, that cover significant numbers of tracks?

Here's a summary of how I do it.
Take photos of the complete board, both sides. Take pics from as far away as possible while filling the field, to minimize barrel distortion and parallax of tall components. Try to get the board as square-on as possible, but don't worry about minor deviations as you can fix that in photoshop.

Now remove all the components you can, get as much of the component side tracks visible as possible.
Take another photo (same setup) of the component side tracks. (Now you have three images.)
Make backups of the original images, and copies in a work folder.

Open all work images in photoshop. (I prefer an old photoshop ver 5.0 for this over newer CS-whatever. It's faster, simpler, and the text tool allows repositioning at the same time as text entry.)
Ensure all images are in RGB mode (NOT indexed colour mode - this doesn't stretch/rotate well.)
It's best to work with the original high-res images. Any down-sizing should only happen right at the end, for prints, etc.
Start with one of the images, say the PCB front side.
Copy it to a new layer, delete from the original 'background' layer. Make the background white, or 'nothing'.  Name the layer what it is.
Lay some guide lines along the board edges, to give ideal rectangular positions for the edges.
Use edit-->transform-->distort to grab the layer corners and stretch-squish the board image till the edges are right on your square guide lines.
Now select one of the other board images. Select-all, ctl-c to copy to clipboard.
Go back to your working image. ctl-V to paste in the new image. It will create a new layer. Name the layer, and change the transparency to say 50%.
Select the whole layer, flip it as required so it matches the first layer, then use edit-->transform-->distort again to get it exactly aligned to the squared-up layer below.

Now hide that layer, and go do the same with your third photo.

At this point you should have 3 layers, all square and aligned, and be able to adjust the relative visibility of the solder side, component side, and component side tracks-only layers.
Lock these layers together and write protect them if you can. You will likely never touch these again.
Make a backup!

You can use any of the mask/selection tools to delete off-edge background around the board image.
You can shift the colour tint of the various layers, to help differentiate them. Making the two layers that have mostly just tracks reddish and bluish helps.

Now create some other layers. Suggestions:
* A layer to stick swatches of various colours you use for annotations, track tracing, etc. So these stay with the file always.
* Track tracing 'done' layer.
* Component 'done' dots layer.
* Component number annotations.
* Your own working notes.
* Ground and power plane area shadings.

To create an initial schematic, I just use loose sheets of A4 paper, and a .5mm 2B pencil. Don't even try to maintain any kind of structure in the first phase. Just start drawing out bits of the circuit, as isolated drawn fragments. Make up net labels to link fragments, if can't easily use lines. Try to avoid dense line tangles.

The main thing is to be utterly fanatical about annotating your photoshop image with 'done' markers, at the same time as you draw each element on paper.  And on the paper, if a node/trace still has more to follow, make sure your paper drawing has a line extension showing 'more to follow' from that node.

If you could not remove all components, then you will have to use a multimeter to work out which tracks going under a component go to which pins or come out the other side. It's MUCH BETTER to remove large components. Small surface mounts with only one or two tracks under, are no problem. But still multimeter them to be sure.

I put connectivity lines along the screen tracks as I note them to paper, and dots on components (on screen.)
For a while you'll keep forgetting to switch active layers in photoshop. But after you mix them up enough, and suffer the pain of erasing correct stuff along with mistakes, you'll get in the habit of not forgetting.

A fine black marker pen to make notes on the PCB is nice too. For eg highlighting a particular track, noting power rails, etc.
But don't rely on this for node capture/marking. The marks wear off.

The reason I do first-try schematics with pencil and paper, is that one is juggling the PCB, turning it over a lot, with the PCB images on screen in photoshop. Yet another screen/window/keyboard plus the restrictions of a schematic editor, is too much. Pencil is easier, and also free-form. You can break up components however you like.

If the PCB has component designators, use them in your schematic. Otherwise make them up as you go, and mark them on the designator layer.
Actually, photoshop puts all new text strings on their own individual layers, as non-bitmapped fonts. Every now and then, collect all those into your bitmapped designator layer. This is a bit tedious: Hide all layers, then individually enable just the text layers. Make your designator layer currently selected. Then Layers-->Merge Visible. This collapses all visible layers to the one selected layer. Be VERY CAREFUL when doing this. One wrong click and your work is stuffed. Best make backup before.
Oh, and of course, backups should be running, sequentially dated and numbered. Not just one backup, or you will be sorry. Those old PS versions are fast, but have only one level of undo.

Once you have a lot of little islands of circuit across several sheets of paper, and you're pretty sure you have captured all the physical circuit, then it's time for the magic. Where you just look at it all until you understand how it works, and can (in one step, or several) end up drawing out a final circuit that makes logical sense and is laid out like a good designer would have drawn it originally. (If it's a complicated schematic, best to make photocopies of the original hand-drawn sheets, and highlighter pen to mark 'done' parts.)

It's really nice when you do this, using original component designators, and they come out ordered on the sheet as the designer would have initially numbered them.

Whether you draw the final schematic using a schematic editor, or just leave it hand drawn, is up to you. It shouldn't really matter, since you're not planning to rip off the design and make copy PCBs anyway, right?
Collecting old scopes, logic analyzers, and unfinished projects. http://everist.org
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Advice req'd for reverse engineering a TTL logic PCB.
« Reply #2 on: June 01, 2018, 07:04:57 am »
Wow, that's a long reply.

I'll sum up what I typically do. Take a picture or use a flatbed scanner to scan the board. If it's one with a lot of traces running under ICs I either xray it or remove the ICs if possible. Then I print out enlarged pictures that I can draw on to mark traces as I go, and start to draw up the schematic with a pencil and paper. Once I have the whole schematic then I start to look for identifiable structures, for example something as simple as a bridge rectifier can look really weird when it's drawn with the diodes all spread out. Then I start to re-draw the circuit in a more sensible and easier to follow style, often at this point I use the KiCAD schematic editor so I can easily move parts around and tidy it up.

Datasheets can be useful too, often the circuit ends up being virtually identical to the example on the datasheet.
 

Offline wilfredTopic starter

  • Super Contributor
  • ***
  • Posts: 1252
  • Country: au
Re: Advice req'd for reverse engineering a TTL logic PCB.
« Reply #3 on: June 01, 2018, 10:27:37 am »
Some questions:
Do you have a decent hi-res camera, and some way to arrange fairly even illumination of the board for photos?
Are you familiar with using Photoshop?
Is it feasible to desolder and remove any components from the board, that cover significant numbers of tracks?


Thanks for the detailed reply. I'll digest it properly a bit later.

I don't have access to the board. I only have photos someone else has taken and I am grateful to have them. So no removing chips or buzzing out tracks. I'll just have to do it the hard way. It dates from the 1970's so it isn't very densely packed and is entirely through hole.

I expect to get quite a bit more familiar with some kind of image editing package.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Advice req'd for reverse engineering a TTL logic PCB.
« Reply #4 on: June 01, 2018, 05:07:21 pm »
That could make it very challenging. I've encountered boards like that with loads of vias and traces running under ICs. It's extremely difficult to tell what connects to what if you can't access the board.
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Advice req'd for reverse engineering a TTL logic PCB.
« Reply #5 on: June 02, 2018, 02:13:45 am »
Here's one method I've tried with some success using altium. Any pcb package should do.
The circuit in question was a discrete analog board with transistors, resistors, diodes, capacitors etc
I created a library of components who's pcb foot prints are essential the same as the schematic symbol drawn on the top overlay with simple round pads at each terminal



I place components on the schematic in the same position as they are on the board, once done I start connecting them as I trace them on the actual board. It goes without saying that you need to markup everything on a picture of the board to keep track of where you are up to.
The schematic soon ends up as a jumble of lines so try and place the components with as much spacing between them as possible.



Here's the "magic". I now hit update pcb and all the components are thrown onto the pcb with a rats nest netlist



I now use the pcb editor as a schematic editor.
I can move components around to some kind of logical order. The rats nest lines created by the netlist from the schematic help visually to see where and what is connected together.
Another feature that helps is being able to cross probe between schematic and pcb and vice versa. For example I can select a bunch of components in the schematic which then selects them in the pcb view. I can then group them on to a part of the pcb and start placing, rotating etc until the circuit makes some kind of sense



For connecting symbols on the PCB I use 2 layers so I can cross non-connecting lines without creating DRC shorting errors. I also place pads or vias with no holes as junctions

« Last Edit: June 02, 2018, 02:19:24 am by AlfBaz »
 

Offline TerraHertz

  • Super Contributor
  • ***
  • Posts: 3958
  • Country: au
  • Why shouldn't we question everything?
    • It's not really a Blog
Re: Advice req'd for reverse engineering a TTL logic PCB.
« Reply #6 on: June 02, 2018, 05:14:17 am »
AlfBaz, that's a great idea! I'll have to try it.
One problem I can see, is with ICs. The 'PCB footprint' parts are going to have completely different pin arrangements from what you'd want for a schematic.

Also  you left out the part where you go from the 'PCB footprints schematic' to a proper schematic. Did you come up with an automated way to do that, or just redraw it by hand in the sch editor? Then compare netlists... I guess.
Collecting old scopes, logic analyzers, and unfinished projects. http://everist.org
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2184
  • Country: au
Re: Advice req'd for reverse engineering a TTL logic PCB.
« Reply #7 on: June 02, 2018, 06:24:55 am »
One problem I can see, is with ICs. The 'PCB footprint' parts are going to have completely different pin arrangements from what you'd want for a schematic.
I just tried it with something simple, in this case a dual opamp. It's a bit of a hack but this whole process is so meh.
The foot print is both opamps, push it to the pcb and then (in altium) explode it to primatives. To move it you then have to select a whole opamp section. A bit of a kludge but it seems to work

Quote
Also  you left out the part where you go from the 'PCB footprints schematic' to a proper schematic.
Good pickup ;D

Quote
Did you come up with an automated way to do that, or just redraw it by hand in the sch editor? Then compare netlists... I guess.
In this instance I didn't need to create a proper schematic as it was simply to understand the circuit for some mods but yeah i'd probably have to do it manually. There's an update schematics menu item under Design in altium but I've never used it so I don't know what it does
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf