Can't initialize SD card on Nano

Hello, I'm trying to make a custom pc switch. I originally intended to use a key lock mechanism to pass power to a button which would turn the PC on by sending a signal to an arduino, which would play a fanfare. For now, I have a button, which makes the arduino turn on transistor, which turns on my PC and shows text on a small LCD screen. I now wanted to add a speaker and a micro SD card module to load audio from. The problem is that the damn thing doesn't work. I'm afraid it's because I didn't buy an official arduino, but ordered one from Aliexpress instead.

This is my schematic:

And this is the code I'm trying to run:

#include <SD.h>                      // need to include the SD library
//#define SD_ChipSelectPin 53  //example uses hardware SS pin 53 on Mega2560
#define SD_ChipSelectPin 4  //using digital pin 4 on arduino nano 328, can use other pins
#include <TMRpcm.h>           //  also need to include this library...
#include <SPI.h>

TMRpcm tmrpcm;   // create an object for use in this sketch


void setup(){

  tmrpcm.speakerPin = 9; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc

  Serial.begin(9600);
  if (!SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
    Serial.println("SD fail");  
    return;   // don't do anything more if not
  }
  tmrpcm.play("startup.wav"); //the sound file "music" will play each time the arduino powers up, or is reset
}



void loop(){  

  if(Serial.available()){    
    if(Serial.read() == 'p'){ //send the letter p over the serial monitor to start playback
      tmrpcm.play("startup.wav");
    }
  }

}

If it helps, here's my original script which includes displaying stuff on screen:

#include <pcmConfig.h>
#include <pcmRF.h>
#define SD_ChipSelectPin 4  //using digital pin 4 on arduino nano 328, can use other pins
#include <TMRpcm.h>           //  also need to include this library...
#include <SPI.h>

TMRpcm tmrpcm;   // create an object for use in this sketch

/**************************************************************************
 This is an example for our Monochrome OLEDs based on SSD1306 drivers

 Pick one up today in the adafruit shop!
 ------> http://www.adafruit.com/category/63_98

 This example is for a 128x32 pixel display using I2C to communicate
 3 pins are required to interface (two I2C and one reset).

 Adafruit invests time and resources providing this open
 source code, please support Adafruit and open-source
 hardware by purchasing products from Adafruit!

 Written by Limor Fried/Ladyada for Adafruit Industries,
 with contributions from the open source community.
 BSD license, check license.txt for more information
 All text above, and the splash screen below must be
 included in any redistribution.
 **************************************************************************/
 
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// The pins for I2C are defined by the Wire-library. 
// On an arduino UNO:       A4(SDA), A5(SCL)
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
// On an arduino LEONARDO:   2(SDA),  3(SCL), ...
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define NUMFLAKES     10 // Number of snowflakes in the animation example

#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16
static const unsigned char PROGMEM logo_bmp[] =
{ 0b00000000, 0b11000000,
  0b00000001, 0b11000000,
  0b00000001, 0b11000000,
  0b00000011, 0b11100000,
  0b11110011, 0b11100000,
  0b11111110, 0b11111000,
  0b01111110, 0b11111111,
  0b00110011, 0b10011111,
  0b00011111, 0b11111100,
  0b00001101, 0b01110000,
  0b00011011, 0b10100000,
  0b00111111, 0b11100000,
  0b00111111, 0b11110000,
  0b01111100, 0b11110000,
  0b01110000, 0b01110000,
  0b00000000, 0b00110000 };

  // 'logo', 128x32px
