Troubleshooting Your Arduino Electronics Project
If your Arduino electronics project isn’t working, you have to check both your hardware and your software. Start with your hardware and then move on to the software. Troubleshoot your electronics project by following these steps to check for the most common problems.
Troubleshooting hardware in a problematic electronics project
Review the following steps to check for hardware problems:
Check your hardware connections.
Look for open connections. The most frequent cause of problems is things simply being disconnected. Also check for short circuits. This can anywhere wires are touching or connected that they shouldn’t be. Make sure that you are using your Arduino’s digital inputs for sensors that give a digital output (either HIGH or LOW) and analog inputs for sensors that output a variable voltage.
Check your power.
Make sure that you have enough power then make sure it’s getting to the right place. Confirm your power indicator lights are on. If you are powering external components from your Arduino but they don’t seem to be working, try powering them independently from your Arduino by using a battery or external power supply.
Check for hot components and funny smells.
Locate any components that may be too hot to touch. They are probably wired incorrectly or receiving too much power. Sniff your components for anything that might seem to smell like burning. This is a definite indication of an incorrect connection, and you should disconnect the power right away. Replace any damaged components and recheck your circuit for incorrect connections before powering up.
Check your output values.
Use a multimeter to measure the voltages from your devices. Make sure that you are getting +5 volts for digital HIGH values and 0 volts for LOW values. Test your digital sensors to make sure they are outputting the correct values. Test your analog sensors to make sure they are providing a voltage that ranges from 0 to 5 volts.
Check your digital inputs and outputs.
If you have run too much current (more than 40mA) on a digital or analog pin, you’ve overdriven the pin, and it may have stopped operating. If you suspect a pin is dead, try using an adjacent pin by changing your code accordingly. If that solves the problem, you might have a dead pin.
Troubleshooting software in a problematic electronics project
Review the following steps to check for software problems:
Check your syntax.
The most common problem is a missing semicolon at the end of a line. Probably the second most common problem is a missing curly bracket. Also, look for typos, incorrect spelling, or a mismatch in capitals or lowercase text, because Arduino code is case sensitive. If there’s an error in your code, the IDE will usually highlight the line where the error occurred.
Use the serial monitor.
Use Serial.println() statements at key points in your code to output the contents of variables to the serial monitor. You can also print messages to the serial monitor at important points in your code. You may need to also add a delay() statement to provide a moment, so you can read the value(s) as they are printed to the screen.
Check your inputs and outputs.
Locate any components that may be too hot to touch. They are probably wired incorrectly or receiving too much power. Sniff your components for anything that might seem to smell like it’s burning. This is a definite indication of an incorrect connection and you should disconnect the power right away. Replace any damaged components and re-check your circuit for incorrect connections before powering up.
Use a simulator or emulator.
You can use Arduino simulators that mimic the behavior of the Arduino and emulators for the AVR chip family. These are technical tools aimed at engineers and give you a wealth of information about your code, as it’s running. Download one of these tools to try running your code on a virtual Arduino on your computer.
Check the forums.
The official Arduino website, Adafruit, Sparkfun, and Element14 have Arduino forums where people post discussions. Those communities are filled with people who just want to get their Arduinos to do cool stuff. They are almost always helpful and supportive.