Wifi and microSD Shield

Wifi and microSD Shield
« on: December 13, 2013, 04:27:19 PM »

is it possible to use Wifi and microSD together at the same time?
I tried this, but it won't work -> my debug output on the terminal monitor get nothing.
I read in other Arduino forums, that it is not possible, but the topics are very old and so I want to know if there is a solution for this case.

What will I do?
  • Measure the temperature and save it on the microSD card.
  • Connect via Wifi and computer, iPad,... to the controller and read the data from the microSD card.
I hope there is now a solution for this case.

Thanks in advance.

Re: Wifi and microSD Shield
« Reply #1 on: December 15, 2013, 03:29:26 PM »
Hi Speedy,

This should be possible to use both of these at once, they both use the SPI port, but have different chip selects.  Can you supply the Arduino sketch that you are using and we can try it out here to see what the issue is?  You can post it to the forum or email to us at info@tiny-circuits.com.


Ken Burns

Re: Wifi and microSD Shield
« Reply #2 on: December 17, 2013, 03:12:18 PM »
Thanks for this answer.

I will test it this week again and will post my answer after testing.

Here is what I found out today:
It seems that it work how you wrote.
I got some problems with my debug - output (nothing was displayed) and so I thought, that this was the problem.
But now I deleted some Serial.print - commands and I got my debug informations.

Now I have to check the WIFI part.
« Last Edit: December 17, 2013, 05:29:01 PM by speedymk1 »

Re: Wifi and microSD Shield
« Reply #3 on: December 22, 2013, 05:02:44 PM »
Hello again,

I tried now to use SD-CARD and WIFI together - without success!
Here is my short code (not the best,...quick and dirty)

Code: [Select]
 Used parts:
 # Tinyduino  - Processor Board
 # TinyShield - USB & ICP
 # TinyShield - WIFI
 # TinyShield - SD Card
 # TinyShield - Proto Board

// Include libraries
#include <Adafruit_CC3000.h>
#include <SPI.h>
#include <SD.h>
// WIFI-CC3000
#define ADAFRUIT_CC3000_IRQ   2                  // must be a IRQ Pin
#define ADAFRUIT_CC3000_VBAT  A3                 //
#define ADAFRUIT_CC3000_CS    8                  // PIN: ChipSelect fŁr WIFI
#define WLAN_SSID             "???????"          // cannot be longer than 32 characters!
#define WLAN_PASS             "???????"
#define WLAN_SECURITY         WLAN_SEC_WPA2      // This can be WLAN_SEC_UNSEC, WLAN_SEC_WEP,
//                                                  WLAN_SEC_WPA or WLAN_SEC_WPA2
#define SD_CS                 10                 // PIN: ChipSelect fŁr SD-CARD
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
// WIFI-CC3000 instance
Adafruit_CC3000 wifi = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ,

File   dataFile;
String dataString = "";
// setup
void setup()
  /* ----------------------------------------------------------
  Serial.println("Controller is starting...");
  /* ----------------------------------------------------------
  // Initialise the CC3000 module
  Serial.println("WIFI Module");
  Serial.println("* Initialising...");
  if (!wifi.begin()) {
    while(1) {
  // Connect to  WiFi network
  // Check DHCP
  Serial.print("\n* Request DHCP");
  while (!wifi.checkDHCP())
  /* Display the IP address DNS, Gateway, etc. */
  if(!wifi.getIPAddress(&ipAddress, &netmask, &gateway, &dhcpserv, &dnsserv)) {
    Serial.println("!!! Unable to retrieve the IP Address!!!\r\n");
  else {
    Serial.print("\n* IP Addr: ");
    Serial.print("\n* Netmask: ");
    Serial.print("\n* Gateway: ");
    Serial.print("\n* DHCPsrv: ");
    Serial.print("\n* DNSserv: ");
  Serial.println("\n* WiFi connection successfully finished!");

  /* ----------------------------------------------------------
  Serial.print("Initializing SD card...\n");
  pinMode(10, OUTPUT);     // Pin 10 must be configured as output
  if (!SD.begin(SD_CS)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card is inserted?");
    Serial.println("* Is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
  else {
    Serial.println("initialization successfull!");
    dataFile = SD.open("data.txt", FILE_WRITE);
    Serial.println("Wiring is correct and a card is present.");
  if (dataFile) {
    dataString += "Controller started";
    // print to the serial port too:
  Serial.println("* SD-Card successfully started...");

  Serial.println("Controller sucessfully started!");

// loop
void loop() {
  // do something
// end loop

If I commend out the SD-CARD section it work - this means WIFI work and on the serial monitor you will see the WIFI parameter:
Code: [Select]
Controller is starting...
WIFI Module
* Initialising...
Started AP/SSID scan

Connecting to ???????...Waiting to connect...
* Request DHCP
* IP Addr:
* Netmask:
* Gateway:
* DHCPsrv:
* DNSserv:
* WiFi connection successfully finished!
Controller sucessfully started!

If I include the SD-CARD section, nothing will be shown on the serial monitor.
If I commend out the WIFI section it work - this means SD-CARD work and on the serial monitor you will see some informations:
Code: [Select]
Controller is starting...
Initializing SD card...
initialization successfull!
Wiring is correct and a card is present.
Controller started
* SD-Card successfully started...
Controller sucessfully started!

Why is now nothing on the serial monitor?
Who can help me?
What is wrong?

But maybe there is an other problem, why?
I work on a MacBook Pro with OS 10.9 with ARDUINO 1.0.5 and how you can see in the code above I use 9600 for Serial communication.
But on the terminal monitor I have to adjust 4800 to see all messages, otherwise I see only some characters.
Is this normal?

Thanks in advance

[EDIT]: I solved now the problem with the serial communication (baud rate) - use the right board and than it will work :).
But all other problems are still here.
« Last Edit: December 22, 2013, 05:10:23 PM by speedymk1 »

Re: Wifi and microSD Shield
« Reply #4 on: December 26, 2013, 07:48:15 PM »
Is it possible to order WiFi shield with SMD SMT connector?

Or at least, can you publish a guide how to replace the SMD antenna with SMD SMT connector? :)

Re: Wifi and microSD Shield
« Reply #5 on: January 10, 2014, 12:14:01 PM »
Have someone a solution for the use of booth devices at the same time?

What is wrong in the code below?

Re: Wifi and microSD Shield
« Reply #6 on: January 14, 2014, 03:35:39 PM »
Hello, is somebody reading this thread?
« Last Edit: January 19, 2014, 02:02:45 PM by speedymk1 »

Re: Wifi and microSD Shield
« Reply #7 on: January 19, 2014, 10:16:39 PM »
I greatly apologize for missing your messages on the forum, for some reason the forum hasnít emailed me updates when messages are posted, Iím very sorry again.

Iíve done some testing here, and it looks to be a RAM issue, both the CC3000 and the SD library use quite a bit of RAM, and thatís whatís causing it to crash when both are on.  All of the   Serial.println() messages are being stored in RAM, which is eating up most of it, if you eliminate these or move the strings to flash, youíll find that the system is able to run.

To change these to Flash, put F( ) around the string in Serial.println().  For example:

Serial.print(F("Initializing SD card...\n"));

This will prevent this from eating up all the RAM. 

Let me know how that works for you, sorry again for missing your messages on the forums.


Ken Burns

Re: Wifi and microSD Shield
« Reply #8 on: January 21, 2014, 03:21:53 PM »
Hi Ken,

thank you very much, it work now (both at the same time).
Now I have to look further to finish this project.

Thanks again.