How To Reverse Engineer A Schematic From A Circuit
How To Reverse Engineer A Schematic From A Circuit
Table of Contents
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Intro: How to reverse engineer a schematic from a circuit board
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.
Image Notes
1. Photo of the component side of the board I used for this project
2. I only needed a schematic for part of the board, so just traced this much of the component side
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
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...
Image Notes
1. This is sufficiently pulled out and rearranged to be useful! The red lines connect to traces on the board I haven't mapped out, since I only did a quarter of this
board.
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Image Notes
1. This part of the board didn't get enough light, making it harder to obtain a clear image of all the tracks
2. This part of the board got a bit too much light, making it harder to get a clear image of the tracks
3. These tracks suffered a fair amount of aberrations, both chromatic and due to refracted light through the solder resist.
4. Painted areas come with their own problems
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.
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
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.
Image Notes
1. Datasheets. I used the word "candidate" as the component identification is not 100% positive.
2. Various images I tried
3. The stuff I'm actually using goes in here
4. Hello, instructables!
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Image Notes
1. With the green and blue channels turned off, the copper pads stand out
against a dark background
2. Very good result in the best lit part of the picture
3. A bit of manual cleaning needed here
Image Notes
1. The layer showing just the holes. Too many to paint in by hand here, but using
the colour difference to pick them out worked well. A minimum of cleaning up by
hand was needed.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Image Notes
1. Detail view of holes overlayed onto photograph
2. I also included test points in with my holes
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.
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.
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Image Notes
1. Circle brush
Image Notes
1. The brush creates nice, even, easy to place little circles
2. A group of holes enclosed by a stroked rectangle selection.
3. Some holes were placed so that the circle would overlap the tracks, so I
created a free selection around them. As it worked out, I needn't have done this,
Image Notes
1. It may have been easier to put in these circles before deleting the ground
planes, then I could have deleted the actual holes at the same time.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
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.
Image Notes
1. X shaped brush. Note it does not reach the corners of the canvas, as the arms
are the same length as the plus sign.
Image Notes
1. Plus shaped brush
Image Notes
1. X's and +'s in action
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
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.
Image Notes
1. Remaining areas of substrate
2. The ground planes covered most of the board. The remaining dots are the holes, which I left as I removed the planes before circling the holes before deciding the
order of steps should be as shown in this instructable.
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
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.
Image Notes
1. Burn mode
2. Tracks much more clear now. You can make the green parts visible again by
deleting the areas above and below the paint on this layer.
Image Notes
1. Although you can see the tracks, it's not always clear which bits are track
and which bits are substrate.
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Image Notes
1. The tracks are clear now, but it is now also clear that there is a lot of roughness
and aberration to clean up. Image Notes
1. Set guides and the brush will cling to them.
Image Notes
1. You can see the range of bad lighting here.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Image Notes
1. Isolate differently lit areas to work on first.
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Image Notes
1. Notice how the edges are nice and smooth now. This won't cause problems for AutoTrace!
If you are using Linux, or some other 'nix, for the files containing the tracks, run the following command:
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.
Image Notes
1. Bezier lines containing editable points
2. Edit tool
3. Bezier drawing tool
4. Join nodes together tool
5. A tracing error. You can correct this by breaking apart and joining together correctly the associated nodes.
6. Selection tool
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
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.
Image Notes
1. Photo of the component side of the board I used for this project
2. I only needed a schematic for part of the board, so just traced this much of the component side
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
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.
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.
Image Notes
1. The hard part was working out which bits were substrate and which bits were just shadow, and what was under the painted legends.
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Image Notes
1. Composite image showing holes taken from solder side, filled in substrate covering painted legends, and tracks on component side
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.
Image Notes
1. Multiple layers showing work done so far
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
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.
Image Notes
1. Drag a line onto a connection point and the symbol will turn red to show it is connected. If you drag onto a centre connection point, it will turn yellow.
2. All components which are connected to a ground plane have their symbols connected to a ground plane
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.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Image Notes
1. The jumble of lines is starting to look like a circuit diagram now
Image Notes
1. Click a polyline, and you can see a a trail of points. Find the ones at the ends
and attach a zigzag line to the attachment points on the component symbols.
You can then delete the polyline. Use multiple zigzag lines if there are multiple
attachments.
2. I used lamp symbols to denote holes through the board which are connected
to a hidden layer - the "free" holes on the back of the board.
Image Notes
1. As the polylines are replaced by zigzag lines, the diagram can be rearranged
into a neat schematic Image Notes
1. Dia support "rubber band" selection. Carefully select a group of components
and you can move them around as a block. The lines connecting in will move
appropriately.
Image Notes
1. This is sufficiently pulled out and rearranged to be useful! The red lines
connect to traces on the board I haven't mapped out, since I only did a quarter
of this board.
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Related Instructables
Modified Sine
Wave Signal
The Easter Basic Voltage
Generator. by Controlled
Find Solar Engine by Electronics by
Rechargeable Josehf Murchison
schematics, TinkerJim randofo Switch by
wiring Battery josh1001
diagrams, etc. Capacity Tester
for everyday by BrianH
electronic
devices (video)
by siliconghost
Comments
50 comments Add Comment view all 51 comments
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.
The components and PCB have been potted with some compound. How this compound can be desolved.?
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
Euphy says: Feb 8, 2011. 11:56 PM REPLY
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.
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.
FYI, I just added a reference to your Instructable from my video page as well.
- John
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
tomkawal says: Feb 3, 2011. 5:01 AM REPLY
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.
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!
+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.
Be careful to do this reverse-engineering as some company might want to erase your memory, lol!
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
jolshefsky says: Jan 20, 2011. 6:58 AM REPLY
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.
http://gimp-win.sourceforge.net/
If you have a sparse 2-sided board or a single sided board it can make the traces much easier to see.
Also high voltage and low voltage sections of a circuit will usually be separated on the PCB and it is very easy to see this if you light it from the back. I did
this and found I could simply break the CFL high voltage part off of the board in the second picture (I replaced it with LEDs)
I am very curious to know how many hours you would estimate (honestly) that you put into this board.
The reason I ask is because I am the same way - when I want to achieve something I won't be stopped by difficulty or time expense to get something like
this done. (Lately, it has been 3D technical/mechanical drawings in Sketchup that I put a frighteningly excessive amount of visual detail into, spending 10-
12hrs/day for 10-14 days to complete, and think nothing of it) Perfectionist much??
It's refreshing to see that there are others that will expend extreme effort, ESPECIALLY when it means the difference of whether or not an electronic item
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
gets discarded.
An alternative method that I thought I'd mention might be good for those who are doing simpler boards. I have used it with great results on many occasions,
but I do realise that it's not for everyone:- -
Using a variety of differently-coloured markers, paint the traces as you follow them along the board. Use the same colour along a trace on one side over to
the other when encountering a via. Drawing the parts on paper or computer, you can roughly wire point to point as you determine trace routes. When you
have drawn a given trace, simply paint over it with black to indicate it is completed. The famous Sharpie markers come in more than two dozen colours,
although there will be some that won't show up well on the board. These are "permanent" and hold up well while handling, but a bit of acetone, alcohol,
lacquer thinner, WD-40 or other solvent will easily remove the ink. Of course you can use certain colours exclusively for Ground, Power, Data etc. and a
million other ways of optimising the process to your taste. It's actually kind of fun too.
Thanks for the 'ible, there are many valuable methods and techniques in here that can be used for other purposes too. Also, the SMD Catalogue reference is
a gem and exceedingly useful.
Hopefully version 0.98 of Dia will import svg files correctly and there will be no need for the extra postscript step. On the other hand, using postscript does
open up a wide range of alternative formats to use. You takes your choice...
For those who are interested in how long it took to do this, it's hard to say. I did a number of multi-hour sessions, but had several false attempts along the
way where I had to try a different approach, or re-start a step. I also wrote down these steps and produced illustrations as I went, which took up more time
as well.
So I'm making a very rough estimate here, maybe 30 to 40 hours including time to work out the methods. Now the method is known and written down, it
should be quicker.
http://www.ami.ac.uk/courses/ami4809_pcd/unit_01/images/pcd_ipcbt_imgl.gif
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/
throbscottle says: Jan 17, 2011. 6:30 AM REPLY
Thanks for this - excellent illustration. I read somewhere that the inner layers tend to be mainly ground planes and power planes. In this particular
project, I identified a power plane as being connected to most of the one-sided holes in the final schematic.
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 :)
http://www.instructables.com/id/How-to-reverse-engineer-a-schematic-from-a-circuit/