Stuck with a project that isn't working? Try these troubleshooting techniques to help efficiently fix your projects!

Sometimes when you work on a project, things just don’t go as planned. When that happens, you have to determine what went wrong. If you’re lucky, the problem is easy to spot and fix. Other times, you can find yourself poring over code, disconnecting and reconnecting components, and struggling to remember why you wanted to do this project in the first place.

It’s a rite of passage for every maker and, over time, each of us develops a few debugging and troubleshooting strategies. In this article, I want to share a few fast and easy troubleshooting methods specifically for beginners. 

You can also download a Troubleshooting Checklist to keep handy as you work through your projects.

Troubleshoot Circuits on a Breadboard

Over time, breadboards tend to wear out and oxidize, which means that components may not make good contact. So the first thing that you can do is check the connections of the components in your project.

If you suspect that your breadboard might have oxidized, it can help to remove a component and stick it back in a couple of times. If your breadboard contacts loosened over time, it can help to gently push down on the components while you test your circuit. I found this to be especially helpful in designs that use a lot of jumper wires because those connections can easily come loose.

Another tip is to use color-coded wires. For example, you can use black wires for all the ground connections, green wires for data transfer, and so on. Incorporating color codes helps to keep track of what is already connected, and it also makes it easier to notice if something looks out of place.

Debug Your Code

So you checked all of your breadboard connections and still can’t get the project to work. The next step is to check and debug your code. You can often use a debugger to make sure that your program behaves as expected, but, unfortunately, it’s not always that simple.

The Arduino IDE, for example, doesn’t come with a debugger. Luckily, you can still check whether your code behaves as expected by adding a debug output to your code. Here’s a simple example:

        private int start = 0;

void setup() {
  Serial.println("DEBUG: setup() begin");
 
  init();

  Serial.println("DEBUG: setup() end");
}

init(){
  Serial.println("DEBUG: init() called!");
  start = 60;
}

void doSomething1(void){
  Serial.println("DEBUG: doSomething1() called!");
  /* Do something */
}

void doSomething2(int val){
  Serial.print("DEBUG: doSomething2() called with val = "); Serial.print(val); Serial.println("!");
  /* Do something else */
}

void loop() {
  serial.println("DEBUG: loop() begin");
 
  doSomething1();
  start = start + 1;
  /* Perform other actions */
  doSomething1();
 
  serial.println("DEBUG: loop() end");
}
    

When you execute this program, you’ll immediately notice that due to a copy-paste error, doSomething2() is never called. However, I recommend that you only add the debug output when you suspect that something is wrong.

I also recommend that you look for conditions that are either always true or unsatisfiable. Those can lead to if-conditions that will never be true (often called unreachable code) or endless loops, to name two problems. 

Many modern IDEs offer built-in features that warn you if something like this happens:

IDE built in debugger

Many modern IDEs include a built-in debugger to help out as you write your code.

There are also options like Visual Micro for Visual Studio that offer users the ability to write, edit, and debug specifically with Arduino.

Check the Specs

Electronic components are usually meant to be used in a specific way. If you attempt to use them incorrectly, your design could:

  • Not work
  • Behave unexpectedly
  • Get damaged and become unusable

Checking the datasheets for the parts in your design is an important step when troubleshooting.

Allow me to give you a fairly recent example of a mistake I made in one of my projects that used a couple of different standard logic ICs. Take a look at these two figures from two different datasheets:

IC pin diagram comparison

Pay close attention to a component's datasheet. Small details can make or break a project!

As you can see, the in- and outputs are in reverse order. However, I assumed that they were the same, and it took me a while to figure out what the problem was.

You should always make sure to double-check the datasheets of your components because they contain valuable information, including timing descriptions, pin diagrams, maximum ratings, and much more.

Useful Tools for Troubleshooting

As a maker, you should invest in a good multimeter because it’s a versatile device that’ll help you with your projects. If you use a breadboard, you can utilize the continuity function of the meter, to make sure that two pins are connected as intended. This can also be used to search for short circuits.

Furthermore, the voltmeter functionality can help you check the state of signals that change slowly. The ammeter can be used to monitor the current flowing through a component to make sure that you don’t exceed its maximum rating.

voltmeter for troubleshooting

Consider investing in troubleshooting tools, like a voltmeter.

As your projects get more sophisticated, you should think about getting an oscilloscope — especially if you have a project with rapidly changing signals. The oscilloscope represents the voltage of a signal over time so that you can track whether it’s what you expect.

If you don’t have either of these tools, you can also utilize an LED with a built-in resistor to check whether a signal is high or low. However, that is a very crude method, and it’s only suitable for very simple tests.

Troubleshooting Checklist

Here’s a list of questions that you can use to troubleshoot your project. Not ready to commit them all to memory? Grab the Troubleshooting Checklist.

Hardware

  • Is it powered on?
  • Is the voltage correct?
  • Is the current limit of your power supply exceeded?
  • Are all the components correctly connected?
  • Are any components broken or faulty?
  • Are any of the connections loose?
  • Does it help if you gently push down on your circuit?
  • Are your ICs connected correctly and did you check the datasheet?
  • Do you fully understand what the ICs are supposed to do?
  • Is your design correct?

Software

  • Are there any endless loops where they don’t belong?
  • Does your code contain unreachable code?
  • Did you forget to initialize a variable?
  • Did you forget to call a method?
  • Which parts of your program are executed (try debug outputs)?
  • Is your program correct?

What are your favorite troubleshooting tips and tricks? Let us know in the comments!

Daniel Hertz
Hi! I am a software engineer and owner of nerdhut.de who loves to experiment with electronics, gadgets and tech in general.

Categories