Instructables

How to reverse engineer a schematic from a circuit board

Featured
This project is a result of needing to service a domestic electronic item without being able to obtain a circuit diagram.

The process proved to be very long and painstaking, but also very rewarding.  The steps presented here are not exact, and you will no doubt find your own way of working which is more effective in the case of any particular board.  However, I believe the basic procedure is essentially correct for the majority of boards which are too complex to reliably hand trace. Without the need to invent the process, things should progress more quickly.

For simple boards, it is probably better to use pencil and paper to draw the board onto squared paper, replacing components with their symbols, and changing track crossing places to avoid components.

For complex boards, it is too easy to lose your place using this method. The next "level" of complexity from a simple, drawable board, would probably be a good candidate for the tracing methods described in step 16 of this instructable, missing out all the image editing procedures, and modified accordingly.

At a higher level of complexity, as on the board shown in this project, I decided there were too many tracks for hand tracing to be reliable, and used the graphical techniques described. These methods arise partly from the photographs I took being too unevenly lit and inadequately sharp.  Better photos means less work.

All the editing was done on a laptop running Linux. Windows versions are available of the main tools, Gimp, Inkscape, AutoTrace and Dia, but I don't know if a Windows version is available of the utility pstoedit, needed for an unfortunate extra workaround step. I'm sure another workaround can be found, if it isn't.

I also discovered as a result of this project that completely hidden traces can exist - in my diagram there is a transistor with it's base apparently unconnected, but I can't find a connection or through hole for it. I assume it's completely hidden in some way.

I'm pleased to say that after creating the diagram, I was able to use it to confirm the suspected faulty part.

Addendum: since writing this instructable I have discovered there are such things as "blind vias" - where the hole only goes part-way through the pcb and is connected to an inner layer only. It would appear that the board I worked on here utilises these, as a number of components appear to be missing connections. I believe, unfortunately, that these are hidden in the SMD pads themselves, so impossible to find without de-soldering. So if you end up with an incomplete looking schematic, that could well be why. Google for "blind pcb vias" to learn more.
 
Remove these adsRemove these ads by Signing Up

Step 1: Tools and equipment

You will be working from photographs, and need some software.

