background image

 

 

 

 

MANUAL 

 
 
 
 
 

EN

 

microSD Card Logging Shield for Arduino® 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

WPI304N

 

 

 

 

 

 

 

 

whadda.com

 

Summary of Contents for WPI304N

Page 1: ...MANUAL EN microSD Card Logging Shield for Arduino WPI304N whadda com ...

Page 2: ...sons with reduced physical sensory or mental capabilities or lack of experience and knowledge if they have been given supervision or instruction concerning the use of the device in a safe way and understand the hazards involved Children shall not play with the device Cleaning and user maintenance shall not be made by children without supervision General Guidelines Refer to the Velleman Service and...

Page 3: ... required for reading a twitter message or publishing online Surf to www arduino cc for more information Product overview This shield will prove useful for data logging with your Arduino Can be easily assembled and customized for any data logging project You can use this card to access microSD memory cards using SPI protocol in your microcontroller projects Specifications supports microSD cards 2 ...

Page 4: ...4 Wiring Logging shield To Arduino Uno To Arduino Mega CS cable select 4 53 SCK CLK 13 52 MOSI 11 51 MISO 12 50 5V 4 5V 5 5V 5V 5V GND GND GND ...

Page 5: ...5 Circuit Diagram ...

Page 6: ...ation protocol Preparing the microSD card The first step when using the WPI304N SD card module with Arduino is formatting the microSD card as a FAT16 or FAT32 file system Follow the instructions below 1 Insert the SD card in your computer Go to My Computer and right click on the SD card removable drive Select Format as shown in picture below 2 A new window pops up Select FAT32 press Start to initi...

Page 7: ... To make sure everything is wired correctly and the SD card is working go to File Examples SD CardInfo in the Arduino IDE software Now upload the code to your Arduino Uno board Make sure to select the right board and COM port Open the serial monitor with baud rate 9600 Normally your microSD card information will be presented in the serial monitor If everything is working properly you will see a si...

Page 8: ...3 4 This example shows how to read and write data to and from an SD card file 5 The circuit 6 SD card attached to SPI bus as follows 7 MOSI pin 11 8 MISO pin 12 9 CLK pin 13 10 CS pin 4 for MKRZero SD SDCARD_SS_PIN 11 12 created Nov 2010 13 by David A Mellis 14 modified 9 Apr 2012 15 by Tom Igoe 16 17 This example code is in the public domain 18 19 20 21 include SPI h 22 include SD h 23 24 File my...

Page 9: ...d okay write to it 47 if myFile 48 Serial print Writing to test txt 49 myFile println testing 1 2 3 50 close the file 51 myFile close 52 Serial println done 53 else 54 if the file didn t open print an error 55 Serial println error opening test txt 56 57 58 re open the file for reading 59 myFile SD open test txt 60 if myFile 61 Serial println test txt 62 63 read from the file until there s nothing ...

Page 10: ...ng is okay the following window appears on the serial monitor This indicates reading writing was successful To check about the files on the SD card use Notepad to open the TEST TXT file on the microSD card Following data appears in txt format ...

Page 11: ...g writes 5 to a file on a SD card The file will contain the current millis 6 value every 10ms If the SD card is busy the data will be buffered 7 in order to not block the sketch 8 9 NOTE myFile availableForWrite will automatically sync the 10 file contents as needed You may lose some unsynced data 11 still if myFile sync or myFile close is not called 12 13 The circuit 14 SD card attached to SPI bu...

Page 12: ...n to match your shield or module 54 Serial println Note press reset button on the board and reopen this Serial Monitor after fixing your issue 55 don t do anything more 56 while 1 57 58 59 If you want to start from an empty file 60 uncomment the next line 61 SD remove filename 62 63 try to open the file for writing 64 txtFile SD open filename FILE_WRITE 65 if txtFile 66 Serial print error opening ...

Page 13: ...0 lastMillis now 91 92 93 check if the SD card is available to write data without blocking 94 and if the buffered data is enough for the full chunk size 95 unsigned int chunkSize txtFile availableForWrite 96 if chunkSize buffer length chunkSize 97 write to file and blink LED 98 digitalWrite LED_BUILTIN HIGH 99 txtFile write buffer c_str chunkSize 100 digitalWrite LED_BUILTIN LOW 101 102 remove wri...

Page 14: ...14 whadda com Modifications and typographical errors reserved Velleman Group nv WPI304N_v01 Velleman Group nv Legen Heirweg 33 9890 Gavere ...

Reviews: