Common Arduino & Raspberry Pi Errors and How to Fix Them

Both Arduino and Raspberry Pi are widely used for DIY electronics, robotics, and IoT projects. However, beginners and even experienced users often encounter common errors. This guide covers frequent issues and their solutions for both platforms.


1. Common Arduino Errors & Fixes

1.1. Arduino Not Connecting to the Computer

Error: "Board not detected" or "COM port not found."
🔹 Possible Causes:

  • Faulty USB cable (especially power-only cables).
  • Wrong board selected in the Arduino IDE.
  • Missing or corrupt drivers (Windows).

🔧 Fix:

  1. Use a different USB cable (ensure it's a data cable).
  2. Open Arduino IDE → Tools → Board and select the correct board.
  3. Check the COM port under Tools → Port.
  4. Install/update the USB driver for your board:
    • For Arduino Uno/Nano (CH340 Chipset): Install the CH340 driver.
    • For Arduino Mega/Official Uno: Install the Arduino USB driver from arduino.cc.

1.2. Arduino Sketch Not Uploading

Error: "avrdude: stk500_recv(): programmer is not responding"
🔹 Possible Causes:

  • Wrong COM port or board selected.
  • Code using Serial Monitor incorrectly.
  • A conflicting device is connected to RX/TX pins.

🔧 Fix:

  1. Unplug all devices from pins 0 and 1 (RX/TX).
  2. Ensure the correct board and COM port are selected in Arduino IDE.
  3. Press and hold the RESET button while clicking "Upload" in the IDE.
  4. Try uploading a simple blink sketch to verify if the board works.

1.3. "Low Memory" or "Sketch Too Big" Error

Error: "Sketch uses 99% of program storage space. Low memory available."
🔹 Possible Causes:

  • Too many libraries included.
  • Large variable arrays taking up RAM.
  • Using floating point operations excessively.

🔧 Fix:

  1. Remove unused libraries and optimize your code.
  2. Use smaller data types (byte instead of int when possible).
  3. Store large text/arrays in PROGMEM (Flash memory) instead of RAM.

1.4. Sensors Not Working with Arduino

Error: Sensor does not return data or returns wrong values.
🔹 Possible Causes:

  • Wrong wiring or incorrect I2C/SPI connections.
  • Incorrect library or wrong address in the code.

🔧 Fix:

  1. Check sensor wiring with a datasheet.
  2. Use Wire.h and run this I2C scanner to detect devices:
    #include <Wire.h>
    void setup() {
        Serial.begin(115200);
        Wire.begin();
        Serial.println("Scanning...");
        for (byte address = 8; address < 120; address++) {
            Wire.beginTransmission(address);
            if (Wire.endTransmission() == 0) {
                Serial.print("Found I2C device at 0x");
                Serial.println(address, HEX);
            }
        }
    }
    void loop() {}
    
  3. Make sure the sensor library matches your model.

1.5. PWM Not Working on Certain Pins

Error: AnalogWrite() does not work on some pins.
🔹 Possible Causes:

  • Not all pins support PWM output.
  • Timer conflicts when using multiple PWM devices.

🔧 Fix:

  1. Check the Arduino PWM pins for your board.
  2. Use alternative PWM pins if one does not work.
  3. If using a servo or other PWM device, try a Servo library instead of analogWrite().

2. Common Raspberry Pi Errors & Fixes

2.1. Raspberry Pi Not Booting

Error: Black screen or red LED stuck on.
🔹 Possible Causes:

  • Corrupt microSD card.
  • Insufficient power supply.

🔧 Fix:

  1. Use a high-quality SD card (16GB or higher, Class 10).
  2. Reflash the card using Raspberry Pi Imager with the latest OS.
  3. Use a 5V/3A power adapter (low-power adapters cause boot failures).

2.2. No HDMI Display Output

Error: "No Signal" or black screen on monitor.
🔹 Possible Causes:

  • Incorrect HDMI cable or port.
  • Wrong resolution settings.

🔧 Fix:

  1. Try using HDMI-0 (on Raspberry Pi 4) instead of HDMI-1.
  2. Add the following to /boot/config.txt:
    hdmi_force_hotplug=1
    hdmi_drive=2
    hdmi_group=1
    hdmi_mode=16
    
  3. Use a different HDMI cable or monitor.

2.3. Wi-Fi Not Working on Raspberry Pi

Error: Cannot connect to Wi-Fi or Wi-Fi drops frequently.
🔹 Possible Causes:

  • Weak signal or wrong country settings.
  • Power-saving mode disabling Wi-Fi.

🔧 Fix:

  1. Set the correct Wi-Fi country in raspi-config.
  2. Disable Wi-Fi power saving:
    sudo nano /etc/rc.local
    
    Add this before exit 0:
    iw dev wlan0 set power_save off
    

2.4. "Could Not Open Port /dev/ttyS0" (UART Error)

Error: Unable to communicate with a serial device (e.g., GPS, Arduino).
🔹 Possible Causes:

  • Serial console interfering with UART.

🔧 Fix:

  1. Disable serial console:

    sudo raspi-config
    
    • Go to Interface Options → Serial Port
    • Disable login shell but enable serial port.
  2. Reboot and check the port with:

    ls /dev/serial*
    

2.5. GPIO Pins Not Responding

Error: GPIO pins do not toggle high/low.
🔹 Possible Causes:

  • Wrong GPIO numbering in the script.
  • Conflicting services (e.g., using I2C or SPI on the same pins).

🔧 Fix:

  1. Use the correct BCM pin numbering:
    import RPi.GPIO as GPIO
    GPIO.setmode(GPIO.BCM)  # NOT GPIO.BOARD
    
  2. Check if I2C or SPI is enabled and using the same pins.
  3. Run the following to reset the GPIO state:
    sudo gpio reset
    

Final Thoughts

Both Arduino and Raspberry Pi are powerful tools, but errors can be frustrating. By following these troubleshooting steps, you can quickly identify and fix common problems in your projects.

If you're facing any specific issues, feel free to ask in the comments! 🚀

Leave a comment

Notice an Issue? Have a Suggestion?
If you encounter a problem or have an idea for a new feature, let us know! Report a problem or request a feature here.