WeMos D1 Mini SD Card Shield (HCWEMO0004)

Wemos ESP8266 based development boards and shields
Post Reply
admin
Site Admin
Posts: 865
Joined: Sun Aug 05, 2012 4:02 pm

WeMos D1 Mini SD Card Shield (HCWEMO0004)

Post by admin » Tue Nov 22, 2016 4:16 pm

Image





This shield is designed for use with the Wemos/Lolin D1 mini and mini Pro development boards (see item HCWEMO0002). The shield provides a means of allowing a Wemos/Lolin D1 mini to directly communicate with most types of microSD card. it is also compatible with the standard Arduino SD card library. Supplied with two sets of pins headers for stacking onto a D1 Mini.



Features

Configurable CS pin, Default: D4 (GPIO0)


Pins

D1 mini	GPIO	Shield
D5	14	CLK
D6	12	MISO
D7	13	MOSI
D4	0	CS




Example Arduino Sketch:


  1. /* WeMos SD Card example - Created by HobbyComponents.com */
  2.  
  3. #include <ESP8266WiFi.h>
  4.  
  5. /* Include the standard SD card library */
  6. #include <SD.h>
  7.  
  8. #define SD_CARD_CD_DIO D8 /* DIO pin used to control the modules CS pin */
  9.  
  10. File SDFileData;
  11.  
  12. /* Initialise serial and DIO */
  13. void setup()
  14. {
  15.   Serial.begin(115200);
  16.  
  17.   Serial.println();
  18.  
  19.   /* Initialise the microSD card */
  20.   if (!SD.begin(SD_CARD_CD_DIO))
  21.   {
  22.     /* If there was an error output this to the serial port and go no further */
  23.     Serial.println("ERROR: SD card failed to initiliase");
  24.     return;
  25.   }else
  26.   {
  27.     Serial.println("SD Card OK");
  28.   }
  29.  
  30.  
  31.    /* Check if the text file already exists */
  32.    while(SD.exists("test.txt"))
  33.    {
  34.      /* If so then delete it */
  35.      Serial.println("test.txt already exists...DELETING");
  36.      SD.remove("test.txt");
  37.    }
  38.  
  39.   /* Create a new text file on the microSD card */
  40.   Serial.println("Creating test.txt");
  41.   SDFileData = SD.open("test.txt", FILE_WRITE);
  42.  
  43.   /* If the file was created ok then add come content */
  44.   if (SDFileData)
  45.   {
  46.     SDFileData.println("It worked !!!");
  47.  
  48.     /* Close the file */
  49.     SDFileData.close();  
  50.    
  51.     Serial.println("done.");
  52.   }else
  53.   {
  54.       Serial.println("Error writing to file !");
  55.   }
  56. }
  57.  
  58. /* Main program loop */
  59. void loop()
  60. {
  61.   /* Nothing to do !*/
  62. }


Downloads

sch_microsd_v1.2.0.pdf


Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.
You do not have the required permissions to view the files attached to this post.

aDub
Posts: 4
Joined: Sat Oct 28, 2017 10:15 am

Re: WeMos D1 Mini SD Card Shield (HCWEMO0004)

Post by aDub » Sat Oct 28, 2017 10:37 am

What size SD cards (capacity) can this module take?

Kind regards
Adub

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: WeMos D1 Mini SD Card Shield (HCWEMO0004)

Post by andrew » Sun Oct 29, 2017 7:55 am

The reader talks to the card in SPI mode. Hardware wise I don't believe there is any size limitation. The maximum size card you can use is more a limitation of the software library you will be using. For instance the Arduino SD card library supports cards formatted as FAT16 or FAT32. FAT16 as a maximum size limitation of 2GB and FAT32 a maximum size of 32GB.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “WeMos”