DmxMaster conflicting with Music Shield V2.2

Der everybody

I'm trying to synchronize a music loop with a simple dmx fade an therefore ordered two boards.

it looks that there is a conflict between the libraries as i i only connect the music shield the sound is looping and if a add the dmx master board, i get the following error :

VS10xx Clock Frq: 0xFFFF
initialization failed. Things to check:

  • is a card is inserted?
  • Is your wiring correct?
  • did you change the chipSelect pin to match your shield or module?
    3.mp3 is not found.
    Failed to add.

Thanks for any help!

Here is my code:

#include <SD.h>
#include <SPI.h>
#include <arduino.h>
#include <MusicPlayer.h>
#include <DmxMaster.h>

void setup(void)
{
Serial.begin(9600);
player.begin(); //will initialize the hardware and set default mode to be normal.
player.setPlayMode(PM_REPEAT_ONE); //set mode to repeat playing a song
player.playOne("3.mp3"); //play a song with its name

DmxMaster.usePin(18);
DmxMaster.maxChannel(4);
}

void loop(void)
{
player.play(); //do some leisurely job

int brightness;

for (brightness = 0; brightness <= 127; brightness++) {

/* Update DMX channel 1 to new brightness */
DmxMaster.write(1, brightness);
Serial.println(brightness);

/* Small delay to slow down the ramping */
delay(50);
}
delay(10000);

for (brightness = 127; brightness >= 0; brightness--) {

/* Update DMX channel 1 to new brightness */
DmxMaster.write(1, brightness);
Serial.println(brightness);

/* Small delay to slow down the ramping */
delay(50);
}
delay(10000);
}

Which Arduino (or compatible) do you have?
What is the DMX board? Provide a link if possible.
How is the DMX board connected?

Am I correct in understanding that the sketch you have provided works without the DMX hardware connected but, without any change to the sketch, fails when you connect the DMX board?

dear arduan

thanks for your replay.

it's an arduino uno.

hier two links to the dmx board:

the dmx board connectson top of the arduino - in our case on top of the music shield - to all pins (as shown in the first link).

and yes. as soon as i plug in the dmx board, the music doesn't play anymore.

is suspect that there is an overlap of pin usages and possibly the serial port.