static const unsigned char myBitmaplogo [] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x01, 0xe0, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x02, 0x1f, 0xf8, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x02, 0xd0, 0x0b, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x02, 0xd0, 0x0b, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x02, 0x10, 0x08, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x05, 0xe0, 0x07, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x10, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x20, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x20, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x30, 0x00, 0x00, 0x01, 0x0f, 0x10, 0x47, 0xc7, 0x1f, 0x3e, 0x7c, 0x38, 0x07, 0x8f, 0xc0, 
  0x00, 0x5c, 0x00, 0x00, 0x07, 0x10, 0x90, 0x44, 0x08, 0x84, 0x20, 0x42, 0x44, 0x08, 0x40, 0x40, 
  0x00, 0x4b, 0xc0, 0x00, 0x3b, 0x20, 0x10, 0x44, 0x08, 0x04, 0x20, 0x42, 0x40, 0x10, 0x00, 0x80, 
  0x00, 0x24, 0x3f, 0xff, 0xc5, 0x20, 0x10, 0x44, 0x04, 0x04, 0x20, 0x42, 0x20, 0x10, 0x01, 0x00, 
  0x00, 0x23, 0xe4, 0x08, 0x8a, 0x20, 0x1f, 0xc7, 0x82, 0x04, 0x3c, 0x44, 0x10, 0x10, 0x01, 0x00, 
  0x00, 0x10, 0x27, 0xf8, 0xf2, 0x20, 0x10, 0x44, 0x01, 0x04, 0x20, 0x78, 0x08, 0x10, 0x02, 0x00, 
  0x00, 0x08, 0x24, 0x08, 0x84, 0x20, 0x10, 0x44, 0x00, 0x84, 0x20, 0x44, 0x04, 0x10, 0x04, 0x00, 
  0x00, 0x04, 0x18, 0x08, 0x88, 0x20, 0x10, 0x44, 0x00, 0x84, 0x20, 0x44, 0x04, 0x10, 0x04, 0x00, 
  0x00, 0x02, 0x00, 0x07, 0x10, 0x10, 0x90, 0x44, 0x09, 0x04, 0x20, 0x42, 0x48, 0x08, 0x48, 0x00, 
  0x00, 0x01, 0xf0, 0x00, 0x20, 0x0f, 0x10, 0x47, 0xc6, 0x04, 0x3e, 0x42, 0x30, 0x87, 0x8f, 0xc0, 
  0x00, 0x02, 0x0e, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x04, 0x01, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x08, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x10, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x20, 0xff, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x27, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x18, 0x00, 0x3e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

// 'god dammit kris', 128x32px
const unsigned char god_dammit_kris [] PROGMEM = {
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x03, 0xff, 0xff, 0xff, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xfb, 0xfe, 0x07, 0xff, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0xf7, 0xf9, 0xf9, 0xff, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xd7, 0xf7, 0xfe, 0xff, 
  0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xcf, 0xf7, 0xb8, 0x77, 0xfe, 0xff, 
  0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xbf, 0xfb, 0x7f, 0x6f, 0xff, 0x7f, 
  0xdb, 0x78, 0xe6, 0x31, 0x8c, 0x5c, 0x7f, 0xff, 0xf7, 0xfe, 0x7f, 0x80, 0x84, 0xdd, 0x1f, 0xbf, 
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xff, 0xff, 0xff, 0xff, 0xfc, 0xfe, 0x7f, 0x83, 0xef, 0xfc, 0xa1, 0xff, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1d, 0xff, 0xf7, 0x8f, 0xfb, 0xbe, 0xff, 
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xe0, 0x7f, 0xf8, 0x00, 0xff
};

