Electrical

From iRobotics Tech Wiki
Revision as of 21:06, 21 February 2024 by Iroboticstechwiki (talk | contribs) (Created page with "Debugging an electronic circuit is a fundamental skill for any electrical engineer. No matter how good you think you are, you will inevitably do things wrong. This is generally acceptable, as long as you can identify what you did wrong in retrospect, and then have the ability to correct the problem. Also, don't kill anyone in the process. Actually, the hardest step in the process is figuring out what you did wrong. Debugging is not a skill which is algorithmic and, as s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Debugging an electronic circuit is a fundamental skill for any electrical engineer. No matter how good you think you are, you will inevitably do things wrong. This is generally acceptable, as long as you can identify what you did wrong in retrospect, and then have the ability to correct the problem. Also, don't kill anyone in the process.

Actually, the hardest step in the process is figuring out what you did wrong. Debugging is not a skill which is algorithmic and, as such, is nearly impossible to teach with a textbook.

Here are a few basic steps I have naturally developed and generally go through while debugging:

  1. DOCUMENT EVERYTHING. Having through diagrams of what you intended to do, labeled and well-organized wires, and clear communication between teammates will give you the opportunity to check your work as you go, and give you superior backward-tractability when something does go wrong. Documentation is key to any scientific or engineering endeavor.
  2. Start by looking for obvious things. Is the power switch off? Is there voltage at the power inputs to the malfunctioning device? Is the device mechanically constrained? Are there warning lights?
  3. Assuming it's not obvious, go back to the design documents and analyze them, making sure everything is as you expect. The goal of this step is to ensure that your intentions for reality are in fact logical and should

result in the proper operation.

  1. Design documents in hand, start at the source of power or the source of the signal driving whatever is broken. Is the signal good at the place where it is sourced from?
  2. Begin to trace downstream, checking to make sure that the signals and values are as expected as you move toward the output.
  3. As you trace downstream, debug each debugging action you take. Are you sure you are putting the probes on the right testpoints? Are you sure you expect to see 5V on this line? Is is possible to see anything else? Are these other readings actually indicative of an error?
  4. As soon as you get a bad signal, begin using a sort of "binary search" pattern to find the exact location of the problem. You know the issue must now lie between the bad signal you just measured, and the last good signal you measured.

Remember that, at this stage, you are looking both for things which could be a flaw in construction (eg, broken wire), as well as things that could be an error in translating your design documents into reality (eg, positive wire connected directly to ground)

Only as a very last resort should you just tear apart everything you did and start from scratch.

Remember that these rules are not hard-and-fast. every situation is different, and requires a unique approach. Take the time to develop your debugging skills both with this club and in your lab classes. They will serve you well in an engineering career (or any career for that matter).

Avoid this mentality:

File:BreakpointBasedDebugging.jpg

Search for causes, do not fixate on what is going wrong.