You need:
*  A good camera, preferably with a tripod
*  Even lighting - a badly lit picture will cause a lot of extra work.  A bounced flash is only just good enough.  A ring flash may be your best option if you have access to one.
*  A computer
*  Internet access, to look up components (but see note)
*  A multimeter - not essential, but helpful (depending on how precisely you need to know how the circuit works, if you are dealing with SMD's, the ability to measure capacitance could prove useful)
*  A strong magnifying glass - you may need to check details which you can't make out from the photos.
*  A photo editing program.  I use the Gimp, which is free, and these instructions are Gimp-specific.  I also used the vector program, Inkscape, to clean up the lines.
*  A program to turn the photo into a vector line-drawing.  I use AutoTrace, which is free.  I chose AutoTrace specifically because it has a "centre-line" option, originally designed to help pick out text in an image, but ideal for this job.  I found AutoTrace picks up too much detail to be useful for general cleaning up though.
*  A program to manipulate vectors.  I use Inkscape, which is free, and these instructions are Inkscape specific.
*  A program to draw manipulate diagrams.  I use Dia, which is free, and comes with an excellent set of component symbols (but see caveat, in step 18)
*  As the current version of Dia has a problem importing svg files, and an intermediate program, pstoedit, was needed.
*  A graphics tablet is a big help, I discovered, especially for hand-tracing some of the tracks.
*  Lots and lots of time and patience...

A note about finding datasheets on the internet.
It's an absolute blessing that data for components is widely published on the internet.  However, component markings are not necessarily complete or clear, and you should study the context of the device to make sure you have identified the device correctly.  For example, on the board I used in this instructable, there is an 8 pin chip identified "7101".  I found datasheets for an opto-isolator, an op-amp, a voltage regulator, and other devices before discovering that is almost certainly a DC/DC converter, confirmed by an inductor being connected as shown in the example circuit. SMD components have markings that may bear no resemblance to the part number. There are several guides published on the internet, this is one of them: http://elektronik.googlecode.com/files/SMD_Catalog222.pdf

Step 2: Getting photos

Clean the board, at very least a quick brush with a paintbrush.  Any specks of dirt, hairs etc will have to be removed in your photo editor if you don't catch them now, and it there are many, this can be quite time-consuming.

If you have a tripod, and you can control the lighting, set everything up.  You need to light the most boring picture ever.  It also probably has to be quite close up, depending on the board.  Select a plain background which gently contrasts with the board colour.

Take your time, set up the shot so that there is no perspective, or as little as possible, and the frame is filled as much as possible.  Use RAW mode if it is available, otherwise just use the highest quality setting possible.  Take pictures of both sides of the board, ensuring that the tracks are in focus.  You may find it is better to photograph the board in sections, and work on it a piece at a time.

Take a few pictures, with different settings, so you can choose the best ones.

If you don't have a digital camera, you will have to scan your photo's.  Again, use the highest quality possible.

Step 3: Clean up the photos

Set up a directory for the project (I like to name the folder after the device I'm working on), stick all the photos in there, and copy the ones you want to use into a sub-folder - I call mine "working".

Start with the solder-side of the board (although with SMD's, there's not going to be much solder there).  Open the picture in the Gimp, and save-as something meaningful, like solder-side-clean.xcf, for example.

Flip the picture - otherwise it won't match the component side.

Set up a vertical guide.  If the board has a ground-plane, align it to that, otherwise just use the edge of the board or a long straight track.  Rotate the image slightly so that the board or ground plane or track is aligned all the way down. (Of course, a horizontal guide may work better for you)

Set up a second vertical guide, and a pair of horizontal guides, aligned with the other edges (or ground-planes, or long tracks) of the board.  Use the perspective tool (toolbox: right hand edge, third tool down) and click each corner of the board you need to line up, and just drag them so that the other edges are parallel to the guides.

Make a rectangular selection around the board, invert it, and press delete.  This will clear the background.  Get rid of any other distractions like projecting connectors by selecting around them and deleting.  Don't mess about with the fuzzy select tool for things like this, just use the rectangle and ellipse tools.  You can make compound selections/de-selections with these to make complex shapes.

Get rid of any artefacts using the clone and blur tools as appropriate.  To use the Gimp's clone tool, press ctrl when you click the area you are cloning from.  A useful trick with vertical and horizontal PCB tracks is to set a guide over where you want to clone from and to.  The clone tool will snap to the guide.  If you have tracks set at a 45 degree angle, rotate the layer (toolbox, 3rd row, 3rd tool along) by 45 degrees, and you can use the horizontal and vertical guides again. (You may have to enlarge the canvas to fit the picture)  Rotate the board by -45 degrees to put it back how it was.  Use the same trick for other known angles.

Okay, so you have a nice clean picture to work on.  From now on, the general idea is that the picture contains a lot of detail, most of which you don't want.  The detail you want to keep needs to be separated out and kept as discreet images, so the next few steps concentrate on these two ideas.

Before you go any further, it is worth saving the image as a .png and opening it up in Inkscape.  Click the image to select it, the go to Path > Trace Bitmap...  Experiment with all the methods and see if you can get a an image where the edges of the tracks are nice and smooth, from that.  If not, at least you will get a good idea of what you are up against.  If you get a clean image, work on it instead of the original. You still need to pick out holes and remove ground planes and substrate, but it should be much easier to work on due to having the edges of the tracks smoothed out.

Create a new layer, and make sure it is active. This will contain your alignment marks.  Being on a separate layer, they will be easier to copy to the other layers.

Put borders at the corners of the board to make it easier to align the images later.  To do this, make a square selection at each corner, then make another square selection the same size but shifted inwards a bit, using subtract mode.  Fill the selection using the bucket fill tool.  I didn't do this and found alignment without corners to be tricky. You could use any alignment marks you like of course, corners is just what I thought of.

Step 4: Rescue the holes

You need a picture of the holes/solder pads in the board to align the various images and make sense when you get rid of the holes later.  This is especially important if you have taken pictures of sections of the board.

Depending on the individual circuit board, you may have to find a different technique that works for you.

It may be easiest to just paint them in.  Create a new transparent layer (Layer > New Layer) and ensure it is active.  Choose a brush about the same size as the pads, and dot over each one in some colour you like.

If the pads are copper coloured on a green board, as in the example, open the channels dialogue, and turn off the green and blue channels.  With a little bit of luck, you will be looking at just the pads.  If not, you have a bit more work to do - see next paragraph for details.  Go to Layer > New from Visible.  Turn the blue and green channels back on.  Add a new layer and fill it with red, and change the red layer's mode to Darken Only.  You might want to repeat the process with another red layer.  Delete any layers you are no longer using, such as the red layer(s) and the first New from Visible if you created more than one.

If turning off the green and blue channels did not make the holes/pads clear enough, go to colours > components > decompose...  Select HSV and click OK.  When the new image appears, copy the "hue" layer and paste it as a new layer (edit > paste as > new layer) into the image you are working on.  It should be the top layer.  Set it's mode to "subtract".  With a bit of luck, you should now have clearly visible, if a bit dim, holes.  Resume the procedure above.  Again, the exact result will vary depending on the board you are working on.  Try different decompose modes/layers if "hue" does not work you.

With the New from Visible layer active, use the select by colour tool (toolbox, top row, second from right) to select the pads, adjusting the threshold as necessary.  Copy the selection.  Create a new transparent layer, set it active, and paste the selection.  (You will need to "anchor floating selection" in the layers window).  You can now delete everything except the layer with the holes/pads in it.

If this method does not work well for you, experiment with layers consisting of grayscale and inverted copies of the background, different coloured layers, turning channels on and off, and layer blend modes.

You may find that if the lighting is too uneven, you need to use one method on one part of the board, and a different method on another.  Make a selection of the part you want to work on, create a new transparent layer, and paste the selection into it.  All the parts will be visible through the transparency as you build up the layers.  If you find all this is taking too much time, manually dotting the holes is probably quicker.

Find any bits of track or other artefacts that are showing through and erase them.  The dots that are left are now your place-holders for every through connection on the board.  Copy the alignment marks to the layer if you are using them, and save a copy to a new .png file.  Call it something meaningful, like solder-side-holes.png.  Finally, delete all the layers in the original file except the one showing the holes you rescued.

Step 5: Circle the ground plane holes

When it is used in the centre-line mode, Autotrace turns pcb track pads into little loops.  It is necessary, therefore, to remove them.  Since we are going to delete the ground planes, some way of identifying where they are connected is necessary, so putting circles around them seems to be the way.  There is a simple manual way to do this.

Create a new brush.  Do this by creating a new image (File > New > height 64 width 64 > advanced options > fill with transparency).

Elipse tool (toolbox top row second icon) and set it's aspect ratio to fixed 1:1.

Draw a circle in the new image so it fill the box exactly.

Shrink the circle by about 5 pixels (Select > shrink)

Stroke the circle (edit > stroke selection) - use a line of 7 or 8 pixels

Save the file with the .gbr extension, in (for Linux users) ~/.gimp-2.6/brushes (the default export settings are fine).

It's worth doing a "+" and "x" brush whilst doing this - see next step.

Restart the gimp.

Now open the file you are working on, and create a new transparent layer.  Ensure you are working on this layer, and use your new brush (you will need to scale it) to dot a circle around every hole which is plated through the ground plane.  Multiple or really awkward holes, you can draw a rectangle or free selection around, and stroke selection as you did to create the brush.  Try not to overlap the edges.

Copy the alignment marks to the layer, turn off the visibility of everything except the circles you drew, save, and save a copy to a new .png file.

Step 6: Mark the free holes

A multi-layer board may have some pads which don't look to be connected to anything.  If so, they probably terminate some through plating which connects the other side of the board to an inner plane or track.  You need to mark these "free" holes another way so you can relate them to the other side of the board later on. I have read that these inner layers are often used for ground and power planes, so shouldn't be too hard to trace when you've done everything else.

Create another new brush in a cross shape - use the guides to help you.  You may want to create a "x" shape and a "+" shape, which can interleave slightly.

Repeat the procedure you used to circle the ground-plane holes, only this time only put an x or a + over the free holes.  This way, the centre of the mark still shows where the holes go.  I made these brushes by making triangular and rectangular selections on a 64 pixel square canvas, stroking them, then erasing the outer edges, however I have since realised you could probably use a text "x" and "+".  Put a circle selection around the "x" the full width and height of the canvas, invert the selection, and delete the ends of the arms, so that it is not disproportionate to the "+".

Copy the alignment marks to the layer, and save a copy to a new .png file.

Step 7: Remove ground-planes

For the purposes of a schematic diagram, there is not much difference between ground-planes and the substrate.  Since you marked the free holes and ground-plane holes you can also remove these.

Note that if you are dealing with a 4 layer board, the internal layers are likely to be ground plane and power plane.  Any through plated holes which do not connect to anything you can see are likely to be connected to a power plane, however, this is no way guaranteed to be the case, as there may be other traces hidden away in there.  Hopefully you will be able to work this out at the end with the aid of a continuity tester.

Use the fuzzy select tool to select each ground plane area. You can also fuzzy de-select, fuzzy add-selection and fuzzy intersect-selection.  If fuzzy select is too uneven, use the circle, rectangle and  free selection tools.  It's easiest to use the free selection tool by creating a series of straight lines by clicking and moving.  When you click the first spot again, it will close the selection.  Before then, you can click and move any of the points you selected already.  You can also draw freehand with it, though I find this too uneven.  Grow the selection by one or two pixels (more if you have wide gaps between the tracks) to ensure there are no missed bits  - this will also clean up the edges a bit (Select > Grow) and save the selection to a channel in case you need it again (for example, if you have to start over).  Make sure you don't pinch out any bits of track, though.  Press delete to clear the selection.

Repeat for each ground plane area and the free holes, until they are all clear.

Step 8: Painted areas

I found large painted areas to be the most problematic to deal with.

First you need a way to see through the paint. 

Copy the image to a new layer, and desaturate it.  Choose luminosity.  You will probably see a fair bit of detail already.  You can bring this out a bit more by changing the layer's blend mode - I found "burn" to be particularly good.  Adjust the layer's lightness (Colours > Hue-Saturation) to bring out more detail (this is more effective than using brightness/contrast).  Ensure the layer you are actually working on is active, and select any painted ground plane and substrate areas you want to remove.  Save the selections to a channel, and delete them.  You may also be able to use the clone tool to paint tracks over these areas, however be careful not to paint in tracks that aren't there!

I also discovered that a very clear, but somewhat rougher at the edges, view of the painted area detail can be obtained by decomposing to HSV (Colours > Components > Decompose > HSV) and viewing the saturation layer.  It may be worth copying this to the main image as a layer, and experimenting with brightness, inversion, and modes.

You may find it easiest to make the selections for these areas by using the manual selection tools rather than the fuzzy select.  I found it easiest to select the whole area, then isolate the bits I wanted to keep by de-selecting them.  Always ensure the layer you are working on is selected, not whatever layer you are using to see the detail, otherwise your hard work will be lost.

Step 9: Clean the tracks

You are almost ready to process the image using AutoTrace!

You need the tracks to have good clean edges and smooth colour, or else AutoTrace will put in all sorts of details that you don't want and probably didn't even see, since it traces a little bit too well.

I spent many, many hours trying to do this by selecting areas of track or substrate with the fuzzy select tool and using some method to smooth the edges.  If you are interested in reading a discussion about methods for doing this, please see this this thread: http://registry.gimp.org/node/14912 .  I found that any method that gave me something like a smooth edge also led to rounded off corners and pinched off track ends.  The idea was that I could then use the bucket fill tool to even out the tracks and substrate.

The best way to smooth out the unwanted detail is to trace the image using a different tracing program - I used Inkscape, which unfortunately doesn't also offer centre line tracing.  Some cleaning up still needs to be done first though.

Smooth out the fine detail using the selective gaussian blur tool (Filters > Blur > Selective Gaussian Blur).  What this tool does is apply a blur which is limited, or "fenced in" by areas of high contrast.  You can also use the wavelet decompose tool and delete the top (fine detail) layer, however this may also remove details you want to keep.

I used a high radius of 30 pixels, and a max delta of 29.  These figures will likely be different for you.  I found these by setting a very high blur radius, turning up the delta until all the detail disappeared, then turning it down again until I could see the tracks clearly, then turned down the blur radius to a saner level, judged from the sizes of the tracks in pixels.  Press OK.  You should now find any "blockiness" in the tracks has been blurred out, but they are still clearly tracks.

Use the eyedropper tool (toolbox, 2nd row 3rd icon from left) to pick an average colour from the remaining areas of substrate. If the lighting is uneven, pick one of the lighter areas (probably not the lightest though). Set a few pixels spread for the eyedropper. This will set the foreground colour.

Create  a new layer, setting it to be filled with the foreground colour, and move it below the layer you are working on.  Most of the substrate should now be indistinguishable from the newly created background.

Create a new layer from visible.  You should probably save this layer as a new image.

I found at this point I could see quite a bit of spread due to optical aberration at the edges of some of the tracks which were very close together, so I set guides along them and used a small soft brush to paint background colour along these.

I also painted in the track holes in the track colour, but I'm not sure that this is necessary - it may be sufficient just to remove the dot of the actual hole in the middle.

Manually do any other cleaning up at this point.  Don't worry about light coloured marks on the actual tracks, or dark ones on the substrate, as these are going to get burned out.

Step 10: Reverse and burn out

You probably have light coloured tracks on a dark background.  What autotrace needs is dark tracks on a light background.

Desaturate the image, that is to say, turn it into greyscale (Colours > Desaturate > Luminosity (or whichever works best)).  Next, invert the image (Colours > Value Invert).

If you have a really clear, evenly lit, well focussed picture, this may be adequate, in which case you can go on to the next step.  Otherwise, read on...

You need to burn out any detail on the background, which is now light gray or something approaching white, and "dark out" any detail on the tracks, which are now dark gray, or something approaching black.  If the picture is badly lit, as mine was, this will by now be very obvious - but it just means you have to work in stages.

To do this, you need to set new black and white points for the image.  If you have any area which is very different from the rest, isolate it with a large selection, feather the selection by a large amount (Select > Feather) such as 50 - 100 pixels, and work on it first, so it looks similar to the rest of the board.

Choose the levels dialogue (Colours > Levels).  Near the bottom of the dialogue, there is a button marked "Auto" and 3 eye dropper buttons.  The eye droppers are to pick the black, grey and white levels.  Click the dropper for the white level, and click an area of the original substrate, if you can see any, which is a bit darker than the rest.  Don't use the darkest area as this may be too similar to the lightest track area.  Click the dropper for the black level, and click an area of track which is lighter than the rest, if you can find any.  Don't use the lightest area as this may be too similar to the darkest substrate area.  Click OK.  Repeat as often as you need to to get nice black or nearly black tracks on a nice white, or nearly white, background.  Choose areas carefully to ensure that no tracks get blurred together or pinched through.

If you find that some area you did has become harsh and jaggedy at the edges, undo until it looks right again, and work on the remaining areas of the board by selecting and feathering as described above.

Paint in/out any unwanted details like writing, artefacts and the dots in the holes if you can see them.  You may find some bits of track have become blurred together or pinched through - paint in repairs with a soft brush.

Copy the alignment marks to the layer, and save a copy to a new .png file.

Step 11: Smooth the edges

You can try skipping this step, however you may find that AutoTrace traces a bit too accurately, and you end up with a mass of fine lines. If that happens, you need to do the following.

The edges of the tracks will still look quite rough.  The best way to clean them is to trace the image in a vector editor program such as Inkscape. The tracing can then be exported as a .png.

In Inkscape, open the file you made in the last step. Don't worry about it fitting the page. Click the image to select it (black arrows will appear around it). Open the tracing dialogue (Path > Trace Bitmap). You may need to have a few goes at it. Try the defaults first before playing with the settings.

If you click the image, you will find you can drag the tracing and the original bitmap. Delete the original. The image you now have is made of vectors, which you can click and move around and deform individually. If you are unfamiliar with vectors, take the opportunity to have a play. You need a bitmap image to work with, so export the file (File > Export Bitmap). You'll see a lot of scary looking numbers, but you shouldn't need to change anything except possibly the save directory and file name. Click "Export".

Open the file in the Gimp and examine it carefully - you may find spots merged together or pinched off, and will need to paint in corrections to these.

Step 12: AutoTrace

Picture of AutoTrace
This is what all the work so far has been leading up to.  You are going to use AutoTrace to turn the collection of fixed lines, into a collection of moveable and connectible lines.  These will become the lines of your initial schematic.

If you are using Linux, or some other 'nix, for the files containing the tracks, run the following command:

autotrace -despeckle-level 5 -centerline -line-threshold 4 -output-format svg -output-file filename.svg filename.png

The important options are:
-centerline
-output-format
-output-filename

Note the American spelling, "center", of "centre"

I used the despeckle level setting for a file which hadn't been first traced in Inkscape. If you included this extra tracing, you probably won't need it (but it won't hurt, either)

Sorry I don't know how this will look for a Windows user.

I suggest you read the manual page for this program, it has quite a few options to play with, and you should try running it with various alternatives.  The important one to use, and the whole reason for using AutoTrace rather than the tracing tool in some gui program, is the centerline  option, which draws a single bezier line down the centre of each area, instead of tracing around it.

Open each attempt in Inkscape until you find something you are happy with.  Delete all the attempts which you are not happy with.  Record the version of the command you used, somewhere.  Add a layer to the drawing, and paste into it the holes picture. Select the image of the holes and scale it so the dots line up with the ends of the tracks. Save the file.  Use the break apart and snap together tools to fix any sections of track which have gone wrong.  Save the file.

Step 13: Component side

You should be pretty aux-fait with the methods now, however with the component side there is an additional layer of complexity, namely the components.

For an SMD board at least, the detail is too fine for manipulation of the entire image to be useful, so you need to do a lot by hand.  You are likely to need the actual board to hand, and possibly a magnifying glass and continuity tester.

Open the picture you chose to use for the component side, and save it as a .xcf file with a meaningful name.

Open as a layer, the picture you created of the all the holes.

Ensure the layer with the component side is selected, and use the scale, rotate and perspective tools to adjust it so that the holes you can see line up with the holes you captured from the solder side.  Chances are it won't match exactly. My board is slightly bent, so the alignment was a little bit off in the middle.

You need to create a picture of the components, a picture of the tracks, and pictures which identify any "special" holes.

If you wish to isolate the component identifiers marked on the board, do so now.  Click the little red square in the corner of the main image window to turn on the quick mask - the picture will fill up with transparent red.  Paint white to erase the mask from the writing.  Just do it in blocks, don't try to follow the lines of the letters.  Toggling the quick mask (click the little square again) will turn the bits you painted into a selection, and copy to a new transparent layer.  Use the "levels" technique described for making the tracks stand out, selecting the text and an area of track (assuming the tracks are lighter than the substrate) for the black and white points.  Paint in any bits that get pinched off.

Step 14: Fill in the substrate

In my picture, everything was a bit blurry, so I decided to paint in the substrate first.  This leaves the tracks much easier to follow and the components better defined.  Also, this helped clarify areas which were in shadow.  With a sharper picture you could probably do this with the Bucket Fill tool, set to "fill similar colours", but after I used this a few times I decided to make manual selections and fill those, which also conveniently obliterates the painted markings.

First of all, create a new transparent layer to work on.

As most of the substrate on my board is in square or rectangular sections, the method I used was to use the rectangle tool to select an area of substrate including pads and one or more components within it.  Then I deselected the component, pads and tracks.  I used the circle and free-select tools as necessary.  I then used the bucket fill tool (set to "fill whole selection) to fill the area with black.  Use the layer rotation trick with the guides to select diagonal areas.  You will have to save the selection to a channel if you do this, and clear it before rotating the layer.  You can then turn the channel into a selection and rotate it to match. If you have a steady hand, you could paint in these areas with a brush tool.

Use the selection tools most appropriate to the board.  Don't worry about trimming edges off the tracks if they are a bit fuzzy, however don't be tempted to "edit" the board layout at this stage, as it may lead to confusion later on.

If you have a good picture, there may be no need to do this.

Step 15: Isolate the components

You will eventually need to replace the components with their symbols, but for now, isolate them into an image of their own.

The easiest way to do this for SMD's is with rectangle and circle select tools, however you may find it better to use the quick mask and a brush tool, described previously.

Invert the selection, copy it (ctrl-c) and paste it into a new transparent layer.  Save this layer as a new .png file.  Save the selection to a channel (in case you stuff things up) Delete the selection from the base image.

Try to work out where the tracks went that are hidden by the components, and paint them in using the same colour as the tracks you can see. This is where a continuity tester will prove useful. Find datasheets for the components, the sample circuits may help work out what goes where.  Use the guides to help you, and use the selection and bucket fill tools if you are not comfortable painting.  Use the eyedropper tool with a small spread to select the colour.  You may need to use a magnifying glass and the actual board to see where the tracks probably go.

Create a new black layer (since you filled the substrate with black) and place it behind the component layer.  This should fill the spaces with black where the components were.

On my board, the component side also had considerable ground plane areas, which I deleted.

Optionally, use the levels technique previously described to turn the tracks into solid white. I found there were advantages and disadvantages to doing this.

Step 16: Combine the sides

Fire up inkscape and open the image of the component side tracks. Create a new layer, and cut this image and paste it into the new layer.  Create another new layer. Open the tracing you previously made of the solder side of the board, copy it, and paste it into the new layer. Close the tracing. Create a new layer. Open the picture you made of the holes, copy it and paste it into the new layer, then close it. You may also want to repeat for the image of the components, the ground plane hole circles, the free-hole marks and the complete image of the component side, if you want to use these for extra guides. I also added in an image of the solder side tracks to confirm that the first tracing was correct.

Open the layers dialogue and re-order the layers so the original photo is at the bottom, then the picture of the components, then the component side tracks, then the holes, then the tracing. Use the scaling arrows for each layer (click to select the image) to adjust it so they are all aligned. Use the holes to guide you. You may need to set the aspect ratio to "free" for tweaking.

Adjust the transparency of the layers so you have an image showing what is connected where.

Using the bezier tool, trace a line for each track. This will be easier if you filled in the substrate earlier. Click every time you want to change direction - this will add a node to the line. Double click to finish the line.

You will probably want to turn on or off the other image layers as you work to check your progress, and to check the "sanity" of your tracing.

You need to combine the two tracings. Go to Edit > Select All in All Layers, then Path > Combine. This will let you now select multiple paths. Go to Edit > Deselect.

Inkscape provides a tool to snap together the ends of lines.  Use the edit tool. For every place you find where a track on the top of the board connects through to a track on the bottom of the board, select the connector on the end of one, press shift and click the end of the other. They should both have big coloured nodes on the end when selected. Then click the snap together icon.  Any track ends you have left over most probably connect to a ground plane or an internal plane which may be either ground, power or a section of track. Use the other layers to help you investigate any which don't correspond to anything.

Finally, delete all the layers except the tracing. Save the file as postscript (.ps) The reason for this is that Dia has a problem importing .svg format files (hopefully to be fixed in version 0.98) and an intermediate step is needed to generate a format it can use, in this case the xfig format, .fig.

Step 17: Add component symbols

Use the pstoedit program with the options:
pstoedit -f fig inputfile.ps outputfile.fig

It is possible to generate a schematic format output file, but I found this hard to add components to.

Use Dia to open the .fig file you just made. Dia is a great little program which has an excellent range of objects which can be snapped to lines, a bit like MS Autoshapes, only much better.  If you have used Visio, you should be comfortable with Dia.  Choose the "Circuit" category of shapes.  Using the image of the components as a guide, snap in symbols to replace them. Visit the Dia website for extra symbols in the "Electronic" and "Circuit 2" categories. (Others may exist, I just haven't found them)

I used the lamp symbol to represent unknown connections - ie those which are connected to a "free" hole on the solder side. These can later be filled with corresponding colours.

Dia has a text tool.  If you snap text to a shape, it will move with the shape.  You can also attach it to lines where you see a connection point.  You probably want to add values and/or identifiers this way.

You can also create new symbols using Dia.  Create the symbol as a diagram, then export it as a .shape file. The files are easily editable in a text editor to remove surplus connection points and tweak line positions.

The majority of datasheets for chips and transistors can be found on the internet, though you may have to dig somewhat.  Create "mystery box" symbols for any mystery devices.  You may be able to work out what they are once you have rearranged the drawing into a schematic.

Step 18: Finally, rearrange

All being well, you should now have a vector drawing of all the tracks, with symbols added.  The wonderful thing about vectors is that you can move them around, and this is how you are going to turn what is still really a picture of the tracks on the board, into a schematic.

Chances are the circuit board layout bears at least some relationship to the original schematic, so bear this in mind as you move things around.

Start by moving obvious groups of components into areas with a bit of space around them. Optionally, replace the lines you traced with zigzag lines. These are composed exclusively of vertical and horizontal sections, and are ideal for this purpose.

If you are used to circuit diagrams having a dot to represent connections, you have the choice of putting in extra lines to accommodate these, or using the more modern style of not using them. In this case, crossed lines are only crossed, not connected. If a connection is represented, they are offset.

Arrange the components in each group so it looks more like a sensible schematic.

Work your way through the drawing, pulling out components and replacing lines as you go.

Arrange on a more general scale so that most of the connections between groups are in "sane" positions - ie, not too much crossing over, not too many going from one side of the drawing to the other.

When you are happy with the positions of everything, remove the excess points from each line, and sharpen the corners.

Study the power routing through the circuit to check the sanity of assumed vcc (or vdd) connections.  Compare to the actual circuit board with a multimeter to check.  Check any "probable" inner layer tracks.

Don't forget, some of the tracks which were connected on both sides of the board, may also be connected to a plane or track sandwiched inside the board.  If there are obvious peculiarities in the circuit, it may be because such a connection is hidden from you, and therefore missed.
1-40 of 61Next »

Very informative piece, many many years this was posted and still getting fresh hits on it, appreciate the forward payment you have made to us all :) Thanks eyes are getting old and have had to use reading glasses to see the work but now can view it on my I~Pad after sweet scan. Best wishes in all that you do .

throbscottle (author)  Delited2meetU20 days ago

Thank you for the kind comment :)

JesusGeek1 month ago

Great Instructable! This is great especially for making data of devices not available to the public for hobbyist use!

Thanks for sharing!

Sam

aakash_7924 months ago

I want to convert three phase signal into 5 vdc without using any transformer.. Could you please describe how will it be done??

throbscottle (author)  aakash_7924 months ago

May I ask you direct your question here:

http://www.electro-tech-online.com/

You need to provide more information, like what is the voltage of your 3 phase signal, how much current will be drawn. For a small current you could do it by connecting a capacitor in series with each phase (or even just one phase), but it is not a subject for discussion here.

Sangstbk1 year ago
Hi Throbscottle,

Could you explain more detail for me about delayering PCB by heating it up. What temperature? how long I need to keep it in this temperature? What machine can help me to do heating up like that?

Thanks
Sangstbk1 year ago
Hi,

How can I get a photo of internal layer of PCB? How can I break PCB to layers
throbscottle (author)  Sangstbk1 year ago
I think the only way you could do this is with x-ray equipment, as someone else suggested. If you wanted to physically split the pcb into layers, it might be possible to do this by heating it up until it starts to de-laminate. Of course, this would completely destroy the board in the process.
AKA the A1 year ago
If you need a good quality image of the pcb with even lighting, get a flatbed scanner... even the cheapest one will beat a consumer-level camera... Just get take off the lid and replace it with either a black cloth or make a suitably large box to keep ambient light out...
shams2 years ago
UBUNTU !!!
Absolutely brilliant. Thank you for this, I cannot place a finite number on the possibilities this opens to me.
demyhr3 years ago
As a retired "professional" doing design and layout of complex multi-layer (30 +) PCB's I must say there are limits to what can be done reverse engineering these boards. It is impossible to see inner traces of boards with internal power and ground planes even with x-ray techniques. I suppose one could probe with an ohmmeter but with many of the boards I have designed this would take a lifetime.

On the other hand I have used GIMP in conjunction with a flat-bed scanner quite successfully for measurement purposes. Scanning at 1200 dpi gives an accuracy slightly better than 0.001" and using the measurement function of GIMP dimensions can be determined quite accurately.

All in all a good instruct-able given a few caveats.
skylen demyhr3 years ago
I know someone who reverse engineered a multi-layer PCB by carefully shaving the board down, one layer at a time using a precision CNC milling machine, taking capturing high resolution images of each layer throughout the process. I was really amazed by the quality of the results. Very clever, I thought.
throbscottle (author)  demyhr3 years ago
It seems that the more I discover, the more complex this becomes! However, even an incomplete schematic is better than none at all, and this is a relatively un-complicated digital TV decoder. I will try the scanner method at some point.
iffee3 years ago
I have an AVR similar to the picture attached.

The components and PCB have been potted with some compound. How this compound can be desolved.?
AVR2.jpg
Biotele iffee3 years ago
Take an x-ray picture.
wwward iffee3 years ago
I have reverse engineered many potted boards. I use a heat gun and heat the potting compound. When heated enough the compound starts to flake off. Patience, and you will have it.
Euphy iffee3 years ago
Epoxy potting compound is pretty hard to remove. I've only ever managed to remove it from things I didn't want to keep (ie hit it with a hammer), and even then it was untidy. However:

http://www.instructables.com/answers/Dissolving-Epoxy/
http://kevtris.org/Projects/votraxpss/unpot.html

And there are a couple of other pages on the internet about various attempts.
cyphunk3 years ago
excellent!
anyway to identify these components? http://www.trafficlights.com/images/T3_photos.jpg I want to try and build one.
T3_photos.jpg
throbscottle (author)  Donotmatthews3 years ago
The various components will be marked with their values and part numbers. Looking at the photo, at top left you have a potentiometer, which will be marked with it's value probably in kilo-ohms - you will have to look for a figure ending in K, or possibly A or B (one of these means logarithmic, one means linear, but I can't remember which is which - this one will be linear), next to it you have a standard looking red LED and what is probably it's current limiting resistor, then the two blue cylinders are electrolytic capacitors, which will be marked with their value in microfarads (uF) and voltage, just in front of them is what looks like a glass bodied diode (possibly a zener), then going right again is probably a rectifier diode. The big stripey thing next to that is a resistor, probably 1 or 2 watt. The big black box is a fuse holder. Just in front of that you have 3 devices which looking at the wiring diagram on the web-site tell me are triacs - you will have to look at their markings to find out the exact type - you can look these up on the internet and 99% of the time be able to find some data - next to those are 3 resistors which look like they feed the control signal to the triacs. The 8 legged animal is some sort of chip - again you will have to look at the markings to find out what it is, though again looking at the web site, it is probably a micro-controller, and above that is another resistor. Next to that you have a dual dip switch. Without knowing more about the circuit, I can't really tell you more. The resistor colour code, in case you don't know it, is
Black = 0, Brown = 1, Red = 2, Orange = 3, Yellow = 4, Green = 5, Blue = 6, Purple = 7, Grey = 8, White = 9.
First two bands are the base value, 3rd band is the multiplier (ie, number of noughts) so brown, grey, red woudl be 1800 ohms, or 1.8K, brown, grey, black would be 18 ohms, brown, grey, blue would be 1800,000 ohms, or 1.8M.

The fourth band is tolerance, used to be gold or silver for 5% or 10%, but now red or brown for 2% or 1% is common. There may be also a band to indicate temperature coeffecient. Gold and silver are sometimes also used for the 3rd band to indicate divide by 10 or 100.

At first I thought you had one of these and wanted to clone it, but it looks like you just want to build your own version from the photo of the one they are selling! Cheeky :-) Unless you can program your own microcontroller, your best bet is to find a free circuit diagram to build one yourself, or better yet, design your own, rather than try to copy a proprietary design from a photo.

I'm sorry to say there just isn't enough information in a photo like this to be able to work out any more than the basic power control - it has the triacs connected to the lamp outputs, these are fed by what look to be high value (and possibly special purpose) resistors from the microcontroller. It looks like there is a very basic live power supply to give the low voltage DC. There may of course be SMD's underneath the board, which of course you can't see, though it looks unlikely.

I hope this is helpful to you - wish I could give you more useful information.
Great Instructable. You might want to also mention this:
http://www.instructables.com/id/Find-schematics-wiring-diagrams-etc-for-everyda/
throbscottle (author)  siliconghost3 years ago
Wow - cool! I will look to see if there is a UK equivalent!
No problem! Please let me know if you find a UK equivalent.

FYI, I just added a reference to your Instructable from my video page as well.

- John
tomkawal3 years ago
Some advices for taking a picture sound like overengineering of reverseengineereing. At good light no need for tripod.

Guys, to take a photo of PCB, any regular printer scanner seems to do the job.

I use polarising filter to contrast the text on IC.
Also good to have microscope, backlight for details of PCB etc.
cheers

what are artefacts and how would you get rid of them with the clone and blur tools? here's what i have so far
RRC green side 1.png
throbscottle (author)  aetienne34933 years ago
Artefacts are things which don't really exist, like optical aberrations - like if the light has made a shiny spot, or something has got blurred and looks like it is a slightly different shape, or you have coloured edges to the tracks - tricks of the light and shadow, things like that.

You can use the clone tool by finding a spot that looks the same as the place you want to correct, ctrl-click (I think, you will have to check) that spot, then paint over the place you want to correct. It will copy the first spot over the second. Use blur for if you have a small detail you want to remove. Just paint over the spot until you have blurred it enough.

Looking at your picture, I would seriously consider hand tracing it and missing out most of the graphical techniques, since it's a fairly simple board. Also, as mentioned in a previous comment, if you have a scanner you will probably get a better image by scanning the board.

Good luck!
alright thanks
throbscottle (author)  aetienne34933 years ago
Oh, apparently I also meant physical bits of dirt, hairs etc as well as optical aberrations.
captthud3 years ago
I started reading this with skepticism - "There's no way to magically generate a schematic from a PCB." While there wasn't any magic* I'm very impressed by your creative use of software and the flow of data. Circuitry aside, this is an excellent introduction for advanced image editing.

+10,000 points for doing it all with open source software on Linux. There's so much amazing stuff that people don't know about. I've been using Inkscape and Gimp for a while, but I haven't seen AutoTrace or Dia before. TIme to hit the repositories!

*Revealing the PCB holes with masks and channels seemed magical, even if it's just math.
Mike443 years ago
Man, this looks like a lot of work, especially doing it in something that looks like MS Paint. Why not just use a real PCB program off the top to map out the board? Place all the components as you spot them out, draw the rats nest in between to however far you need to go, then create the actual PCB. At least I think it would be easier. There's tons of free, basic PCB software out there: http://www.olimex.com/pcb/dtools.html. Even: http://www.suigyodo.com/online/e/index.htm
If you have a scanner available, I've found them easier to get board pictures than a camera. Also a lot of scanners let you zoom in to get those tiny id numbers on small parts
throbscottle (author)  criswilson103 years ago
I wish I'd done this! I was put off the idea by thinking the resolution would be too low, but I think that would be outweighed by the picture quality. I'm curious to know what you use board scans for!
I use scanners to scan boards for repair and reverse engineering. Most of the time they are obsolete boards from odd equipment. The last one I did was a controller board for an automated shrink wrap machine from the early 1980s. The manufacturer was out of business and no replacements board was available. So I scanned the front and back of the board in to get the rough trace pattern off the board and to make it easier to read the part values for everything.
You can actually get rather insane resolutions on a scanner, something like 1000dpi+. For example, here's a board I had scanned in a while ago - I don't remember what resolution I had scanned it in at, but it wasn't anywhere near the max resolution of the scanner. http://nookdevs.com/images/f/ff/Board_scan.jpg

Also, hats off on this bit of reverse engineering! I had had to reverse a low/medium complexity board a while ago, which only used through-hole components (90s era board). I had done it by hand (w/ multimeter..), and that was quite a challenge! The board you are working on is significantly more complex :)
Have to agree there. The default on one of my canon scanners was taking up-wards of 7 to 8 minutes to do a scan! I was bewildered but allowed it to finish, the file was HUGE! I realized why after my photo software stated it could not handle a resolution over 1250 dpi the scanned image was over 3000dpi
I then changed the default to 275dpi for scan to computer and 75dpi for copy to paper. There is an Instructable here http://www.instructables.com/id/Take-detailed-photos-with-a-scanner/ that shows using a Scanner for Macro Photography.
Haha! I was just about to suggest this same thing!
I might do this to my EEEPC power supply regulator section.
I accidentally reversed the polarity when I replaced the car power supply and let the blue smoke out!
As you all might know, electronics works with blue smoke ? If you let the blue smoke out, the gadget does not work anymore.
"Michael Jennings is a reverse engineer and what he does is technical jobs for certain companies and as soon as he is done, his memory of the work he has done is wiped out. " That is the simplified plot for Ben Affleck starred movie.

Be careful to do this reverse-engineering as some company might want to erase your memory, lol!
jolshefsky3 years ago
Excellent explanations and good use of tools. It would be nice to go straight to something like Eagle, for its electrical rule checking (ERC), but that's obviously yet another headache.

I've also been surprised that there's no solid standard for making vector graphics portable and platform-independent. I had done work in AppleWorks and had absolutely no way to get that data into OpenOffice's drawing package. I got a weak copy via some convoluted Encapsulated PostScript; SVG gave me nothing but false starts and dead ends.

That reminds me ... I have to get back on that project!
1-40 of 61Next »