const unsigned char god_dammit_kris_inverted [] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x01, 0xf8, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x08, 0x06, 0x06, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x28, 0x08, 0x01, 0x00, 
  0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x30, 0x08, 0x47, 0x88, 0x01, 0x00, 
  0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x40, 0x04, 0x80, 0x90, 0x00, 0x80, 
  0x24, 0x87, 0x19, 0xce, 0x73, 0xa3, 0x80, 0x00, 0x08, 0x01, 0x80, 0x7f, 0x7b, 0x22, 0xe0, 0x40, 
  0x23, 0x04, 0xa5, 0x29, 0x4a, 0x22, 0x00, 0x00, 0x08, 0x02, 0x00, 0x09, 0x14, 0x25, 0xa0, 0x40, 
  0x27, 0x84, 0xa5, 0xce, 0x4b, 0x23, 0x00, 0x00, 0x08, 0x02, 0x18, 0x7e, 0xf8, 0x28, 0x9c, 0x40, 
  0x23, 0x04, 0xa5, 0x0a, 0x4a, 0x22, 0x00, 0x00, 0x08, 0x06, 0x10, 0x80, 0x04, 0x28, 0x02, 0x40, 
  0x24, 0x87, 0x19, 0x09, 0x73, 0xbb, 0x80, 0x00, 0x08, 0x7d, 0x0f, 0x20, 0x52, 0x28, 0x02, 0x40, 
  0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x93, 0x01, 0x7f, 0x02, 0x28, 0xe2, 0x40, 
  0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x8c, 0x01, 0x00, 0xf2, 0x26, 0x06, 0x40, 
  0x20, 0x04, 0xb9, 0xce, 0xe0, 0x82, 0x00, 0x00, 0x08, 0x98, 0x03, 0xc0, 0x04, 0x19, 0x89, 0x80, 
  0x20, 0x05, 0x24, 0x90, 0x40, 0x82, 0x60, 0x44, 0x08, 0x60, 0x04, 0x3f, 0xf8, 0x09, 0x76, 0x00, 
  0x20, 0x06, 0x38, 0x8c, 0x40, 0xa6, 0xa0, 0xea, 0x08, 0x20, 0x78, 0x10, 0x40, 0x06, 0x19, 0x00, 
  0x20, 0x05, 0x28, 0x82, 0x40, 0xca, 0xc0, 0x4a, 0x08, 0x23, 0xa0, 0x60, 0x80, 0x08, 0x24, 0x80, 
  0x20, 0x04, 0xa5, 0xdc, 0xe0, 0xa6, 0x70, 0x64, 0x08, 0x24, 0xa7, 0x80, 0x80, 0x08, 0xc7, 0x80, 
  0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0xb8, 0x80, 0x80, 0x13, 0x04, 0x80, 
  0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0c, 0xe0, 0x80, 0x40, 0x1d, 0x0a, 0x80, 
  0x20, 0x04, 0xa5, 0xc8, 0x98, 0x39, 0xd1, 0x73, 0x88, 0x03, 0x00, 0x80, 0x40, 0x09, 0x0a, 0x80, 
  0x20, 0x05, 0x25, 0x28, 0xa4, 0x0a, 0x1b, 0x44, 0x48, 0x00, 0xd4, 0x80, 0x20, 0x08, 0xf2, 0x80, 
  0x20, 0x06, 0x25, 0xc8, 0xbc, 0x09, 0x95, 0x61, 0x88, 0x00, 0xab, 0xc0, 0x18, 0x09, 0x04, 0x40, 
  0x20, 0x05, 0x25, 0x45, 0x24, 0x28, 0x51, 0x40, 0x08, 0x00, 0x94, 0x20, 0x04, 0x11, 0x04, 0x40, 
  0x20, 0x04, 0x99, 0x22, 0x24, 0x33, 0x91, 0x71, 0x08, 0x01, 0x08, 0x1f, 0x0e, 0x09, 0x04, 0x80, 
  0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x02, 0x02, 0x00, 0xf0, 0x06, 0x03, 0x00, 
  0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x04, 0x02, 0x00, 0x80, 0x01, 0x9c, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x98, 0x1d, 0x00, 0x60, 0x01, 0x64, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xe0, 0x60, 0x80, 0x10, 0x02, 0x42, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x80, 0x7c, 0x10, 0x03, 0x5e, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x08, 0x70, 0x04, 0x41, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1f, 0x80, 0x07, 0xff, 0x00
};

static const unsigned char smol_logo [] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xe0, 0x07, 0x80, 0x00, 0x02, 
  0x1f, 0xf8, 0x40, 0x00, 0x02, 0xd0, 0x0b, 0x40, 0x00, 0x02, 0xd0, 0x0b, 0x40, 0x00, 0x02, 0x10, 
  0x08, 0x60, 0x00, 0x05, 0xe0, 0x07, 0x98, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 
  0x02, 0x00, 0x20, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x01, 0x00, 0x30, 0x00, 0x00, 0x01, 
  0x00, 0x5c, 0x00, 0x00, 0x07, 0x00, 0x4b, 0xc0, 0x00, 0x3b, 0x00, 0x24, 0x3f, 0xff, 0xc5, 0x00, 
  0x23, 0xe4, 0x08, 0x8a, 0x00, 0x10, 0x27, 0xf8, 0xf2, 0x00, 0x08, 0x24, 0x08, 0x84, 0x00, 0x04, 
  0x18, 0x08, 0x88, 0x00, 0x02, 0x00, 0x07, 0x10, 0x00, 0x01, 0xf0, 0x00, 0x20, 0x00, 0x02, 0x0e, 
  0x00, 0x40, 0x00, 0x04, 0x01, 0xff, 0x80, 0x00, 0x08, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 
  0x80, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x20, 0xff, 0x80, 0x40, 0x00, 0x27, 0x00, 0x40, 0x40, 
  0x00, 0x18, 0x00, 0x3e, 0x40, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

