# Micro SD card library

**URL:** <https://community.particle.io/t/micro-sd-card-library/2666>\
**Category:** Libraries\
**Created:** [February 7, 2014, 3:04am UTC](https://community.particle.io/t/micro-sd-card-library/2666 "2014-02-07T03:04:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [February 7, 2014, 3:04am UTC](https://community.particle.io/t/micro-sd-card-library/2666/1 "2014-02-07T03:04:14Z")

</div>

Is anyone working on a microSD/SD port?

😄

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [February 7, 2014, 3:10am UTC](https://community.particle.io/t/micro-sd-card-library/2666/2 "2014-02-07T03:10:34Z")

</div>

I started looking at it, and it was getting to be a lot of code. Now that I’m developing locally it will be easier to play with by just including the libraries, and converting small parts. Mashing many headers and cpps all in one file gets to be a PITA so I gave up at the time. Also there was the SD library that comes with Arduino IDE I think, and another one SDFat … was trying to figure out which one worked best first before I started. Any suggestions? Currently I’m kinda busy with a few other things at the moment, so if anyone else is attempting/working on this, please don’t think I’ll get it to by tomorrow 😉

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [February 7, 2014, 3:29am UTC](https://community.particle.io/t/micro-sd-card-library/2666/3 "2014-02-07T03:29:32Z")

</div>

I am going to look at PJRC’s teensy 3 library. Paul is very good at producing great code. This is a work in progress so I have no expectation but obviously for graphics work, it would be handy. Though I love the cloud connection, sometime local logging is also good. 😄

**UPDATE** : Teensy 3 has no specific microSD library, so SDfat and whatever else I can find it is then!

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [February 7, 2014, 3:46am UTC](https://community.particle.io/t/micro-sd-card-library/2666/4 "2014-02-07T03:46:11Z")

</div>

[https://code.google.com/p/sdfatlib/downloads/list](https://code.google.com/p/sdfatlib/downloads/list)

[http://arduino.cc/en/Reference/SD](http://arduino.cc/en/Reference/SD)

---

<div class="post-metadata">

**Author:** ![zach](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/zach/32/20714_2.png) [@zach](https://community.particle.io/u/zach)\
**Post date:** [February 7, 2014, 4:45am UTC](https://community.particle.io/t/micro-sd-card-library/2666/5 "2014-02-07T04:45:53Z")

</div>

Support for multiple files in the web IDE coming tomorrow… 😉

---

<div class="post-metadata">

**Author:** ![timb](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/timb/32/1913_2.png) [@timb](https://community.particle.io/u/timb)\
**Post date:** [February 7, 2014, 5:58am UTC](https://community.particle.io/t/micro-sd-card-library/2666/6 "2014-02-07T05:58:20Z")

</div>

> [@zach](#):
>
> Support for multiple files in the web IDE coming tomorrow...

I came.

(1234567890)

---

<div class="post-metadata">

**Author:** ![Kitard](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/kitard/32/20860_2.png) [@Kitard](https://community.particle.io/u/Kitard)\
**Post date:** [February 15, 2014, 2:08am UTC](https://community.particle.io/t/micro-sd-card-library/2666/7 "2014-02-15T02:08:48Z")

</div>

@peekay123 - did you get chance to look at this?

I started looking at the Arduino SD library. Was thinking about how we might chunk up the code using #define’s and #if defined() to minimise the memory overhead. Most of the time you don’t need all of the functions available, and we could exclude a range of headers / functions when not needed.

The functions could be grouped into a couple of broad categories

- utility
- file i/o basic
- file i/o full

or

- utility
- file i/o read
- file i/o write

Any thoughts ?

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [February 15, 2014, 4:44am UTC](https://community.particle.io/t/micro-sd-card-library/2666/8 "2014-02-15T04:44:37Z")

</div>

Kitard, I have not got to it. I was busy on some other libraries and getting to know smartthings. I know BDub was also going to look at it. I agree that reducing the footprint is a good idea. I usually use microSD for two things. One is logging which needs minimal functionality and the other is for graphics apps to hold screens, fonts or whatever else, which needs more functions.

We could make an SD “tiny” version and an SD “full” version using #defines. Tiny would be geared towards logging or simple apps where you only need to create/open/append/close a file and no directories or even formatting. Full would be, well, the entire library. Thoughts?

---

<div class="post-metadata">

**Author:** ![Kitard](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/kitard/32/20860_2.png) [@Kitard](https://community.particle.io/u/Kitard)\
**Post date:** [February 16, 2014, 11:40am UTC](https://community.particle.io/t/micro-sd-card-library/2666/9 "2014-02-16T11:40:03Z")

</div>

Tiny and full sounds like a good compromise. I need to set up a local dev. environment as the IDE won’t allow me to manage the number and complexity of files for the SD libraries.

Have a week away with work - might try see if I can get to it this week as I doubt I will have much on in the evenings.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [February 16, 2014, 3:33pm UTC](https://community.particle.io/t/micro-sd-card-library/2666/10 "2014-02-16T15:33:11Z")

</div>

Kitard, I have the local environment setup but I need to setup a microSD project. I’ll see if I can’t do a first pass compile to see where the code stands vis-a-vis the Spark environment. Have a good week! 😄

---

<div class="post-metadata">

**Author:** ![choosatron](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/choosatron/32/665_2.png) [@choosatron](https://community.particle.io/u/choosatron)\
**Post date:** [February 16, 2014, 5:26pm UTC](https://community.particle.io/t/micro-sd-card-library/2666/11 "2014-02-16T17:26:16Z")

</div>

Apologies for not being very active here when I have materials that may help. I got a port of an SD / microSD card library to work. I zipped it up and here is the link to the code: [http://choosatron.com/files/firmware/SD.zip](http://choosatron.com/files/firmware/SD.zip)

I modified the library here: [https://bitbucket.org/dinau/sdfatmaple-vld/wiki/Home](https://bitbucket.org/dinau/sdfatmaple-vld/wiki/Home)

I did a quick messy job, trying to modify as little as possible. Do whatever you’d like with it, and hopefully share any updates!

I’ve been building by checking out the firmware, common, and communication repos. For the sake of quick deving, I created a ‘lib’ directory at the base of core-firmware, and put the SD folder in there. It has a build file already.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [March 9, 2014, 5:39am UTC](https://community.particle.io/t/micro-sd-card-library/2666/12 "2014-03-09T05:39:37Z")

</div>

@choosatron I finally got around to trying out your port of the Maple/Arduino SD library and I got it compiling, then wired up an SD card directly to the core (no level shifting needed) and it worked perfectly straight away. Then I got to pulling a few of the better examples together for the Spark Core, and I cleaned up the library files a little further. I kind of left some of the commented out #includes there for historical purposes… but I was able to chop a few files away, and more of the defines and stuff.

I really like the way you included the files for the project as well, that works so much cleaner than what I was doing.

Would you mind if I put this up on github?

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [March 9, 2014, 5:48am UTC](https://community.particle.io/t/micro-sd-card-library/2666/13 "2014-03-09T05:48:03Z")

</div>

BDub, I feel dumb. I’ve been using choosatron’s library for a while now and really like it. I should have posted it on github myself and perhaps saved you some time, at least if you compile locally! 😊

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [March 9, 2014, 6:07am UTC](https://community.particle.io/t/micro-sd-card-library/2666/14 "2014-03-09T06:07:34Z")

</div>

No worries. Did you edit his files at all? Yeah I think compiling locally is the only way to really go with this one… there are too many files!

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [March 9, 2014, 6:38am UTC](https://community.particle.io/t/micro-sd-card-library/2666/15 "2014-03-09T06:38:12Z")

</div>

I did some cleanup but nothing major since it worked! At some point we will have to chose one good library. Perhaps we should poll to see if anyone else has something to contribute.

---

<div class="post-metadata">

**Author:** ![choosatron](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/choosatron/32/665_2.png) [@choosatron](https://community.particle.io/u/choosatron)\
**Post date:** [March 9, 2014, 9:47pm UTC](https://community.particle.io/t/micro-sd-card-library/2666/16 "2014-03-09T21:47:57Z")

</div>

@Bdub Get it in a github! Lets get it clean and lean. I’d love to get rid of as much historical stuff as possible, and not worry about it being super portable. At least for me, I’m planning on having it be as slim as possible for working on the Spark Core.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [March 9, 2014, 10:04pm UTC](https://community.particle.io/t/micro-sd-card-library/2666/17 "2014-03-09T22:04:49Z")

</div>

choosatron, I agree! I believe ALL Spark libraries should be specific to the Spark since there are not “alike” platforms anyway. 😄

---

<div class="post-metadata">

**Author:** ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)\
**Post date:** [March 9, 2014, 10:13pm UTC](https://community.particle.io/t/micro-sd-card-library/2666/18 "2014-03-09T22:13:33Z")

</div>

Good to know you guys will have a Micro SD card library up and running once I get to the point of needing one which may be soon.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [March 9, 2014, 10:21pm UTC](https://community.particle.io/t/micro-sd-card-library/2666/19 "2014-03-09T22:21:55Z")

</div>

RWB, you can see it coming, can’t you! Someone will develop a digole “drawBitmapFromSD()” command! It’s just a matter of time 😉

---

<div class="post-metadata">

**Author:** ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)\
**Post date:** [March 9, 2014, 10:42pm UTC](https://community.particle.io/t/micro-sd-card-library/2666/20 "2014-03-09T22:42:17Z")

</div>

Yea I could use it right now. I just tried to create 13 frame intro animation but there is not enough ram for it 😄

[Next page](https://community.particle.io/t/micro-sd-card-library/2666.md?page=2)
