TSC230 Color Sensor Demo for Arduino
January 4, 2019Bluetooth to IR remote control translator
January 4, 2019We have two type of SD Card module in stock now – White SD Card Module and Blue SD Card Module. These breakout board will allow you to breakout the SD/MMC socket to a standard .1″ 11-pin header and compatible with 3.3V/5v Power.
The difference of them is that White SD Card Module leads out more interface except standard SPI pin. The socket has 10 pin as below:
- VCC – 5V Power
- GND – Ground
- 3.3v – 3.3V Power
- GND – Ground
- CS – Chip Select
- MOSI – Serial data in
- SCK – Serial Clock
- MISO – Serial data Out
- IN – INSERT, Status pin for is there SD card insert. High – Insert, Low – No Insert.
- WP – Write Protect Detect Switch
The Blue SD Card Module the socket is standard SPI Pin, while there is extends the two rows of IO pin. The socket define as below:
- GND – Ground
- +3.3v – 3.3V Power
- +5v – 5V Power
- CS – Chip Select
- MOSI – Serial data in
- SCK – Serial Clock
- MISO – Serial data Out
- GND – Ground
They can be controlled directly by a wide range of microcontrollers. Here, let me show you how to use the SD module with Arduino.
Before the begin, you need a SD card memory, and formatted to FAT16(recommend) or FAT32. And you can get the SD Card from our store.
There are two Arduino library for test these SD Card module. One is the SD library allows for reading from and writing to SD cards, e.g. on the Arduino Ethernet Shield. It is built on sdfatlib by William Greiman. The library supports FAT16 and FAT32 file systems on standard SD cards and SDHC cards. It only supports one open file at a time and only uses short 8.3 file names. The other library supports FAT16 formatted SD cards up to 2GB in size. 4GB FAT16 formatted SD cards might work, but is untested. Long filenames are not supported. Keep you filenames compliant with the old 8.3 standard. It called TinyFAT (Arduino SD Library) from Henning Karlsen. There we used TinyFAT for testing White SD card module. The demo will create a textfile, and fill it with 1MB of text. The file will be named ‘BIGFILE.TXT’. If the file already exists it will first be deleted. SD card must be connected to the SPI port of your Arduino. he IO connect to Arduino as below: 3V3 – 3.3V , GND – GND, CS – D10(SS), MOSI – D11, MISO – D12, CLK – D13
[cce_cpp] // Demo_writeLn (C)2011 Henning Karlsen // web: http://www.henningkarlsen.com/electronics // // This program is a demo of the writeLn()-function. // // This demo will create a textfile, and fill it with 1MB // of text. The file will be named 'BIGFILE.TXT'. If the // file already exists it will first be deleted. // // SD card must be connected to the SPI port of your Arduino. // // Remember to select 115200 baud in the Serial Monitor. // #include <tinyFAT.h> #include <avr/pgmspace.h> byte res; char *verboseError(byte err) { switch (err) { case ERROR_MBR_READ_ERROR: return "Error reading MBR"; break; case ERROR_MBR_SIGNATURE: return "MBR Signature error"; break; case ERROR_MBR_INVALID_FS: return "Unsupported filesystem"; break; case ERROR_BOOTSEC_READ_ERROR: return "Error reading Boot Sector"; break; case ERROR_BOOTSEC_SIGNATURE: return "Boot Sector Signature error"; break; default: return "Unknown error"; break; } } void setup() { // Initialize serial communication at 115200 baud Serial.begin(115200); Serial.println(); // Initialize tinyFAT // You might need to select a lower speed than the default SPISPEED_HIGH res=file.initFAT(); if (res!=NO_ERROR) { Serial.print("***** ERROR: "); Serial.println(verboseError(res)); while (true) {}; } Serial.println("This demo will create a textfile, and fill it with 1MB of text."); Serial.println("The file will be named 'BIGFILE.TXT'. If the file already exists it will first be deleted."); Serial.println(); Serial.println("***** Send any character to start *****"); while (!Serial.available()) {}; Serial.flush(); if (file.exists("BIGFILE.TXT")) file.delFile("BIGFILE.TXT"); file.create("BIGFILE.TXT"); res=file.openFile("BIGFILE.TXT", FILEMODE_TEXT_WRITE); if (res==NO_ERROR) { for (int cc=0; cc<1024; cc++) { for (int i=0; i<8; i++) { file.writeLn("012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"); } if (((cc+1)%16)!=0) Serial.print("."); else Serial.print("|"); if (((cc+1)%64)==0) { Serial.print(" "); Serial.print(cc+1, DEC); Serial.println(" KB"); } } file.closeFile(); } else { switch(res) { case ERROR_ANOTHER_FILE_OPEN: Serial.println("** ERROR: Another file is already open..."); break; default: Serial.print("** ERROR: "); Serial.println(res, HEX); break; } } Serial.println("***** All done... *****"); } void loop() { } [/cce_cpp]