const unsigned char amogus [][20] PROGMEM = {
  {
    0x00, 0x00, 0x7e, 0x00, 0x91, 0x00, 0xa1, 0x00, 0x40, 0x80, 0x40, 0x80, 0x26, 0x80, 0x19, 0x00, 
    0x10, 0x00, 0x00, 0x00
  },
  {
    0x07, 0x00, 0x78, 0x80, 0xa0, 0x40, 0xc0, 0x40, 0x40, 0x40, 0x20, 0x40, 0x22, 0x80, 0x15, 0x00, 
    0x18, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x7e, 0x00, 0x89, 0x80, 0x90, 0x40, 0xe0, 0x40, 0x20, 0x40, 0x20, 0x80, 0x17, 0x00, 
    0x18, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x38, 0x00, 0x47, 0x00, 0x48, 0x80, 0x50, 0x40, 0x20, 0x40, 0x20, 0x40, 0x20, 0x80, 
    0x1f, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x3c, 0x00, 0x47, 0x00, 0xbc, 0x80, 0x40, 0x40, 0x40, 0x80, 0x40, 0x80, 0x67, 0x00, 
    0x18, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x3e, 0x00, 0xe1, 0x00, 0xc0, 0x80, 0x40, 0x80, 0x40, 0x80, 0x22, 0x80, 0x25, 0x00, 
    0x18, 0x00, 0x00, 0x00
  }
};

const unsigned char amogus_big [][128] PROGMEM = {
  {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xe0, 0x00, 0x03, 0xe0, 0x18, 0x00, 
    0x0c, 0x80, 0x06, 0x00, 0x11, 0x00, 0x01, 0x00, 0x22, 0x00, 0x00, 0x80, 0x24, 0x00, 0x00, 0x80, 
    0x44, 0x00, 0x00, 0x40, 0x44, 0x00, 0x00, 0x20, 0x7c, 0x00, 0x00, 0x20, 0x8c, 0x00, 0x00, 0x20, 
    0xf4, 0x00, 0x00, 0x10, 0x24, 0x00, 0x00, 0x10, 0x14, 0x00, 0x00, 0x10, 0x14, 0x00, 0x00, 0x10, 
    0x0c, 0x00, 0x00, 0x10, 0x0c, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x10, 
    0x02, 0x00, 0x00, 0x10, 0x01, 0x00, 0x08, 0x10, 0x01, 0x00, 0x34, 0x20, 0x00, 0x80, 0xc2, 0x20, 
    0x00, 0x41, 0x03, 0xc0, 0x00, 0x42, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x01, 0x80, 0xe0, 0x01, 0xfe, 0x00, 0x10, 
    0x0e, 0x08, 0x00, 0x08, 0x12, 0x10, 0x00, 0x04, 0x22, 0x20, 0x00, 0x02, 0x41, 0xc0, 0x00, 0x01, 
    0x40, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x01, 0x70, 0x00, 0x00, 0x01, 0x88, 0x00, 0x00, 0x01, 
    0x90, 0x00, 0x00, 0x01, 0x60, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x01, 
    0x04, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x02, 
    0x00, 0x80, 0x00, 0x04, 0x00, 0x80, 0x00, 0x08, 0x00, 0x40, 0x0e, 0x10, 0x00, 0x40, 0x71, 0x30, 
    0x00, 0x40, 0x81, 0xc0, 0x00, 0x21, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x07, 0xff, 0xfe, 0x00, 0x18, 0x80, 0x41, 0xc0, 0x21, 0x00, 0x80, 0x30, 0x21, 0x03, 0x00, 0x08, 
    0x40, 0x84, 0x00, 0x06, 0x40, 0x78, 0x00, 0x02, 0x70, 0x00, 0x00, 0x01, 0x88, 0x00, 0x00, 0x01, 
    0x88, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x01, 
    0x08, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x02, 
    0x01, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x10, 0x00, 0x40, 0x00, 0x20, 
    0x00, 0x2f, 0xfe, 0xc0, 0x00, 0x21, 0x01, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
    0x00, 0x60, 0x00, 0x00, 0x03, 0x9e, 0x00, 0x00, 0x0c, 0x61, 0xf8, 0x00, 0x10, 0x80, 0x27, 0x00, 
    0x10, 0x80, 0x10, 0x80, 0x20, 0x80, 0x60, 0x60, 0x20, 0x41, 0x80, 0x10, 0x38, 0x26, 0x00, 0x08, 
    0x48, 0x18, 0x00, 0x04, 0x70, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x02, 0x08, 0x80, 0x00, 0x02, 
    0x05, 0x80, 0x00, 0x01, 0x05, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x01, 
    0x02, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x04, 
    0x02, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x0f, 0x00, 
    0x00, 0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 
    0x07, 0x39, 0xc0, 0x00, 0x08, 0x1f, 0x3c, 0x00, 0x10, 0x60, 0x83, 0x00, 0x20, 0x80, 0x40, 0xc0, 
    0x20, 0x80, 0x20, 0x20, 0x30, 0x80, 0x40, 0x10, 0x48, 0x41, 0x80, 0x08, 0x51, 0x46, 0x00, 0x08, 
    0x26, 0x38, 0x00, 0x04, 0x14, 0x00, 0x00, 0x04, 0x08, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x04, 
    0x10, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x08, 
    0x20, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 
    0x06, 0x00, 0x07, 0xc0, 0x01, 0x80, 0x78, 0x00, 0x00, 0x41, 0x80, 0x00, 0x00, 0x3e, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 
    0x07, 0x3f, 0xfc, 0x00, 0x08, 0x20, 0x03, 0x00, 0x11, 0xc0, 0x00, 0x80, 0x21, 0x00, 0x00, 0x40, 
    0x42, 0x00, 0x00, 0x40, 0x64, 0x00, 0x00, 0x20, 0x94, 0x00, 0x00, 0x20, 0xe8, 0x00, 0x00, 0x10, 
    0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 
    0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10, 
    0x02, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x10, 0x01, 0x00, 0x0c, 0x20, 0x01, 0x00, 0x32, 0x20, 
    0x00, 0x80, 0xc3, 0xe0, 0x00, 0x41, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  }
};

