Can’t Get ATTINY84 Software Serial Communication to Work

Hi! I'm relatively new to the electrical field so please excuse my lack of understanding of certain things. Anyway, I've been trying to get an ATTINY84 to work with a DFPlayer Mini, however, I haven't been successful at this since the software serial communication doesn't seem to work correctly. I've researched about this problem and have found many resources, but many of the sources conflict with each other or are outdated, and thus I've been left confused about how to fix this issue.

Here is my code:

#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

const int tx = 6;
const int rx = 7;

SoftwareSerial mySoftSerial(rx, tx);
DFRobotDFPlayerMini myDFPlayer;

void setup() {
  pinMode(rx, INPUT); 
  pinMode(tx, OUTPUT);
  mySoftSerial.begin(9600);
  myDFPlayer.begin(mySoftSerial);
  
  myDFPlayer.volume(9);
}

void loop() {
  myDFPlayer.play(1); // Just play the first audio in the file every 15 seconds
  delay(15 * 1000);
}

Also, an off-topic question, but what is the maximum voltage that can go through the usable pins for an ATTINY84 when used as input?

Thanks in advance! : )

Welcome to the forum!

  1. You don’t need to set the pin modes, the SW Serial constructor will do that.

  2. Is the file 0001.mp3 in the root MP3 folder?

  3. Does the LED on the Player light?

  4. How's it wired? Is the Arduino TX pin connected to the DFPlayer RX pin?

  5. Have you tried this on an Arduino Uno first? I almost always prototype on an Uno before moving to an ATtiny.

Pat.

Hi Pat, appreciate the welcome! : )

(1) Thanks I didn't know it did that but now I do!

(2) Yes it's in the in MP3 folder.

(3) The led did light up while playing the audio but only for several seconds.

(4 & 5) I did initially test the player out with an Arduino Uno and it worked as expected; however, as I moved to working with the ATTINY84, the audio played for a little bit but then it abruptly cut out, and no longer wanted to play after that (there were also some noticeable buzzing sounds as the audio was playing).

I’ve gotten that buzzing before. Power it separately?

I'll try that soon and let you know if that fixed the issue, thank you nonetheless!

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