5 Steps To Debugging Engineering Problems
Debugging 101: How Do I Debug Engineering Problems?
Wouldn’t it be great if everything worked perfectly the first time around?
But the reality is, most things don’t workout the way you would like the first time around.
This is a reality that engineers live with every single day.
One key skill that all engineers must have is the ability to debug problems.
Sometimes they are your own problems. Sometimes they are a problem another engineer has (sometimes this engineer might have even left the company and left the hard work for you!)
In this post I want to share briefly with you how I debug engineering problems.
I am an electrical engineer, but this basic process can be used for all types of engineering problems.
Why systems fail
In engineering we build systems. So first off we have to understand why systems fail.
Systems fail because of physics. Plain and simple.
If something you build does not work properly the first time around it is because of one of two things.
- You don’t understand the physics of the system you need to build.
- You understand the physics of the system but you made a mistake when designing it.
Most engineers will fall into category number 2. We are all human. Which means we make mistakes.
Step 1: Check your setup
So the first thing you should do when you find a problem in your system is to check your system setup.
You also want to capture data about the problem.
Ask yourself a series of questions.
- What is the output that I am seeing?
- What is the current setup of the system?
- What switches do I have on?
- What’s connected to the system?
- Is the power plugged in/turned on?
- What steps did I just take that made this result?
- Can I measure the output? (Voltage, current, stress, frequency etc.)
You must first understand the setup you are dealing with in order to debug it in a scientific way.
You will not believe the number of times I forgot to turn on power to a system, plug it in, connect a cable or even flip a switch.
They are little things which is why we miss them. But the little things can be what’s causing your problem.
Check your setup.
Step 2: Understand the physics
The next you want to do is think about the physics of the situation.
Remember that all engineers are really making systems that manipulate energy.
You are seeing the result you are seeing because the physics and energy of the system flowed in such a way to create that result.
Think about what basic physics governs your system. Could there be some capacitance that is delaying things? Too much resistance? Voltage is not getting to a certain point in the circuit?
Ask yourself a series of physics questions about your system to understand it better.
Step 3: Trace the data going backwards
You want to think about what would have to happen in the system to create this type of an output?
Start with what you know about the system, which is the current output you are seeing.
If your system has multiple blocks or subsystems in it, start with the block that drives the output you are interested in.
Ask yourself, “for the output to be X, what would the inputs to this block have to be?”
I then brainstorm all the potential causes for the output.
Based on what I brainstormed, I would then go and check the inputs to that block to see if they satisfy any one of the potential causes.
Keep working your way back through sub-blocks, verifying that the intended inputs and outputs are what you expect until you get to the end of the flow of data.
It is here that you will most likely find an error in the system. If you don’t, you need to brainstorm some more!
Step 4: Run a test
If the system I am debugging is too complex I sometimes like to strip away all functionality (if possible) and just test one simple piece of functionality.
This helps me to narrow down where the problem may be in the system.
If you test some basic functionality and it works that’s good. Then add on another tiny bit of functionality and see if the system still works.
You would keep doing this until the system breaks (which then you know you found a problem) or until you see the desired output.
Step 5: Fix the problem and test again
Once you think you have found the problem, come up with a fix and test it out.
What you will find is that sometimes your first fix doesn’t work. But that’s okay. That helps you to narrow down even more where the problem is.
Conclusion
Hopefully this gave you a little bit of insight into how engineers debug problems (at least how I go about it).
The main things here are to always check your setup, understand the physics of your system, follow the data flow backwards, apply fixes and test.
There are other things you can do to debug a system but I will leave those for another post.
If I really had to explain debugging in a nutshell, it’s that it’s a super scientific way of guessing and checking essentially.
I hope you enjoyed this post!
What’s Next?
A lot of young, graduating engineers struggle to get their first engineering job out of school. I created an ebook to help them.
If you or someone you know would like to have some guidance on how to get their first engineering job out of college, check out my ebook Get The Job First Then Send Your Resume.