int pcswitchPin = 2;
int localswitchPin = 3;
int pcswitch = 0;

int x = 64;
int y = 16;
int timestamp = 0; //test mode
bool goingright = true;
bool goingup = true;
int frame = 0;


void setup() {
  pinMode(pcswitchPin, OUTPUT);
  pinMode(localswitchPin, INPUT_PULLUP);
  Serial.begin(9600);

  tmrpcm.speakerPin = 9; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }



  // Clear the buffer
  display.clearDisplay();

  // Draw a single pixel in white
  // display.drawPixel(10, 10, SSD1306_WHITE);

  // Show the display buffer on the screen. You MUST call display() after
  // drawing commands to make them visible on screen!
  
  drawcustombitmap();
  display.display();
  delay(2000);
  
  // display.display() is NOT necessary after every single drawing command,
  // unless that's what you want...rather, you can batch up a bunch of
  // drawing operations and then update the screen all at once by calling
  // display.display(). These examples demonstrate both approaches...


  //TODO: drawcustomtext();
  
  //testdrawbitmap();    // Draw a small bitmap image

  //testdrawchar();      // Draw characters of the default font

  //testdrawstyles();    // Draw 'stylized' characters
  //digitalWrite(pcswitchPin, HIGH);
}

void loop() {
  while(true){
    display.clearDisplay();
    pcswitch = digitalRead(localswitchPin);
    // pcswitch = 0 if pushed, 1 if released
    
    if(pcswitch==1){
      if (frame > 30000) frame = frame - 30000;

      if (timestamp < 1000){
        if (timestamp < 900) {
          display.clearDisplay();
          drawkris_inverted();
          display.display();
          /* original code
           * display.setTextSize(2);
           * display.setTextColor(SSD1306_WHITE);
           * display.setCursor(32, 12);
           * display.println(F("ready."));
           * display.display();
           */
        } else {
          display.clearDisplay();
          display.setTextSize(2);
          display.setTextColor(SSD1306_WHITE);
          display.setCursor(20, 12);
          display.println(F("standby"));
          display.display();
        }
        timestamp++;
      }
      else {
        
        if (x > 117 || x < 1) {goingright = !goingright;}
        if (y > 21  || y < 1) {goingup    = !goingup;}

        if (goingright == true) {
          x = x + 1;
        } else {
          x = x - 1;
        }

        if (goingup == true) {
          y = y + 1;
        } else {
          y = y - 1;
        }
        
        display.clearDisplay();
        display.drawBitmap(x, y, amogus[frame%6], 10, 10, WHITE);
        frame++;
        display.display();
        delay(30);
      }
    } else {
      digitalWrite(pcswitchPin, HIGH); 
      pcswitch = digitalRead(localswitchPin);
      while (pcswitch == 0) {
        display.clearDisplay();
        display.setTextSize(2);
        display.setTextColor(SSD1306_WHITE);
        display.setCursor(32, 12);
        display.println(F("henlo!"));
        display.display();
        delay(100);
        pcswitch = digitalRead(localswitchPin);
      }
      digitalWrite(pcswitchPin, LOW);
      delay(250);

      display.clearDisplay();
      display.setTextSize(2);
      display.setTextColor(SSD1306_WHITE);
      display.setCursor(18, 12);
      display.println(F("gg, thx."));
      display.display();
      delay(1500);
      timestamp = 0;
      
        if (SD.begin(SD_ChipSelectPin)) {  // see if the card is present and can be initialized:
          tmrpcm.stopPlayback();
          switch (round(random()*3)) { //the sound file "music" will play each time the arduino powers up, or is reset
            case 0:
              tmrpcm.play("startup.wav");
              break;
            case 1:
              tmrpcm.play("startup2.wav");
              break;
            case 2:
              tmrpcm.play("startup3.wav");
              break;
            
          }
        } else {
          Serial.println("SD failed");
          }
        }
    }
  }



