I would like to see a possibility to actually create a schematic from PCB layout. Why? I personally do lots of electronics repair and upon repairing the age old question “Can I have a schematic?” is usually met with “NO!”.
How I do it now:
I lay out parts in schematic editor somewhat how they would be laid in the PCB I’m holding in my hand and then I wire them up resembling how they are actually wired/connected on the board itself. After the initial layout I perform a cleanup and de-clutter the mess + check for errors and try to figure out any “standard circuits” (ie op-amp layouts, filtration, PSU, etc… standard thingies. As a result I get some sort of a schematic. This approach is a bit labor intensive, prone to errors, and if the PCB is not annotated then you have another trouble identifying which component is which (especially after getting back to the work after some time, when you have forgotten what have you done here).
How I would like to do it (feel free to suggest better ways):
Lay out all the components with with their packages onto the PCB layout. Annotate and interconnect everything, as it is connected on the actual PCB. Then switch to schematic editor and see all of the parts clumped up in a similar way, and start arranging all of the parts. In order to avoid merging different signals together the schematic editor could have a locking feature that allows to move things, but not create any new junction points between wires. Anyways tidying up the schematic by means of rearranging and manually rewiring something.
As an end result I would have working schematic, accurate enough PCB layout with all of the correct annotations (and no problems if the actual PCB is not annotated).
Also with reasonable effort I could make improved unit, modboard for the existing device, or just make spare copy of the existing unit (some of the stuff I end up fixing is obsolete/no spare PCB’s available).
None of the software’s I’ve heard/seen are capable of doing this. Also methods how people do this vary, some use photos, transparencies, pen and paper, or schematic layout (as I do). KiCad could have this reverse engineering capability inside the existing tools or it could be completely new tool designed for reverse easing the reverse engineering task.
It would also not hurt to have all of the basic package types in schematic and layout editors as per default, in order not to start drawing up all of the basic shapes per need. Upon reverse engineering one may… will encounter IC’s with removed identifications or parts that will not reveal anything on the part number. In some cases after assessing the circuit one may actually identify the part with the help of the rest of the schematic (classic case if this 3 legged thing is NPN or PNP transistor and which way around it is, or would this 8 legged thing be perhaps standard OP-amplifier).
Anyone any ideas on this idea?
How would you do the reverse engineering in similar case?
I have given a thought for this because I have tested the backannotation feature which was discussed in the developers mailing list and is now a merge request.
I suppose this wouldn’t be accepted to the core KiCad any time soon. However, when eeshcema gets scriptability - hopefully in 6.0 - this might be possible to do with a script.
One of the difficult parts is attaching a symbol to a footprint in reverse direction. Think about how a footprint is now assigned to a symbol. There are several ways to do it. KiCad file formats have only one way direction for symbol/footprint assignment. Therefore all assignments should be updated to the schematic immediately, at least within one session, or saved to an external file. The dialog which would do the assignments must of course open the symbol finder dialog. Compatibility between the symbol and footprint (the number of pins) must of course be checked while “back-annotating”.
You can see this isn’t a simple task. There are many, many details to take care of.
Then there’s the initial placement of symbols. Mimicking the layout placement is a nice idea in theory, but I doubt it would work well in practice because the footprint and the symbol can be completely different. having wires automatically would require a schematic autorouter. It could be possible to add just symbols and a net label for each pin, and this is what I would recommend for starters.
Theoretically speaking this kind of reverse workflow shouldn’t be any harder to implement than the normal workflow, but in practice it’s quite much work. Like creating a new application partly based on an old one.
I personally have non-existent skills on programming, so I have no idea how this thing could/should be done, but I strongly think that if KiCad would feature easy way to reverse engineer even simple one or two sided boards into schematics it would attract vast amount of new users, which are specialized in repairing stuff and not so much in building new. For those people it would be easy to take things to next level and actually start doing new things with KiCad.
As additional bonus I think this feature has the potential to change the repair industry by increasing the amount of available schematics, easing repairs and increasing the chances to fix various electronics instead of replacing the broken junk with new working (soon to become) junk. This is especially true in industrial applications (I myself work in this field) and typical scenario is that when motor controller indicates fault, it’s replaced and old one is trashed. New units can cost in thousands and the reason for failing might be one broken thyristor due to overload situation or failing filter capacitor. Simple thing to fix, but no schematics, no support from the manufacturer and without years of knowledge in the field it’s not so obvious thing to fix, without a schematics. I’ve even seen many perfectly working devices dumped as “failed” due to poor connections, ie user error or just cable connector not seated perfectly.
So in a nutshell I think this has a potential to decrease the amount of electronic waste and allow some small companies to successfully repair their junk that fails.
Case example, imagine being a small metal workshop and the chances to repair the 20 year old CNC milling machine’s (the only milling machine they have) servo controller anywhere. At least here in Finland not that many companies repair stuff at all (it’s usually new, new, new attitude), none of the big name repair shops seems do component level repair (they just replace whole boards/modules, if spare part is not available -> no can do), and the small shops are a bit afraid to work on theses items, due to no schematics being available… and the price can easily skyrocket in thousands when someone starts working on these things + it can take some time if it gets fixed. New milling machine replacement/modernization will cost starting from 10k€ and upward (all the way to million an over). So in conclusion one failed servo controller can potentially kill the whole company.
Anyways hope that something like this arrives to KiCad. I’ll leave it up to the developers to implement this feature, and hopefully one day soon they will.
This fails at this point because footprint to symbol is far from a one to one relationship. As someone that works on small projects one section at a time I see no savings from the method I would already use.
Layout your schematic as on the board. Do one section and then go the the PCB part and make it look like the original. Multi tasking is a myth. Plain and simple. It is the same process as doing memory pages on the computer. There is a penalty for switching tasks. Your time is likely to be used more efficiently if you concentrate on one circuit at a time in both the schematic and layout while it is fresh in your mind.
Can’t quite agree. Experience proofs otherwise. During a design process I hold a vuriaty of information like component physicals, availability, housing requirements, schematic, layout, availabe production processes, technologies you name it. With todays tools a mostly easy task.
With that kind of approach there is never a need to start out from a layout only. It’s a simple ‘mental back annotation’ process. In general with the schematic grows the pcb design. As changes arise they will be fine tuned from the schematic top down. The other way around is a crutch at best.
What you are essential talking about is back engineering a given pcb of some kind.
I’ve done a few of those just to get a schematic to see what’s going on.
It’s quite simple and no need for special features for KiCad since the required means are already present.
take back and front photos of pcb
mirror the back side so it’s like an xray shot
scale them to something meaningful (grid etc.)
import them as seperate layers
keep them fainlty in the background
start draw the schematic
don’t arrange symbols to match the pcb since it does create confusion
Now begins the task you are after:
identify components
connect them in the schematic as to their functional blocks or your liking
match their positions on the pcb as you place schematic symbols
the underlaying copper tracks will literally show you the way
repeat until done
perhaps lots of coffee
That’s it.
Admittedly this mostly works well on two layer boards. It gets a wee bit more tricky on multilayer designs, however four layers are quite doable. The rest is up to anyone’s guess.
I doubt anyone would argue that such a feature is useless. It is however a lot of work to implement it well. So i would not blame the devs if they state other stuff is more important at this stage of kicads development cycle.
One useful feature I can think of is the ability to snap scale an imported pcb photo to a grid. This could be done by placing fiducials at know positions within the photo as measured. Then on import KiCad scales accordingly to those fiducials.
I actually like your suggestion regarding the importing of pictures as a background. With this method I see at least the following issues:
Schematic layout allows for 90 degree lines, no curves etc (some PCBs might have oddly shaped foils and tackling them with 90 degree straight lines will create some sort of a mishmash)
Scaling of the images, your fiducial based markings could work and as my own refinement KiCad could have a tool where one could draw a line on the image from point a to be and state that this line is x amount of mm on real PCB and the line is aligned horizontally. As a result the software will re-scale and rotate/align the picture appropriately. This could be used manually by measuring distance between mounting holes or some other pins, or automatically by placing some “standard test pattern” - image next to the image or so.
Densely populated board can be denser than the schematics grid which will create an issue in routing according to PCB foils
some double sided pcb’s will eventually have foils meeting the top layer… Tough to explain, but by following the traces the schematic lines will meet create junction among intersections. So KiCad could have ie a auto junction creation lock in it (perhaps there is, but I’m not aware of it).
Another higher end ideas would be:
Automatic identification of components (at least basic stuff)
Automatic identification of annotations
Automatic identification of clearly visible traces and capability to prewire the schematic to what ever is visible / what ever is identified
Auto identifying component values from what is/can be identified from the picture (OCR readout on written stuff and color band identification)
Automatic identification and arrangement suggestion for some general stuff, ie it could identify automatically/semi-automatically mains filter circuitry, op-amp circuitry, pull-up and pull-down resistors, power smoothing caps, and perhaps something else and suggest arrangement according to good common practices or even just highlight the suspected culprits for manual rearrangement.
In general it’s good that there is some sort of discussion regarding this and hopefully there will be some additions / help’s for reworking/repairing things and not just full concentration on just creating new. I’m personally lacking the skill of programming so I have no idea what is possible, what is easy or hard to implement or what is totally impossible or how things should be done. My job is try to suggest something that might be useful and would help some folks in repairing things and making this task easier.
Reverse engineering is always a job with limits. Specially if you meet boards what have ICs with removed mark/numbers. Luckily I did not see much of them in the last decade and formerly they were most time from garage production. Today designers frequently use software, passwords, disabled JTAG to protect their design, making it intentionally obesolete and prohibit any repair. For that reason I personally do not buy any iPhone nor licenses for copy protected software. Those features are designed for not using the product and thats exactly what I do.
Nevertheless I frequently volunteer in a repair cafe where old people come (with even older treasures like a tape recorder with records from her deceased husband) where I frequently meet similar situations. Recently I had luck with a 68000 board (5V tantal caps) to repair a combine harvester and a 4KVA load commutated inverter for solar panels. (some Mosfets shoot through) I never used CAD to replace missing schematic and I doubt it will be helpful if available. If you go down to such level of exact copy, you include a copy of the design bugs what possibly lead to the failure. This way, my attempt is to understand the functionallity of the board and identify the core components. If this is not possible for whatever reason, I do not continue. Otherwhile I dig out the component manufacturers data sheet to see the default application circuit. Most times, this explains the surrounding components very accurate
Yep, seen those removed markings as well. I also avoid getting in contact with all of Apple products due to the same reason that they treat customers and repairtechs as crap.
I personally have been using a box with question mark for unidentified components and then after parsing out the schematics tried to figure out something like transistor type (ie N-FET, P-FET, NPN, PNP). I also agree to the fact that if the CPU or any other smart IC breaks there is typically nothing that can be done to fix it (if not obtained spare from donor board), but most of the stuff I’ve been fixing had have their fair share of problems in those general jellybean parts, which usually are readily available. For me personally drawing up a schematic with KiCad has been easier task than making anything with pen and paper (I’m terrible at hand drawing, and seems like I even have my own font, which most of the people do not understand). Same applies to mechanical contraptions, usually when I start planning something into something I first model up the thing I’m about to start adding something in to (ie model the box and then design it’s brackets).
Just at the moment I’m finishing up one of our products and prior to arranging PCBs, buttons, displays etc I’ve modeled precisely the electrical enclosure that we had selected for the enclosure. It’s easy for me to draw up any mounting bracket or model cutout dimensions etc right on top of the real thing. I’d personally liked to use the same workflow if I would be in need of improving some existing electronic appliance or repairing it, and upon repairing (also upon revisiting the same device) I already got a schematic for it (or just the part I’m interested in, such as PSU).
I like the thing what you do regarding the charity repairs. I guess it means a world to them to get some old equipment back in order.