Stacking shields and pin availability

Hey all, first time electronics project here.

I decided to learn a bit about electronics I would make a drink-mixing bot. I've got all the code fleshed out for dispensing drinks, and thats all fine, but where I'm running into trouble is that I want to use both the Wave Shield (http://www.ladyada.net/make/waveshield/) and the 1.8" TFT LCD w/ MicroSD (https://www.adafruit.com/products/358 ). It seems they both require pins 11-13 for use with their own SD cards. Normally I know this would mean you cant use them both at the same time. However, if I stack these shields, and make sure not to use them concurrently, will everything work?

For example, I would draw a bitmap onto the LCD, the user selects it through a button, and once that selection has been made, the wave shield plays a clip. Would the two SD cards conflict?

If they do, is there any way I could do this? Could I make both shields share the same SD card? If so, how? I've looked at SDFat libraries and unless I'm missing something it doesn't seem to mention it...

I'm using an arduino mega2560.

Thanks!

Tadgh: Hey all, first time electronics project here.

I decided to learn a bit about electronics I would make a drink-mixing bot. I've got all the code fleshed out for dispensing drinks, and thats all fine, but where I'm running into trouble is that I want to use both the Wave Shield (http://www.ladyada.net/make/waveshield/) and the 1.8" TFT LCD w/ MicroSD (https://www.adafruit.com/products/358 ). It seems they both require pins 11-13 for use with their own SD cards. Normally I know this would mean you cant use them both at the same time. However, if I stack these shields, and make sure not to use them concurrently, will everything work?

For example, I would draw a bitmap onto the LCD, the user selects it through a button, and once that selection has been made, the wave shield plays a clip. Would the two SD cards conflict?

If they do, is there any way I could do this? Could I make both shields share the same SD card? If so, how? I've looked at SDFat libraries and unless I'm missing something it doesn't seem to mention it...

I'm using an arduino mega2560.

Thanks!

Those pins are used for the SPI interface; they both seem to use pin 10 (I think?) to select their respective SD card, but you can use another pin for one of them (you might have to modify the code/library - or it might allow you to set this up); as long as none of the other pins interfere with each other it should be ok - I think. I don't know if you could make both share the same card or not; maybe. Perhaps if you put the card in the TFT shield only (but not in the wave shield), it might work ok (???).

In principle you can have as many SPI devices as you like on a bus, as long as they all obey the rules.

Each device has to have a SS (aka CS) input that disables its SPI interface.

You then have to provide these SS/CS signals, normally just by using a couple of spare IO pins. However as Cr0sh says you may have to look at the SPI library. If it automatically toggles the SS pin (10?) then you can just use 2 other pins and disconnect the standard SS.


Rob

Tadgh: Normally I know this would mean you cant use them both at the same time. However, if I stack these shields, and make sure not to use them concurrently, will everything work?

Actually the TFT LCD you list above isn't a shield at all, it simply uses the SPI protocol.

If you check out the tutorial, one of the first things it tells you is how to connect it to an Arduino using any arbitrary pins. See http://www.ladyada.net/products/18tftbreakout/ for more info.

So it should be trivial to connect the waveshield and the TFT LCD at the same time.

I hope this helps,

Brad. KF7FER

Thanks everyone. I cant believe I missed that you can just program that LCD to any old pins(however it will be significantly slower)

I will look into seeing if I can get both devices to share the bus in case the flexible pin configuration for the LCD isn't fast enough. Thanks a lot!