i unsuccessfully tried to simplify the libraries but was not able to understand what i did ;o(

arduan

with pluging and unplugin i could find out that pin 11 of the dmx board makes the music shield stop.
i had no chance to check if the dmx board does work now...

thanks for any further help, roman

actually in the provided scheme pin 11 of the dmx-shield shouldn't be connected to anything ;o(

Tricky. It is failing while trying to initialise the SD card, but I don't as yet see any potential conflicts.
Since you have three boards stacked together, are you adequately powering everything?

As a next step, I would suggest editing MusicPlayer.cpp in the music player library and in the function void MusicPlayer::begin(void) add some debugging:

  if (!card.init(SPI_HALF_SPEED, chipSelect))
  {
    showString(PSTR("initialization failed. Things to check:\r\n"));
    showString(PSTR("* is a card is inserted?\r\n"));
    showString(PSTR("* Is your wiring correct?\r\n"));
    showString(PSTR("* did you change the chipSelect pin to match your shield or module?\r\n"));

    // new stuff
    Serial.print("Error code: ");
    Serial.print(card.errorCode());
    Serial.print("  Error data: ");
    Serial.println(card.errorData());

    return;
}

Untested, but I'm sure you can make it work.

If you do get the boards working together, I reckon you'll not be able to use the multifunction buttons since some of them clash with the DMX board. You'll probably have to modify the music library to ignore/disable those pins for it.

arduan

thank you very much! i will try this tomorrow. have you seen that i somehow managed to get the music play? it was pin 11 from them dmx board which was interfering with the music shield (even pin 11 is not used in the scheme of the dmx board...).

i'm sure i will have to get rid of the multifunction buttons. in a first try i had troubles to alter the libraries - as i commented out everything suspicious. i will try with in-existing pin numbers tomorrow...

in my 25% understanding the dmx board depends on the serial port. i hope it's not going to interfere with the rest ;o)

thanks again. i was very close to give up.

namor:
have you seen that i somehow managed to get the music play? it was pin 11 from them dmx board which was interfering with the music shield (even pin 11 is not used in the scheme of the dmx board...).

It would make some sense if pin 11 was causing a problem since it is the MOSI pin to the SD card, but how have you been able to determine this?
As you say though, pin 11 is shown as unconnected on the DMX schematic, and the top and bottom photos of a revision 3 board that I found using a search engine also showed no connection.

namor:
in my 25% understanding the dmx board depends on the serial port. i hope it's not going to interfere with the rest ;o)

If I have read the schematic correctly, then I think the default is not to use the serial pins. It depends on the setting of those little switch zero value resistors on the DMX board.

namor:
i was very close to give up.

Well we can give it a shot, but I have a feeling this could be tricky to solve. :frowning:

dear aduarn

i found out about pin 11 by try and error while plug and unplug the board with some pins bended outwards.

this morning i connected the setup to our show tec dmx dimmer. and - as expected - it doesn't work ;o)

but there is an led flashing which reminds us to a similar setup with a mac mini and a dmx-usb-adapter. at least there is some signal...

i'm a little confused. those little switch zero value resistors you mention are IO3, IO4, GND, VCCon the circuit?

i can do some basic arduino programming but never had to deal with libraries. to get rid of the multi function buttons and the midi functionality - should i start to comment out stuff in the .cpp file?

additionally, i tried to put the dmx and music shield in the folder where my .ino file stays, to have everything together and not to mess with the libraries in the arduino setup for future projects. but even they do open with the .ino file, the compilation doesn't work. is there a trick?

thanks again. i'm more positive then yesterday ;o)

namor:
i found out about pin 11 by try and error while plug and unplug the board with some pins bended outwards.

cringe

namor:
i'm a little confused. those little switch zero value resistors you mention are IO3, IO4, GND, VCCon the circuit?

No, I'm talking about R2, R4, R5 and R6. They are zero value resistors being used as soldered-on jumpers. The funny looking symbols to the upper right of them are supposed to represent the solder pads they are attached to on the PCB.

namor:
i can do some basic arduino programming but never had to deal with libraries. to get rid of the multi function buttons and the midi functionality - should i start to comment out stuff in the .cpp file?

Better to just revert back to the original libraries without changes - so that we are looking at the same thing. First we need to get the SD card working.
Have you been able to add the additional debugging that I suggested yet? When you do, test maybe five times or so, saving the serial output each time; just to make sure that it always fails at the same place.
How are you powering your equipment?

namor:
additionally, i tried to put the dmx and music shield in the folder where my .ino file stays, to have everything together and not to mess with the libraries in the arduino setup for future projects. but even they do open with the .ino file, the compilation doesn't work. is there a trick?

You may be able to copy the source files (*.c *.cpp *.h etc) into the same folder as the ino, but it is probably easier to keep them in the libraries folder. That's what the libraries folder is for after all. Don't worry about the future projects until you have this one working... :wink:

arduarn:
cringe
No, I'm talking about R2, R4, R5 and R6. They are zero value resistors being used as soldered-on jumpers. The funny looking symbols to the upper right of them are supposed to represent the solder pads they are attached to on the PCB.

yes, that's the ones labeled IO3, IO4, GND, VCC on my circuit ;o)

arduarn:
Better to just revert back to the original libraries without changes - so that we are looking at the same thing. First we need to get the SD card working.

the sd card works fine since i kept pin 11 out its socket.

arduarn:
Have you been able to add the additional debugging that I suggested yet? When you do, test maybe five times or so, saving the serial output each time; just to make sure that it always fails at the same place.
How are you powering your equipment?

yes, i did put your code in the .cpp file. but as the sd card works i don't get any error codes. on the serial monitor i find:

VS10xx Clock Frq: 0xC000
Card type: SDHC
Volume type is FAT32
Seeked to 3.mp3
Playing song 3.mp3 ...
0
1
2
3

arduarn:
You may be able to copy the source files (*.c *.cpp *.h etc) into the same folder as the ino, but it is probably easier to keep them in the libraries folder. That's what the libraries folder is for after all. Don't worry about the future projects until you have this one working... :wink:

you're right (i sometimes change computers and have the project on the dropbox.) i hope, that i will not forget the handicapped libraries ;o)

thanks again

ps: i tried to find out which pins are needed for the dmx board (we only would need dmx out). but i'm noot sure if i got it right...

A2 -> In
A4, D18 -> SDA
A5, D19 -> SCL

D0 -> Rx
D1 -> Tx
D2 -> RF-EN
D3 -> VTX
D4 -> VRX
D5 -> DE-EN
D6 -> Out

the music player needs:

Pins Used for Play Control:

D3 - receiving signal from button for Volume Up;
D4 - receiving signal from switch for Next Song function;
D5 - receiving signal from switch for Play&Stop and Record function;
D6 - receiving signal from switch for Previous Song function;
D7 - receiving signal from button for Volume Down.
D8 - Green Led instructions;

Pins Used for SPI Interface // wahrscheinlich SD-Karte
D10 - SPI Chip Select;
D11 - SPI MOSI;
D12 - SPI MISO;
D13 - SPI SCK;

Pins Used for VS1053 Interface:
A0 - Reset of VS1053;
A1- Data Require of VS1053;
A2 - Data Select of VS1053;
A3 - Chip Select of VS1053;

in MusicPlayer.h

#define ENABLE_NUM_DIGIT 8 //for pin[7..0]
#define ENABLE_NUM_ANALOG 2 //for A4/A5

#define SD_CS_PIN 10 //SD card select pin linked to pin10 of MCU

///////////////////////for vs10xx///////////////////////////////////
/* #define VS_XRESET A0
#define VS_DREQ A1
#define VS_XDCS A2
#define VS_XCS A3
*/

/////////////////////for keys//////////////////////////////////////
/*
#define KEY_VD 3
#define KEY_BK 6
#define KEY_PS 5
#define KEY_NT 4
#define KEY_VU 7
*/

//////////////////for Green LED///////////////////////////////////////
#define GREEN_LED 8

oh; and i forgot. i power the pack with a usb cable. that connects to mac book. normally the macs complain if something consumes too much power. would you suggest to use a separat power supply?

namor:
yes, that's the ones labeled IO3, IO4, GND, VCC on my circuit ;o)

Oh, I see.

namor:
the sd card works fine since i kept pin 11 out its socket.

Hmm; is it really that simple.
Can you see any connection coming from the pin 11 connection on the DMX board?
I can't see why an unconnected pin could cause the problem, so either:

  • there is an undocumented connection (perhaps hidden if there are more than two layers on the PCB (doubt it)),
  • or perhaps your board has a defect, maybe a solder bridge or something that is connecting the pin to somewhere.

Well, neither the board nor the library uses SPI, so I guess bending the pin is as good a solution as any.

namor:
would you suggest to use a separat power supply?

I'd be a bad judge of that, but I reckon if the Mac is monitoring the load, then it is probably within tolerance.

namor:
ps: i tried to find out which pins are needed for the dmx board (we only would need dmx out). but i'm noot sure if i got it right...

A2 -> In // yes, pass through, goes to the three pin header that should be on your board
A4, D18 -> SDA // yes, pass through to four pin I2C header
A5, D19 -> SCL // yes, pass through to four pin I2C header

D0 -> Rx // yes, unconnected in default configuration
D1 -> Tx // yes, unconnected in default configuration
D2 -> RF-EN // yes, unconnected in default configuration
D3 -> VTX // this is your transmit line
D4 -> VRX // this is your receive line, but not usable with that library, you could disconnect it by removing the 0 Ohm resistor, or bending pin
D5 -> DE-EN // yes, unconnected in default configuration
D6 -> Out // yes, pass through to the three pin out header

the music player needs:

Pins Used for Play Control:

D3 - receiving signal from button for Volume Up; // yes, and this clashes with the transmit line
D4 - receiving signal from switch for Next Song function; // yes, and this clashes with the receive line
D5 - receiving signal from switch for Play&Stop and Record function; // yes, not a problem
D6 - receiving signal from switch for Previous Song function; // yes, not a problem
D7 - receiving signal from button for Volume Down. // yes, not a problem
D8 - Green Led instructions; // yes, not a problem

Pins Used for SPI Interface // wahrscheinlich SD-Karte
D10 - SPI Chip Select;
D11 - SPI MOSI;
D12 - SPI MISO;
D13 - SPI SCK;
// Yes, not used by DMX, and shouldn't be connected

Pins Used for VS1053 Interface:
A0 - Reset of VS1053;
A1- Data Require of VS1053;
A2 - Data Select of VS1053;
A3 - Chip Select of VS1053;
// Yes, these seem correct too.

After going through these pins, I think your boards are not going to work together without additional effort.
The transmit pin is conflicting with one of the music player buttons. If you look at the schematic for the music shield on the second page, bottom right, you can see how the switches are wired - with common to ground. That suggests that the switch pins are normally high and are pulled to ground when the buttons are pressed. Being normally high will probably conflict with your DMX board. But if that wasn't enough, each of the switches has a (debouncing?) capacitor on it, which I imagine will further distort the signal to the DMX board.

I think you'll not be able to piggyback the shields. Either wire them manually or get something like this Go-Between Shield, though I notice it has been discontinued by a couple of the listed suppliers.

wow! reading schematics seams to be your thing!

i can order one of these go-between shields. but wouldn't it be easier to bend away D4, D10-13 and find a free pin for D3? put in a bridge from D9 to D3 and alter the DMX library?

thank you so much. arduino and its community is unbelievable!

i was too optimistic ;o(

bridging D3 of the dmx to D9 of the music shield (should not bee in use there) plus bridging the arduino A2 directly to the dmx A2 shield and altering the DmxMaster.cpp didn't do the job. the dmx dimmer's led doesn't even blink anymore...

time for bed - as there will be more bridges to bring tomorrow...

here is what i changed in the DmxMaster.cpp:

static uint8_t dmxPin = 9; // Defaults to output on pin 3 to support Tinker.it! DMX shield

is it possible, that pin D3 is used as pwm pin and therefore depends on timer 2?

https://playground.arduino.cc/Learning/Pins
(2) Any PWM output is driven on Timer 2's frequency. The duty cycle is independent of other PWM outputs.

the only other pin driven by timer 2 is pin D11 (MOSI) which is in us of the music shield.

if this might be a problem. can i alter the timer in DmxMaster.cpp to Timer_1 and use pin D9?

ok. again too optimistic.

changing every instance of Timer2 to Timer1 was not the best idea. the sd card stopped working.

if the dmx shield is dependent on pwn and timer2 i have to stick with D3.

i will try a different wiring...

namor:
wow! reading schematics seams to be your thing!

i can order one of these go-between shields. but wouldn't it be easier to bend away D4, D10-13 and find a free pin for D3? put in a bridge from D9 to D3 and alter the DMX library?

Wow! Bending pins seems to be your thing... :wink:

I suppose I'm a bit of a softie, I'd be too worried about breaking the pins - but its all repairable anway.

namor:
bridging D3 of the dmx to D9 of the music shield (should not bee in use there) plus bridging the arduino A2 directly to the dmx A2 shield and altering the DmxMaster.cpp didn't do the job. the dmx dimmer's led doesn't even blink anymore...

Presumably your DMX board worked at the beginning without the music shield?
Let's try and simplify things:
With your bent D3 connected to D9, try a simple sketch that just sets the D9 pin high. See if the DMX dimmer's LED does anything.
Try blinking the D9 pin, see what happens again.
Don't include anything from the music library or the DMX library, just a minimal sketch.

dear arduan

thanks again. your instructions let to go back and try to implement the dmx board only.
shame on me that i didn't do this before! and i have to admit, the dimmer functions slightly
different as the one we where using before in the same project.

and shame on me, the only thing that has to be changed is this pin 11 that should not be
connected to the music shield.

the multifunction buttons on the music board can interfere with the dmx signal. but as our
controller will be in a housing anyway, this doesn't harm in our setup.

so for everybody: the seed music shield v2.2 and the thinkerkit dmx master shield can be
used huckepack. just clip the pin 11 of the dmx board.

the setup is useful for installations where light has to be synchronized with sound. we are
using this to avoid a raspi or a mac mini with all its possible interferences.

we use this dimmer:https://www.thomann.de/gb/showtec_1_kanal_dimmer_10a_single_mkii.htm
(remember to pull down the slider on the left side as it overrides the dmx messages ;o()

the code we use is stille the same as in the initial post.

big applause to arduan. without the conversation, i wouldn't have found the way!

To be honest, I don't quite know what I've done - but if it's working and you're happy, then I'm happy too!

Well done you for not giving up too soon.