This blog post on troubleshooting is an excerpt from Level A of our Intro to Robotics program. Level A covers building circuits, using a Raspberry Pi, and writing common code commands in Python. It contains 18 lessons including 70+ videos and 45 projects and activities. Sample lessons and a full scope and sequence for Level A can be found here.
When working with electronics and code, effective troubleshooting skill are important. There's a running joke that 95% of coding is troubleshooting why the code you wrote isn't working. While funny, it's also essentially true.
In Level A of our Intro to Robotics program, we teach you how to systematically troubleshoot and the method you learn can be applied to both electrical projects as well as coding.
There are four steps in the troubleshooting process:
- Verify there is a failure
- Check the simplest or most likely solution first and retest
- Half-splitting
- Repairing the problem and retesting
Verify There is a Failure
The first step in troubleshooting is understanding what type of output you should be seeing from your system. You might have an LED in a circuit that is being controlled by a pushbutton switch. The LED is off, so it looks like you might need to troubleshoot. But if pushing the button causes the LED to turn on, the circuit is operating exactly as expected, so there is no need to troubleshoot. If you pushed the button and the LED did not turn on, then you would need to proceed to the next step.
Check the Simplest (Most Likely) Solutions First and Retest
This step can save you a lot of time. Always try the simplest or quickest solution first. If your TV doesn’t turn on when you point the remote control and push the power button, which of these is the most likely solution?
- The TV has failed internally and should be disassembled for troubleshooting
- The batteries in the remote control are dead and should be replaced
Option A will take a couple hours, but option B will take less than a minute and could fix the problem. A battery replacement is also much more likely to be the problem, rather than a failure inside your TV.
In a breadboard circuit these easy solutions might take the form of the battery being improperly connected, or a jumper wire that’s only connected on one end.
Half-Splitting
If checking the easy solutions didn’t find the problem, then you will have to start searching. The half-splitting method is exactly what it sounds like, cutting the system in half to determine if the problem is in this half or that half. If the problem is determined to be in the first half, then you can cut that section in half again, to determine which portion of the first half contains the problem.
Imagine you have 100 carrots in your garden, and a you find that an underground gopher is eating them sequentially from 1 to 100.
Carrot 1 has been eaten and carrot 100 has not. You could start at 1 and pull 2, 3, 4, and so on, until you find the gopher, but he may be at carrot 85 by the time you find him. Or you could start at 100 and pull 99, 98,97, and so on, until you find the gopher. But he may only be on carrot 5 and now you just pulled 95 of your good carrots out of the ground. A better approach would be half-splitting:
- You’ve already determined that carrot 1 has been eaten and carrot 100 has not. Go check carrot 50 to see if it’s been eaten. You’ve just cut the search area in half!
- If it hasn’t been eaten, then you know the gopher is somewhere between 1 and 49.
- If it has been eaten, then he’s somewhere between 51 and 100.
- Let’s say, for this example, the carrot was not eaten, so you are now searching between 1 and 49. How do we cut this new search area in half? Carrot 25 will tell you if he’s made it there yet.
- If carrot 25 hasn’t been eaten, then the new search area is 1 through 24.
- If it has been eaten, then the new search area is 26-49.
By pulling only two carrots out of the ground you’ve eliminated 75% of the possible search area. Half-splitting is a very effective way to locate problems quickly!
Repair the Problem and Retest
Once the issue has been located, you should remedy it and retest to ensure that everything is now performing as expected. There may have been more than one component causing the problem. Just because you found a resistor plugged into the wrong breadboard hole, don’t assume that your LED will work properly as soon as that defect is remedied. There may have been more than one reason your LED wasn’t illuminating. This is especially important as the systems and circuits you troubleshoot become more complex.
Avoid making more than one change at a time before retesting! Multiple changes can heavily complicate the troubleshooting process. It’s best to isolate each change and understand the impact that change had on the failure before making other changes. Imagine that you have a light in your house that is controlled by one of ten light switches, but you’re not sure which one. You could flip all ten light switches on and go check the bulb, and it will be on, but you still won’t know exactly which switch controls that bulb. A more targeted approach would be to flip one switch and go check the bulb to see if it’s on. If not, then move onto the next switch. At some point in this process you will run across the exact switch controlling that bulb.
This blog post on troubleshooting is an excerpt from Level A of our Intro to Robotics program. Level A covers building circuits, using a Raspberry Pi, and writing common code commands in Python. It contains 18 lessons including 70+ videos and 45 projects and activities. Sample lessons and a full scope and sequence for Level A can be found here.