Jump to main content

Arduino Troubleshooting Guide

Arduino not working? Use this Arduino troubleshooting guide to diagnose and solve circuit, code, and connection issues.

Troubleshoot an Arduino project

Troubleshooting an Arduino Project

If you are working on an electronics or robotics project with Arduino and running into a problem, the problem may be related to the circuit, the connection between the Arduino and the computer, or the code you are using.

Solving a problem with an Arduino project requires troubleshooting! This step-by-step troubleshooting guide will help you learn how to find and fix common Arduino project errors in your circuit, code, or connections.

Identify the Problem

What exactly is happening? The first step in troubleshooting is to be clear about what you are observing or experiencing. Simply saying, "It doesn't work" isn't enough to help you (or someone helping you) effectively troubleshoot.

Ask yourself these questions:

Being clear about the answers to these questions can help you narrow in more quickly on the problem and, hopefully, the solution, so you can get your project back on track and working.

Troubleshoot Your Arduino Project

Review the Basics

Taking a bit of time to learn or review the basics can help you avoid common problems and more easily identify them when something isn't working the way you expect.

If something is going wrong, you need to first confirm that the Arduino has power and is working.

One way to make sure the Arduino works is to disconnect all external wires/circuits from the Arduino and run the basic "Blink" example code (Files > Examples > Basics > Blink). (Tip! This is covered in Video 1 of the How to Use an Arduino tutorial.) The "Blink" program simply blinks the onboard LED on and off. If this program works, then you know your Arduino is functional and properly connected to your computer.

Check the Board Selection

If you cannot get the Blink example code to run, you need to make sure your Arduino is communicating with your computer.

Select the Arduino board in the Arduino IDE
Note: This troubleshooting guide references the Arduino IDE when talking about the interface that you use to write your code and upload it to the Arduino. Whether you have installed the desktop version or are using the cloud-based version, you will need to check or do the things noted. Depending on the version you are using, please be aware that there may be some differences in the interface, including the location of appearance of various tools.

Troubleshoot Connection Issues

If your Arduino is not being detected by the Arduino IDE (on your computer), make sure the connection between the computer and the Arduino is working. Here is a list of things to check or try:

If your Arduino is being recognized by your computer, and you are still having a problem with your project, you will need to continue troubleshooting to determine if the problem is with the code or with the circuit.

Make Sure to "Save" and "Upload" Your Code

Did you save your code? Did you upload it to the Arduino? Both of these steps are important! If you made any changes to your code, you need to make sure you save the code. You also have to make sure to upload the code to the Arduino.

If you downloaded and installed the desktop version of the Arduino IDE, you will need to manually save your code by selecting File > Save from the menu at the top. When using the desktop software, it will not auto-save like Google Docs or other cloud programs. If you close and re-open the Arduino IDE without saving first, you will have to re-enter the code (and any changes you made) when you open the software again to work on your project.

Note: If you are using Arduino Cloud, your work in the Cloud Editor will be automatically saved.

Once you have saved your program, the next time you launch the IDE, you can select File > Open and navigate to wherever you saved the code (it will be a file with a ".ino" extension) on your computer.

To send your program to your Arduino, click the "arrow" to upload.

Upload arrow in the Arduino IDE
Note: If using Arduino Cloud, you may need to download and install a plugin to be able to upload your code from Arduino Cloud to your board. Follow the instructions in the editor.

Check the Serial Monitor Output

When enabled, the serial monitor allows you to see data from your Arduino in real time. Exactly what is displayed in the serial monitor will depend on the project, but it is frequently used to display a measurement from a sensor. This measurement should change when the input to the sensor changes. If the reading is always zero, or remains constant even when you change the input to the sensor, then something may be wrong with your circuit.

Does the project's code include output to the serial monitor? If so, what is displayed in the serial monitor? Checking the serial monitor can help you confirm whether or not your circuit is working properly.

How do you do this? Look at your code to see if it contains Serial.begin and Serial.print commands. These commands may be commented out by default, meaning they will not run, so you need to uncomment them to print to the serial monitor. For example, the code shown below notes that you can uncomment the Serial.begin line to help with debugging:

