DY-SV5W no sound issue

Hello,
I am trying to get the mention board to play audio through its' on board 3.5mm jack using a Ardunio uno board and a PIR sensor to trigger random sounds on the SD Card. But, for some reason, either my limited knowledge or something else I'm overlooking. I cannot get it to play thought unpowered or powered speakers.

I know that the PIR sensor and board is talking to the DY-SV5W as i can see it detect motion and says playing X track in the serial monitor. But, there is no sound.

The DY-SV5W drip switches is currently in 010, but I have tried using 100 and 001 with no differing results.

Here is the code I am using for the ardunio board. Put it get using my limited knowledge and modding code from a working DFminiPlayer sketch as the basis of my understand. It verified correctly with no problem before uploading it the ardunio.

#include <SoftwareSerial.h>

int pirPin = 12; // Arduino pin the PIR sensor is connected to
int rxPin = 3;   // Arduino pin the TX pin of the DY-SV5W is connected to
int txPin = 2;   // Arduino pin the RX pin of the DY-SV5W is connected to

int motionStatus = 0; // variable to store the PIR's current reading (high or low)
int pirState = 0;     // variable to store the PIR's state change

SoftwareSerial mp3Serial(rxPin, txPin); // Software Serial object for DY-SV5W

void setup() {
  pinMode(pirPin, INPUT);    // Set PIR pin as input
  pinMode(rxPin, INPUT);     // Set mp3 player TX pin as input
  pinMode(txPin, OUTPUT);    // Set mp3 player RX pin as output

  Serial.begin(9600);        // Initialize Serial Monitor
  mp3Serial.begin(9600);     // Initialize Serial communication for DY-SV5W

  delay(30000);              // Allow 30-60 seconds for PIR sensor to calibrate
}

void loop() {
  motionStatus = digitalRead(pirPin); // Read the PIR pin's current output (HIGH or LOW)

  if (motionStatus == HIGH) {
    if (pirState == LOW) {
      Serial.println("Motion Detected"); // Print result to the Serial Monitor
      pirState = HIGH;                  // Update the PIR state to HIGH

      playRandomTrack();                // Play a random track
      delay(13000);                     // Delay for the approximate length of the longest track
    }
  } else {
    if (pirState == HIGH) {
      Serial.println("Motion Ended");   // Print result to the Serial Monitor
      pirState = LOW;                   // Update the PIR state to LOW
    }
  }
}

void playRandomTrack() {
  int track = random(1, 65); // Generate a random track number (1 to 64)
  Serial.print("Playing track: ");
  Serial.println(track);
  
  sendCommand(0x03, track);  // Command 0x03 plays a specific track
}

void sendCommand(byte command, int parameter) {
  byte highByte = (parameter >> 8) & 0xFF; // Extract high byte of parameter
  byte lowByte = parameter & 0xFF;        // Extract low byte of parameter

  byte checksum = 0xFF - (0xFF + command + highByte + lowByte) + 1; // Calculate checksum

  // Send the 6-byte command sequence
  mp3Serial.write(0x7E);      // Start byte
  mp3Serial.write(0xFF);      // Version byte
  mp3Serial.write(0x06);      // Command length
  mp3Serial.write(command);   // Command byte
  mp3Serial.write((byte) 0x00); // Feedback (0x00 = no feedback)
  mp3Serial.write(highByte);  // High byte of parameter
  mp3Serial.write(lowByte);   // Low byte of parameter
  mp3Serial.write(checksum);  // Checksum
  mp3Serial.write(0xEF);      // End byte
}

Also here is the basic wiring in text format I used to hook up the PIR sensor, Ardunio, and the DY-SV5W.

Any help with this is appreciated as like I said, I am probably missing something obvious, but don't know I am.

Are you committed to that particular player? I have PIR working reliably with the much more popular DFR MP3 Player, but unfamiliar with your device.

Personally I am not, but the DY-SV5W board has a 3.5mm output jack and volume control on the board. Instead of the DFminiplayer that requires you to change volume in code and have to solder a 3.5mm jack. Along with what I read the board in question does not need for a 1K resistor in line for the crunch sound that I was getting with it.

For I have a working code and everything with the DFminiPlayer as I mentioned in my post, which my code originated from. But I was trying to shrink down the overall footprint to fit into its enclosure. Having the PIR sensor, an uno board, along with the DFminiPlayer and a 3.5mm jack was tight in the enclosure I had in mind. Why I was trying to consolidate the mp3 player and 3.5mm into one board as the volume and not needing a 1k resistor was a plus.

My DFR projects use two buttons to raise or lower volume. One or two inbuilt 3W speakers deliver the audio, so no jack.

To reduce size consider transferring to a chip once you have everything working. Such as ATMEGA328 or ATMEGA88, or even ATTiny85 if you can limit to 5 I/O pins..

BTW, I don’t see any mention of what Arduino device you are using? The Nano and Pro Mini boards are already pretty compact.

I mentioned that I was using an Uno board in the first sentence of my OP.

I have to use a audio jack for the project of ease of use. I cannot have a speaker hard connected to the project. While the only speaker I could get to sound worth wild along with out having to use a resistor was a 8 ohms speaker. Quality was very bad or sound was muffed with anything less then what I just mentioned. Also the reason I opted for a audio jack to bypass this, but ran into having to use a 1k resistor again due to allot of line noise or "crunchy" sound with the audio file played.

Also helped with by keeping this setup to be used in multiple scenarios due to just having to hook a speaker up to audio jack.

The mentioned idea of transferring to a chip is kindof out of my field of knowledge. On how to code among the logistics of it. For I got the code for the DV-SV5W done with my limited understanding of.

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