I built a speaking robot system with Arduino UNO + Bluetooth + DfPlayer. I am sending a string from my Android phone and the system reads me an Mp3 file stored in SD card.
At the beginning this was working perfectly but it started to be blocked. i.e. after sending 2 strings, it does not respond.
If there was an erroneous wiring or software, it wouldn't work either in the first 2 attempts.
I am making my circuit on a PCB. This schematic shows the back side of the PCB.
On this schematic, the KA-2284 (which is a VU-meter) is used to make lip-synch (just imitate randomly the lip movements). I am making my tests without KA-2284. I have not yet added the related code into the sketch.
I put all devices and PCB in a plastic mannequin head. I placed the DfPlayer not on the PCB but at a remote place to facilitate the access to the SD card to add or edit Mp3 files. For this reason, I used extension cables as shown on the schematic.
The mannequin head will move its eyelids up and down; its eyeballs right and left and up and down; its jaws up and down.
I can certainly imagine those messages getting out of sync. readString is probably not the beat tool here. Maybe readStringUntil would be better. Or even better would be to use the method in the Serial Input Basics thread in the tutorials section.
In my sketch I had used DFRobotDFPlayerMini.h, now I suddenly had the idea to change it, assuming that probably it became obsolete or incompatible with new generation DfPlayer or Bluetooth or UNO. I downloaded DFPlayerMini_Fast.h library that I found by coincidence on Internet and it solved the problem.