can't active DFPlayer with a transistor

Hey thanks :slight_smile: I connected it to ground because this was the only way it worked. I don't really know what I am doing, I am too beginner, I tried from ground and it worked (partially) good, from + it's not working at all. I suppose I am also doing something wrong but I don't really know what. When I connect it from ground (like in the schematics I added) it works sometime and crushes sometimes while making this disgusting disturbance noise. I really don't know how I should connect it properly in order to have a steady clear voice, I am reading now this fantastic guide but I will still be happy if someone will just tell me where the problem is and how to solve it.

This is the datasheet for the BJP I used (BC337), I tried it with other BJPs as well but this one is the only one that partially worked. I can definitely buy different ones if needed though

#include <DFPlayerMini_Fast.h>
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "LowPower.h"
DFPlayerMini_Fast myDFPlayer;


const int wakeUpPin = 2;
int buttonStart = 3 ;
int transistorPin = 8 ;
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX 11 Resistor
int switchFolderButton = 12 ;

boolean sleeping = true ;
boolean countingDown = false ;


int randomNumber ;


boolean playShort = true ;


int numberFilesLongFolder  ;
int numberFilesShortFolder  ;


static unsigned long timer ;
static unsigned long busyCount;
int busyCountInterval =  5000 ;
int sleepingCountInterval = 5000 ;
int busyState ;

//start
void playRandom (int folder, int randomNumber) {
  myDFPlayer.playFolder(folder, randomNumber);  //Play file
}


//switch folder from short file -> long file or long -> short
void switchDirectory () {
  playShort = !playShort ;
}
void wakeUp()
{
}
void setup()
{
  Serial.begin (4800) ;
  mySoftwareSerial.begin(9600);
  myDFPlayer.begin (mySoftwareSerial) ;


  pinMode(wakeUpPin, INPUT);
  digitalWrite (wakeUpPin, HIGH) ;


  pinMode (buttonStart, INPUT) ;
  digitalWrite (buttonStart, HIGH);

  pinMode (switchFolderButton, INPUT) ;
  digitalWrite (switchFolderButton, HIGH);

  pinMode (transistorPin, OUTPUT) ;
  digitalWrite (transistorPin, LOW);


  busyCount = 0 ;
}


void loop()
{
  attachInterrupt(0, wakeUp, LOW);


  LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);


  detachInterrupt(0);




  // wake up & start
  if (!digitalRead (wakeUpPin) && sleeping) {
    delay (50) ;
    if (!digitalRead (wakeUpPin) && sleeping) {
      digitalWrite (wakeUpPin, LOW) ;
      digitalWrite (transistorPin, HIGH);




      // it doesn't work if the command shows up only once
      numberFilesShortFolder = myDFPlayer.numTracksInFolder(1) ;
      numberFilesLongFolder = myDFPlayer.numTracksInFolder(2) ;
      numberFilesShortFolder = myDFPlayer.numTracksInFolder(1) ;
      numberFilesLongFolder = myDFPlayer.numTracksInFolder(2) ;


      sleeping = false ;
      if (playShort) {
        randomNumber = random (1, (numberFilesShortFolder + 1)) ;
        playRandom(1, randomNumber) ;
      }
      else {
        randomNumber = random (1, (numberFilesLongFolder + 1) ) ;
        playRandom(2, randomNumber);  //Play file
      }
      delay (200) ;
    }
  }


  if (!digitalRead(buttonStart) ) {
    delay (50) ;
    if (!digitalRead(buttonStart) ) {
      if (playShort) {
        randomNumber = random (1, numberFilesShortFolder + 1) ;
        playRandom(1, randomNumber) ;
      }


      else {
        randomNumber = random (1, numberFilesLongFolder + 1) ;
        playRandom(2, randomNumber);  //Play file
      }
      delay (200) ;
    }
  }
    }
  }


 
  //switch folder
  if (!digitalRead(switchFolderButton) ) {
    delay (50) ;
    if (!digitalRead(switchFolderButton) ) {
      switchDirectory () ;
      delay (200) ;
    }
  }

  //making the arduino go to sleep when the file ends / stopped for a while
  if (millis () - busyCount >= busyCountInterval ) {
    busyCount = millis () ;
    busyState = digitalRead (busy) ;
  }


  if (busyState && !countingDown) {
    timer = millis () ;
    countingDown = true ;
  }


  //without this delay the file don't stop after  a file ended
  delay (10) ;




  //go to sleep
  if (busyState && millis () - timer > sleepingCountInterval ) {
    sleeping = true ;
    timer = millis () ;
    digitalWrite (transistorPin, LOW);
    digitalWrite (wakeUpPin, HIGH) ;
  }


}

Thank you all very much )