Escape Room Prop Software Serial and shiftOut conflict

Hello!

I'm working on an Escape Room puzzle and I got stuck pretty hard. I've been searching for a few hours and didn't find anything helpful so I thought maybe someone can point me in the right direction.

I'm relatively new to arduino (a year or so) and I've learnt a lot from the forum so, thanks!

The part I'm working on right now is supposed to receive 4 inputs from other arduinos in the room (single wire that turns High when another puzzle is solved) and then turn on a few lights (12v LED strips) depending on how many inputs are high.

I'm using an arduino nano, 4 TPIC6b595 shift registers to control the 12v LEDs and a dfplayer module to play sounds. Everything is powered with a 12v power source and I have an LM2596 step down module that lowers the 12v to 5v to power the arduino and the DFPlayer.
Everything is soldered to a custom made pcb. There is also a rs485 chip and a few connectors there, I'm not currently using them but I put them there trying to plan ahead so in the near future I can control the arduinos from another room.
You can find the schematic attached.(semafor.pdf)
I started coding the part that has to do with the TPIC's. It is done and works well, all the lights turn on and off when they should.

But when I was going to add the code for the dfplayer I found out the shift registers stoped working.

I started commenting out parts of the code and I found out the one messing it up is the SoftwareSerial. If I comment out the line where I create a new instance of the SoftwareSerial it works.

This is the line that makes the shift register stop working:

SoftwareSerial mySoftwareSerial(8, 12); // RX, TX

You can find attached the schematic and here goes the full code: (it is not finished, it's just there to test everything works as expected, the "for" in the loop won't be there in production)

#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
//SoftwareSerial mySoftwareSerial(8, 12); // RX, TX
//DFRobotDFPlayerMini myDFPlayer;


//declare display driver pins
const int latchPin = 10;
const int clockPin = 9;
const int dataPin = 11;

//Declare input pins
const int inputpins[4] = {A4,A5,A6,A7};

//Declare helper variables and constants
int activeInputs = 0;
int currentFase = 0;
const byte faseDataMap[6][4] = 
 {// {faseDreta,passEsquerra,passDreta,faseEsquerra}
  {0,0,0,0},
  {192,0,0,192},
  {240,0,0,240},
  {252,0,0,252},
  {255,0,0,255},
  {0,255,255,0}
 };

void setup() {
  //Start USB Serial Comms
  Serial.begin(9600);
  
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(A4,INPUT);
  pinMode(A5,INPUT);
  pinMode(A6,INPUT);
  pinMode(A7,INPUT);
  //turn drivers ON
  digitalWrite(7,LOW);
  //turn all leds off
  for (int i=3; i>=0; i--)
      {
        shiftOut(dataPin, clockPin, LSBFIRST, 0);
      }
}//END SETUP

//----------------------------------------------
//----------------------------------------------

void loop() {

  //checkInputs();
  for (int i=0; i<=3; i++)
      {
           activeInputs = i;
           lightEmUp();        
           delay(2000);
      }
  lightEmUp();

}//END LOOP

//----------------------------------------------
//----------------------------------------------

void checkInputs()
{
   activeInputs = 0;
  for (int i=0; i<=3; i++)
      {
        if (digitalRead(inputpins[i]) == HIGH){
           activeInputs++;
        }
      }
}//END CHECKINPUTS  ------------

void lightEmUp()
{ 
      digitalWrite(latchPin, LOW);
      //move 'em out
      for (int i=3; i>=0; i--)
      {
        shiftOut(dataPin, clockPin, LSBFIRST, faseDataMap[activeInputs][i]);
      }
      //return the latch pin high to signal chip that it 
      //no longer needs to listen for information
      digitalWrite(latchPin, HIGH);    

      
}//END LIGHTEMUP  ------------

Is there any way for me to use the dfplayer at the same time as the shift registers?

Thanks a lot!

Sorry if my english is not good enough, if something is not clear, please ask and I'll try to explain that part better.

semafor.pdf (51.5 KB)

I don't understand the relationship between the SoftwareSerial instance with the dumb name and the shift registers, or between the SoftwareSerial instance with the dumb name and the DF player.

It is more likely that the player, for which you did not provide a link, is using one of the same pins that you are trying to do SoftwareSerial on (for SPI, maybe).

Thanks a lot for your answer PaulS,
Sorry I forgot the link to the module:

Link to module documentation:

The softwareserial with the dumb name is used to comunicate with the module, at least that's what I understood. That's how it is done in the examples provided in the documentation.

As I said I'm relatively new to arduino so sometimes I may use parts of code from examples that I do not fully understand. This may well be the case.

I hope you can help me now.

Thanks again.

You might try and switch soft serial pin 12 for another.

Thanks GoForSmoke, I'll try it out!

Any reason why it could be causing trouble?

The softwareserial with the dumb name is used to comunicate with the module

So, why not name the SoftwareSerial instance based on what is connected to the pins? You do NOT have a mySoftwareSerial connected to the pins. If you have a DFPlayer connected, why not name the SoftwareSerial instance to reflect that?

The example code on the DFPlayer page shows that there is a method in the DFRobotDFPlayerMini class to define which SoftwareSerial instance it should be using. I don't see your code calling that method.

The 8 button device that is taking 8 pins could be replaced with a keypad, and use fewer pins.

The DFPlayer has 2 multi-button (with resistors, uses ADC) pins as well as 2 timed button pins and TTL serial.