fatal error: SD.h: No such file or directory

I was working on trying out how to save .bin file in external EEPROM with Arduino Nano described in my post how to write a bin file to the EEPROM using Arduino? . When I compiled I forgot that I had to use SD library and I got compiling error as follows:

.. fatal error: SD.h: No such file or directory means that the Arduino IDE

 The error you're seeing:... fatal error: SD.h: No such file or directory means that the Arduino IDE cannot find the SD library

sd card

Here's how to fix it step-by-step:

✅ Step 1: Install the SD Library

  1. Open Arduino IDE.

  2. Go to the menu bar:
    Sketch → Include Library → Manage Libraries...

  3. In the Library Manager, search for “SD”.

  4. Find the official “SD” library by Arduino and click Install.

    sd card library

✅ Step 2: Check Your Board and SPI Pins

Make sure:

  • You're using an SD card module with proper wiring:

    • CS to pin 10 (or another pin if you define it)

    • MOSI to D11

    • MISO to D12

    • SCK to D13

  • Board selected is Arduino Nano (Tools → Board → Arduino AVR Boards → Arduino Nano)

✅ Step 3: Verify Again

After installing the SD library and wiring correctly:

  • Restart the IDE if needed.

  • Try compiling again — the error should be gone.

The error should be gone as shown below.

compiled sucessfully

 

Post a Comment

Previous Post Next Post