Wifi and microSD Shield

speedymk1

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
Hi,

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.


TinyCircuits

  • Administrator
  • Hero Member
  • *****
    • Posts: 108
    • View Profile
    • TinyCircuits Homepage
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.

Thanks,

Ken Burns
TinyCircuits


speedymk1

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
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 »


speedymk1

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
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
// SD-CARD
#define SD_CS                 10                 // PIN: ChipSelect für SD-CARD
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
// WIFI
uint32_t ipAddress, netmask, gateway, dhcpserv, dnsserv;
// WIFI-CC3000 instance
Adafruit_CC3000 wifi = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ,
ADAFRUIT_CC3000_VBAT, SPI_CLOCK_DIV2);

// SD-CARD
File   dataFile;
String dataString = "";
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
// setup
void setup()
{
  Serial.begin(9600);
  /* ----------------------------------------------------------
   Starting
   ----------------------------------------------------------*/
  Serial.println("Starting...");
  Serial.println("Controller is starting...");
  /* ----------------------------------------------------------
   WIFI
   ----------------------------------------------------------*/
  // Initialise the CC3000 module
  Serial.println("WIFI Module");
  Serial.println("* Initialising...");
  if (!wifi.begin()) {
    while(1) {
    }
  }
  // Connect to  WiFi network
  wifi.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);
  // Check DHCP
  Serial.print("\n* Request DHCP");
  while (!wifi.checkDHCP())
  {
    delay(100);
  } 
  /* 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: ");
    wifi.printIPdotsRev(ipAddress);
    Serial.print("\n* Netmask: ");
    wifi.printIPdotsRev(netmask);
    Serial.print("\n* Gateway: ");
    wifi.printIPdotsRev(gateway);
    Serial.print("\n* DHCPsrv: ");
    wifi.printIPdotsRev(dhcpserv);
    Serial.print("\n* DNSserv: ");
    wifi.printIPdotsRev(dnsserv);
  }
  Serial.println("\n* WiFi connection successfully finished!");

  /* ----------------------------------------------------------
   SD-CARD
   ----------------------------------------------------------*/
  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?");
    Serial.println("---------------------------------");
    return;
  }
  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";
    dataFile.println(dataString);
    dataFile.close();
    // print to the serial port too:
    Serial.println(dataString);
  }
  Serial.println("* SD-Card successfully started...");
  Serial.println("---------------------------------");

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

/*****************************************************************************/
// 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]
Starting...
Controller is starting...
WIFI Module
* Initialising...
Started AP/SSID scan

Connecting to ???????...Waiting to connect...
* Request DHCP
* IP Addr: 10.0.0.6
* Netmask: 255.255.255.0
* Gateway: 10.0.0.254
* DHCPsrv: 10.0.0.254
* DNSserv: 10.0.0.254
* 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]
Starting...
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 »


hackman

  • Jr. Member
  • **
    • Posts: 5
    • View Profile
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? :)


speedymk1

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
Have someone a solution for the use of booth devices at the same time?

What is wrong in the code below?


speedymk1

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
Hello, is somebody reading this thread?
« Last Edit: January 19, 2014, 02:02:45 PM by speedymk1 »


TinyCircuits

  • Administrator
  • Hero Member
  • *****
    • Posts: 108
    • View Profile
    • TinyCircuits Homepage
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.

Thanks,

Ken Burns
TinyCircuits


speedymk1

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
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.


 

SMF spam blocked by CleanTalk