Debugging Electronics and Programming (work in progress)

General Debugging Concepts

Debugging Software

Debugging Hardware

Building electronic circuits is not trivial. Parts are small, and things that you can barely see can cause trouble.

If your circuit doesn’t work the first time, don’t be discouraged. It is very common for electronic circuits not to work the first time. A good engineer is not someone whose circuits always work the first time, but rather, someone who is good at figuring out why a circuit doesn’t work.

The most common mistake by far is incorrect wiring. Avoid this by double- and triple-checking against the schematic very often, and by asking someone else to verify your work.

The second most common mistakes are connections (shorts) where you don’t want them, and non-connections (opens) where you do want connections. Sometimes close visual inspection will find these, other times you need a multimeter to identify something you can’t see.

  1. Divide work into small segments, and test after each segment. That way, if you make a mistake, it won’t be hard to repair.
  2. The first check should be visual. Look for bad solder joints and solder bridging two nodes that should not be connected. Look for component leads that touch where they shouldn’t. Look for leads that seem to be soldered, but are not. The ability to spot these is a skill that will develop over time, but only if you practice.
  3.  Double check your work first yourself, and then with a classmate/friend/teacher. Don’t prejudice them by telling them what you meant to do; let them figure out on their own what you did. Repay the favor by offering to double-check their work.
  4. Use your multimeter to check for correct continuity as well as correct discontinuity wherever possible: between connector pins, IC socket pins, components; and their destinations. Check for discontinuity between any voltage source (+5, +9, etc.), signals, and ground. You may see (or hear) a very brief continuity while capacitors charge; this is normal.
  5. Test your circuit whenever possible. Verify correct voltages from regulators before attaching  anything to them; Verify correct voltages at IC socket pins BEFORE putting in expensive components (like microcontrollers)
  6. If anything seems odd don’t ignore it; your intuition is an excellent piece of test equipment. Let it work for you. Ask the teacher or a fellow student.

 

  • Test each piece in isolation, then combine one other element. Don’t try to debug full project right away.
  • Work your way from input to output, verifying each step of the way
  • Use Serial.print() to tell you what your program is doing. Use LEDs if serial monitor is not available.

Before asking for help, do your homework. This not only helps the helper better understand the problem, but often you will find the solution during this process:

Don’t ask me “does this look right?” or tell me “this doesn’t work”. Rather, test it, and perform the same analysis we’ve always done. Document this in your journal, as the process is part of your grade

  • What did you want to happen
  • What did you observe that happened
  • Make a guess to explain why what you observed is different from what you wanted (hypothesis).
  • Design an experiment to test your hypothesis
  • If the experiment proves your hypothesis was right, figure out what to change to get the results you want
  • If the experiment proves your hypothesis was wrong, think up a new hypothesis

 

Print Friendly
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *