Step 1

Make a directory inside your "tessel-code" folder: enter mkdir microsd into your command line, then change directory into that folder: cd microsd

Step 2

Insert SD card into module.

Step 3

Plug the microSD module into Tessel port A with the hexagon/icon side down and the electrical components on the top, then plug Tessel into your computer via USB.

Step 4

Install by typing npm install sdcard into the command line.

Step 5

Save this code in a text file called microsd.js:

// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

/*********************************************
This MicroSD card example writes a text file
to the sd card, then reads the file to the
console.
*********************************************/

var tessel = require('tessel');
var sdcardlib = require('sdcard');

var sdcard = sdcardlib.use(tessel.port['A']);

sdcard.on('ready', function() {
  sdcard.getFilesystems(function(err, fss) {
    var fs = fss[0];
    console.log('Writing...');
    fs.writeFile('someFile.txt', 'Hey Tessel SDCard!', function(err) {
      console.log('Write complete. Reading...');
      fs.readFile('someFile.txt', function(err, data) {
        console.log('Read:\n', data.toString());
      });
    });
  });
});

Step 6

In your command line, tessel run microsd.js
Write to and read from your SD card!

Bonus: Change the code to write a text file to the SD card.

To see what else you can do with the microSD module, see the module docs here.

Step 7

What else can you do with a microSD module? Try a community-created project.


What are you making? Share your invention!

If you run into any issues you can check out the microSD forums.

Choose another module

Or if you're all set, move on to Wifi.

Fork on Github