help with transistor switch for multiple SPI input

So here's the setup:

-Arduino

-ADC chip providing data thru SPI (MISO)
[[EDIT: I'm using a ADS1252, see this post for details on how this is possible: Arduino Forum]]

-1.8' Sainsmairt TFT screen with SD card via SPI

What I would like to do is utilize the SD card slot on the TFT screen and a place to dump data logging files of the data from the ADC.
Since the ADC data is input (MISO) and the display control is output (MOSI) I should be able to easily run a little graphical plot of the values from the ADC without conflict.

The problem is accessing the SD card while accepting ADC data:

As far as I can tell from my research, I can access the SD card independently very easily by using SPI but I believe**(not sure) that in order to Write files to it, I need to briefly read feedback from the SD card to make sure it's valid and whatnot. If I'm wrong and it's possible to write to and SD card with just the MOSI line, then the following isn't an issue at all:

Assuming that SPI can only take input from one device at a time I am trying to design a transistor gate/latch thing. (I have very basic knowledge about this so please bare with me)
Ideally, I want to have one digital pin from the arduino be High or Low and depending on which one it is, one of the inputs (SD or ADC) to the MISO are ignored.

logically I figure its something like this:

Switch
SD Data
ADC Data
Data to MISO
0
1100...
1010...
1100...
1
1100...
1010...
1010...

in terms of logic gates, this should be (a AND s) OR (b AND (NOT s))

Now, I know very little about transistors, My basic hunch was that this is actually a really simple circuit: Perhaps a PNP transistor and a NPN transistor with the bases connected to the Switch pin and the collectors connected as the output (with a couple resistors sprinkled around for safety (I do not know where yet)).

My instinct is that that is too simple, and I'll probably destroy my arduino somehow in the process... I'm not sure how sensitive the input is to current (help with this please)and I dont want to modify the original data in the process.

So to summarize:

question 1: does writing to SD card "really" need feedback in order for the library to function?
question 2: Can I use transistors to make a "relay" that toggles witch Data input is going to the arduino?
question 3: is it even possible to swap/interrupt the SPI input like this and is it safe?

Thank so much for your help

I think that you fail to understand the concept of the SPI bus. Any number of devices can be connected to the bus, as long as each has a separate chip select (or slave select) pin. The device who's pin is HIGH is the one that is being talked to/read from.

You do not need to add additional hardware to be able to communicate with three devices on the bus. Now, obviously, you can't talk to one while listening to another, but, then you can't do two things at the same time anyway.

Thanks for your reply,

(honest question) Why can't you talk to one while listening to the other?

One of my goals is to try to maximize the sample collection from the ADC. I understand that usually Chip select is used to toggle which device you are currently communicating with but I want to try to avoid using chip select to toggle between the ADC input and data log file as much as possible. which is why i'm investigating talking to one and listening to another.

You do bring up a good point, I could create a chip select for the ADC chip i'm using (ADS1252 from Texas Instruments). I'm not sure how I would do this yet, would it be appropriate to use a transistor switch on the data output of the chip?

Thanks

clayinmn:
Thanks for your reply,

(honest question) Why can't you talk to one while listening to the other?

One of my goals is to try to maximize the sample collection from the ADC. I understand that usually Chip select is used to toggle which device you are currently communicating with but I want to try to avoid using chip select to toggle between the ADC input and data log file as much as possible. which is why i'm investigating talking to one and listening to another.

You do bring up a good point, I could create a chip select for the ADC chip i'm using (ADS1252 from Texas Instruments). I'm not sure how I would do this yet, would it be appropriate to use a transistor switch on the data output of the chip?

Thanks

How are you controlling the ADC?

does the ADC just put out a random stream of bits?

Usually the _CS, SCK are used to coordinate the start of a bit stream. depending on whether the device is MSB or LSB format the first clock cycle after _CS markes the first bit of the transfer.

I looked up that part, it is not SPI compatible, It is a highspeed Serial device. here is a partial circuit to interface it with the SPI bus:

the four signals on the left would interface to the AVR chip

Chuck.

@ChuckTodd

Thanks for your reply, but one of the reasons I chose this ADC was because I found that it was possible to interface it without additionalk parts, see this post for details: Arduino Forum

Thanks

SD card runs at 3.3V. I use one gate of a 74HC125 to buffer the MISO signal from the SD card to 5V levels, with it's enable controlled by the CS to the SD card. Then you can have 5V on the line from other devices and not have the line dragged down by the SD card. 74HC4050 to level convert the SCK, MOSI, and CS signals to the SD card.

The nice part: no transistors needed to control base current to all the transistors.
Not much room needed if using SMD parts:
You can see the '125 and '4050 to the left of the SD socket on this standalone programmer card:
[url=http://[iurl=http://www.crossroadsfencing.com/BobuinoRev17/Rev7Programmer.jpg[/url]][iurl=http://www.crossroadsfencing.com/BobuinoRev17/Rev7Programmer.jpg[/url][/iurl]

Is there a way to turn off the auto url stuff the Forum is adding? It's messing up my link posting.

@CrossRoads

Thanks for your reply

I'm a little bit confused about your advice. I understand the use of the logic gates but I'm unclear as to why the SD card needs 3.3 volts.

As far as I've been able to tell, the SPI interface the 1.8" TFT screen/SD card part that i'm using allows me to use both features at 5 volts. This way you can flash image froom the card to the screen.

http://www.sainsmart.com/sainsmart-1-8-spi-lcd-module-with-microsd-led-backlight-for-arduino-mega-atmel-atmega.html

Didn't realize the "-1.8' Sainsmairt TFT screen with SD card via SPI" had voltage level converters and 3.3V regulator built in.

Don't think of it as talking to two devices at once. You request data from the ADC then you write it to the SD card. This can happen thousands of times per second and it will appear to be simultaneous to the humans looking at it from the outside.

Depending on the ADC, you may be able to set it up to log continuously to a FIFO buffer and you can then accelerate the process by taking blocks of readings and saving them. Usually the process of opening the file on the SD card is much slower than writing 100 bytes of data.