void drawlogoincorner(void) {
  display.drawBitmap(8, 0, smol_logo, 33, 32, WHITE);
}

void drawcustombitmap(void) {
  display.drawBitmap(0, 0, myBitmaplogo, 128, 32, WHITE);
}

void drawkris(void){
  display.drawBitmap(0, 0, god_dammit_kris, 128, 32, WHITE);
}

void drawkris_inverted(void){
  display.drawBitmap(0, 0, god_dammit_kris_inverted, 128, 32, WHITE);
}

void testdrawbitmap(void) {
  display.clearDisplay();

  display.drawBitmap(
    (display.width()  - LOGO_WIDTH ) / 2,
    (display.height() - LOGO_HEIGHT) / 2,
    logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
  display.display();
  delay(1000);
}

void testdrawchar(void) {
  display.clearDisplay();

  display.setTextSize(1);      // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE); // Draw white text
  display.setCursor(0, 0);     // Start at top-left corner
  display.cp437(true);         // Use full 256 char 'Code Page 437' font

  // Not all the characters will fit on the display. This is normal.
  // Library will draw what it can and the rest will be clipped.
  for(int16_t i=0; i<256; i++) {
    if(i == '\n') display.write(' ');
    else          display.write(i);
  }

  display.display();
  delay(2000);
}

void testdrawstyles(void) {
  display.clearDisplay();

  display.setTextSize(1);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(0,0);             // Start at top-left corner
  display.println(F("Hello, world!"));

  display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text
  display.println(3.141592);

  display.setTextSize(2);             // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
  display.print(F("0x")); display.println(0xDEADBEEF, HEX);

  display.display();
  delay(2000);
}

Hi @chesterscz
You are correctly feeding the SD card with 3V3, but the pins from nano to SD provide 5V, and pins from SD to nano provide 3V3, which is wrong in both cases.
It is recommended that you use a circuit either resistive or active that equalizes the levels between the Sd module and the arduino nano.

And by that you mean ?

(i.e. what is the error ?)

Your in depth description of the issues you are having really helps ....

But, seriously, as you are feeding 3V3 to your SD card module, are we to assume that you have an SD card breakout with none of the additional level shifting and on-board 3V3 regulator?

Does it look like this one:

Is your clone Nano capable of providing the current required by the SD card on its 3V3 pin?

Did you try any of the SD card examples in the IDE?

I just tried the listfiles demo and it successfully listed all the files. Looks like the SD library I was using is wack. Thank you for the help!

Good news!

Have you addressed the issue of the 5V Nano vs the 3V3 SD card that @ruilviana mentioned in #2?

Yes, I dug up a step-down voltage regulator I used a while ago and am now converting the 5V from my PC to 3V3.

Does that mean the SD works now ??????

Yes, it works and the audio sounds good.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.