Working with dual SD cards

Hi,
I've very new to Arduino, having just purchased a Nano and getting familiar with uploading code to and from.

In an nutshell, I'd like to know if it's possible to work with two micro SD cards, copying a text file from one to the other.

For this application, we have some off-the-shelf data loggers sitting in the field, writing data to a text file. At the moment, we have to go around with a laptop and remove the micro sdcard from the logger, copy it onto a directory on the laptop and insert the SD card back back into the logger. The loggers are in a rain forest, so the terrain is pretty rough, the vegetation is thick and it's generally not kind to laptops.

The name of the loggers text file is unique for each device but we won't know as we move from logger to logger what that name will be.

Ideally, what I'd like to build is an Arduino with two SD card slots, one being the SD card will write the log files too and the second where we can insert the card. Again, ideally, when the SD card is inserted we would find any text files (there will normally be only one or two files), write them to the internal SD card and then automatically unmount the SD card.

I don't forsee any problems writing the code and we have access to a 3D printer so can create a housing - what I'm not sure about is whether it's possible two have SD card readers and if so, how you access them as almost all the examples I've found so far assume that there will only be one SD card and it will mainly be used as storage.

The goal is for something as simple as possible - just stick the SD card in and wait for an LED to go out so you know you can remove the card.

As far as the logger are concerned, there's no ability to modify them.

Can anyone give any advice?

I'm sure you could do that OK, it is just a matter of having another CS pin for the second card, they both being on the SPI bus. But this seems to be more a management problem than anything else.

You might consider managing the SD using bluetooth and a phone, thereby avoiding any need to remove the card, or provide an additional card. You still have to go for a walk in the jungle, but you can leave the laptop at home.

I believe the SDFat.h library will allow you to use multiple SD cards, each with it's owns slave select of course.
I also think some SD cards are not good about not driving MISO when their slave select is inactive, so you may want to buffer MISO with a part like 74HC125 and drive the 125 enable signal with the SD card's slave select to ensure the SD card is off the bus when not selected.

Thanks all. From the sounds of it it's feasible but I think I need to get a lot more familiar with the hardware first (I'm from a programming background).

Nick: I volunteered for a couple of days and spent some time with the researchers in the field; it's hard to explain but juggling two devices really would be a worse solution then just taking the laptop! To give you some idea, it can take up to 20 minutes to move 50 meters between the loggers and it's a full day just to get all the data (helpfully, half the loggers are 3 meters up a tree so you're also bringing a ladder along).

AndrewGray:
it's hard to explain but juggling two devices really would be a worse solution then just taking the laptop!

OK, it's your show and I don't understand what you are talking about. What two devices are you talking of having to juggle? I was talking about the phone as replacement for the laptop and it seems to me that, if you intend to use Arduino at all, and you have to carry a ladder through the jungle, you might be about to discover another rather good reason for downloading via bluetooth and leaving the SD where it is - and the ladder back on the truck.

I might also point out that, if the loggers are only 50m apart, the above approach would imply that you could read at least a second logger while standing under the first, and likely a third, which implies rather less hacking through the jungle.

The data loggers are commercial off-the-shelf sap flow meters that are attached to tree in a research plot. To retrieve the data, we have to open an access port, extract the SD card, copy the data off the card onto the laptop (each file is about 1-2 MB in size), then put the SD card back into the logger. The data is normally copied every fortnight or so.

What I'm hoping to build is something to replace the laptop - we're still going to have to get the card out of each logger because there's no other way to get the data. So the idea is to have an internally mounted SD card to hold the data, go from logger to logger and copy the data off each loggers card onto the internal card, then go back to base and copy all the log files off the Arduino's SD card onto a server for processing.

A small little hand hold device that just copies the data without needing any interaction would be lighter, faster and more robust then a laptop.

OK, it sounds very much like you have got the wrong logger, and the first thing to do is go to the supplier and see if you can get something a little more appropriate to the 21st century - quite likely from the same manufacturer.

Failing that, it seems still just a management problem. Why don't you just have two SDs for each logger, presumably with a long bright ribbon on each, and simply swap them on your rounds.

You are still stuck with the ladder, but at least you get to leave the laptop in the office, and no Arduino needed.

Since you have no choice but to remove the SD, I don't see why you need to build anything, or read anything on site. In the unlikely event that you actually do need to read SDs on site, you might consider a card reader on the phone, but I bet a phone-sized SD reader/recorder already exists, thereby getting rid of any dangling USB host cords.

I completely agree regarding replacing the loggers, but in terms of accuracy these sap flow monitors are hard to beat and in any case, the project doesn't have the money to replace them (would be well into the six digits! That kind of dosh would let the project run for another year at least).

I haven't looked for anything off the shelf so I'll looking that as well.

AndrewGray:
At the moment, we have to go around with a laptop and remove the micro sdcard from the logger, copy it onto a directory on the laptop and insert the SD card back back into the logger.

I don't understand why when you remove the SD card you don't just stick another card in and take the cards with the data back to the lab. MicroSD cards are cheaper by the dozen.

If you want a card/file copier it is possible in at least 2 different ways, one very cut & dry.

Is the current logger SD card board integral to the controller collecting the data? The more of that you can replace, the easier you can make the collection operation. The ladder wouldn't be required except for physical device checks.

has to be better than a ladder.....

The sap flow monitor that is logging the data question is this one: http://www.ictinternational.com/casestudies/sfm1-sap-flow-and-small-stems/

I should clarify that we're working with micro SD card's and I'm not aware of any wifi enabled micro SD cards (and didn't find one in a quick search).

The (micro) SD card slot is integrated into the board of the logger; it's accessed by unscrewing the middle port at the bottom of the logger.

I'll check with the researcher as to why they don't just pop the old ones out and put new ones in but I believe there is a reason why they avoid this.

AndrewGray:
The sap flow monitor that is logging the data question is this one: http://www.ictinternational.com/casestudies/sfm1-sap-flow-and-small-stems/

I should clarify that we're working with micro SD card's and I'm not aware of any wifi enabled micro SD cards (and didn't find one in a quick search).

The (micro) SD card slot is integrated into the board of the logger; it's accessed by unscrewing the middle port at the bottom of the logger.

I'll check with the researcher as to why they don't just pop the old ones out and put new ones in but I believe there is a reason why they avoid this.

I see, don't mess with the logger. Copy the files with a stand-alone. If it can be fast enough at 8MHz then it can run on 2 AA/AAA batteries and need no voltage leveling between the controller and SD.

I do wonder if that basic heater-temp-sensor design would make a better soil humidity sensor than the two-spike type?