Serial monitor code that needs to be uncommented

To uncomment something in a program you are working on in the Arduino IDE, remove the // marks, save the file, and re-upload. (Note: In this example, the code contains several lines that need to be uncommented for troubleshooting (not just the one shown here), so be sure to carefully look through your code.)

Select Tools/Serial monitor to open the serial monitor and view its output.

Screenshot in Arduino IDE showing values in the serial monitor output

Now that you have made the serial monitor output visible, what does the serial monitor show? If the serial monitor output shows a sensor reading, does the reading change when you change the input to the sensor, for example, if you hold your hand over a light sensor? In the image below, the serial monitor shows readings that are changing.

Screenshot in Arduino IDE showing values in the serial monitor output

If the serial monitor always shows all zeroes, as in the image below, or the reading remains constant even when you change the input to the sensor, it most likely means that something in your circuit is not connected properly. Double-check the circuit diagram in the project to make sure your sensor is connected properly.

Screenshot in Arduino IDE showing zeroes in the serial monitor output

Check for General Coding Issues

Are you seeing a compilation error when you run your program, or is it simply not working as expected? This is an important detail. If you are seeing an error on the screen, that information will be important in helping you debug your program. If the program simply isn't doing what you expect, you will need to check all aspects of your code and circuit to find the problem.

Did you make any changes to the starter/sample code that was provided in the project? If you are doing a project from Science Buddies, and you didn't make any changes, and you are sure you saved and uploaded the program, then the problem is likely not a coding problem. (It is more likely a connection issue. See the troubleshooting steps above.)

Both syntax errors and other coding problems will show up as "compilation errors" when you try to upload the code. Information about the error will be shown in the output window. As you can see from the image below, the error is identified multiple times in the "Output" window, and the relevant section of code is highlighted to help you pinpoint the location of the problem.

Screenshot in Arduino IDE showing syntax error

Here are some common coding and syntax errors to be aware of:

Screenshot in Arduino IDE showing semicolons in blocks and in statements
Screenshot in Arduino IDE showing syntax error with a missing bracket
Screenshot in Arduino IDE showing braces
Screenshot in Arduino IDE showing loop
Screenshot in Arduino IDE showing syntax error with a missing quotation mark

For more information about programming in Arduino, see: Arduino Language Reference.

Additional Errors

If you are seeing an on-screen error, then you need to focus your troubleshooting on understanding and fixing that error. This may require searching online for more information about the error.

Here are some other common errors that you may encounter:

Arduino error / Wrong board selected

Arduino error / No USB
Arduino error / Wrong board selected

Check the Circuit Wiring

Even one misplaced element in a circuit can cause the circuit to not work properly. If your project is not working, it is important to go back through, step by step, and double check that all of your wires on the breadboard match the wiring diagram in the project.

Depending on the difficulty of the project, you may have been given a slideshow or illustration showing the placement of each part. For more advanced projects, you will generally only see a circuit diagram. Advanced projects assume you have experience with circuits and will be able to follow the diagram.

Sometimes it is possible to test individual components of your circuit hardware without relying on code. For example, you can connect an LED (with a current-limiting resistor) directly to the Arduino's 5V pin instead of using a digital pin to blink it on and off. This will help you confirm that the LED is working. For some sensors, you can use a multimeter or an oscilloscope to measure their output directly instead of relying on the Arduino digitalRead and analogRead functions. This can help confirm that your sensors are working properly.

It is especially important to understand how the holes in a breadboard are connected. Refer to the How to Use a Breadboard tutorial, as needed. You may also want to review the Common mistakes and troubleshooting section.

Get Help at Ask an Expert

If you are still having trouble, you can post for assistance in the Ask an Expert forums. Be sure to identify which project you are doing (include the URL), what troubleshooting steps you have taken, and any changes you have made to the code. You will most likely be asked to upload a few close-up and clear photos of your circuit, as close as possible and looking straight down at the circuit so that the elements can be seen. Make sure your circuit is as neat as possible. Sometimes tall parts and long wires can hide connections from view, so you may need to take multiple photos from slightly different angles.

When posting at Ask an Expert for assistance, be sure to note or include:

Top
Free science fair projects.