element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Internet of Things
  • Technologies
  • More
Internet of Things
Blog Better Data Logging using microSD Cards
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Internet of Things to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: shabaz
  • Date Created: 2 Nov 2014 4:07 PM Date Created
  • Views 3020 views
  • Likes 4 likes
  • Comments 15 comments
  • RoadTest
  • ioe
  • internet_of_everything
  • microsd
  • data_loggers
  • flash_memory
  • internet_of_things
  • swissbit
  • iot
  • data_logging
Related
Recommended

Better Data Logging using microSD Cards

shabaz
shabaz
2 Nov 2014

Introduction

The information that is gathered from sensors in its raw form or processed, can be priceless. Results may have taken days to obtain, so data loss can be catastrophic.

 

One general rule would be to get the data off small embedded devices as soon as possible, and back it up, perhaps store it in redundant data centres, and a cost-effective way of doing that is to make use of cloud offerings.

 

However, network connectivity is not always feasible for all use-cases. Furthermore some data may need to be temporarily stored locally and processed before moving to a cloud (it is sometimes known as Fog Computing) or to a PC.

 

If data needs to be stored on removable media then redundant SD or microSD cards are options, but this doesn’t greatly help if consumer grade memory is being used for industrial scenarios – the failures could be frequent.

 

Thanks to Element 14 and Swissbit I recently got the chance to try out their high reliability microSD cards.

 

It was found that they have a number of significant features that can be highly important when selecting memory for a variety of projects. Read on..


image

 

Detail

I chose Swissbit’s 1GByte memory because it is an excellent compromise between cost and storage capacity – and 1GByte it is probably a sweet spot for many data logging applications.

 

I tried model SFSD1024N1BN1TO-E-DF-161-STD (extended temp range); the industrial temp range version SFSD1024N1BN1TO-I-DF-161-STDSFSD1024N1BN1TO-I-DF-161-STD is available from Farnell/Newark.

 

This particular model uses Toshiba memory internally. As a side note, Flash memory was invented by Masuoka Fujio working for Toshiba in the 1980’s. Fujio and others in Toshiba went on to develop a lot of key technologies over two decades and beyond which are implemented within modern Flash memory since that time.

 

The memory is more expensive than consumer grade, but surprisingly not much – about the same cost as off-the-shelf walk-in retailer/high street consumer grade memory.

 

Here are some of the benefits.

  • A full detailed specification is available – unlike off-the-shelf consumer microSD cards from PC World/Best Buy etc.
  • As mentioned the memory is available for the industrial temperature range. Minus 40 degrees C might sound extreme but many parts of the world (e.g. Mongolia) will reach these conditions easily
  • The memory chip technically is designed to be of higher reliability than consumer memory – more information on this below
  • The memory has well-defined behaviour when writing data during power failures
  • The microSD card is better built; it has gold contacts, extremely high 10k insertions lifetime, shock, vibration and bending specification (at 0.7mm thick, this can matter)

 

In a desire to increase storage capacity manufacturers use a few techniques. One is to store multiple bits of data per memory cell, rather than a single bit of data. It is known as Multi-Level Cell (MLC) technology. It allows for dense storage, but has some disadvantages; lower reliability in theory, and slower read/write operations. The Swissbit memory I tried was SLC or Single-Level Cell, which should be more reliable since the voltage thresholds can be larger for detecting logic level 0 or 1.

 

Another technique to increase memory density is to move to a smaller silicon process, with smaller features, and therefore smaller memory cells. Today 1xnm (e.g. 19 nanometer) process technology is available for memory. The particular Swissbit memory I used was built on 4xnm technology, so the memory cells are physically much larger which again in theory may offer higher reliability.

 

How long will a microSD card last for? This is hard to answer.

It is hard to stress or performance-test memory; these are things which require considerable expertise and equipment. However unlike consumer grade memory, Swissbit microSD cards come with a very detailed specification. There is a mean time before failure (MTBF) figure available in the datasheet for the Swissbit products, of 3M hours. But, as we all know, Flash memory has a limited number of write-erase cycles. Manufacturers use techniques like wear levelling to try to avoid repeatedly performing erase and write operations on the same blocks of memory inside the integrated circuit. However, there have been experiments on some manufacturer products that can prove that the wear levelling algorithm is not always optimum (as an example, a nearly-full memory device might not exercise all blocks if the remainder free memory is repeatedly written and erased – it might just exercise the few free blocks - it would depend on how clever the wear levelling algorithm was). In the case of the Swissbit microSD card, the wear levelling occurs on static data too, to achieve very even wear even if the entire memory is nearly full.

 

At what point in a products life would the microSD card health become worrisome? It is hard to find a definitive answer but it would appear that if one is writing and erasing a CDROM worth of data daily, then a 1GB Flash chip is likely to survive ten years (this is not necessarily scalable, i.e. a 16GB Flash chip could not be assumed to survive 160 years).

 

Another excellent feature is that the Swissbit product has a specified level of worst-case data loss if power is lost during a write operation. A maximum of 16 sectors (16*512 bytes) of data is specified to be lost (and old data retained – zero loss for existing saved data) in this scenario.

 

I tested the Swissbit microSD card within an SD card logger project developed a few months ago which has proved reliable for storing thermal images for testing a reflow oven (an in-progress project). The Swissbit card came pre-formatted (FAT format) and worked immediately for the project, just swapping out the full-sized SD card for the microSD card.

image

 

If you wish to use the Swissbit cards for data logging projects using TI Tiva boards, the source code is available at the above links. The project uses the cards in SDIO mode and a port of the Arduino SD card library.

 

Another useful thing for projects could be the ability to verify that the correct microSD card has been inserted, otherwise alert the user, shut down or prevent operation at temperature extremes. One way to do this is to read the ‘Card Identification’ information register inside the microSD card. This contains the manufacturer identifier, product name, serial number and so on. It proved straightforward to do this with a small modification to the SD card library.

 

First, modify SD.h so that the class called SDClass has a new public function:

uint8_t readCID(cid_t* cid) {return card.readCID(cid);}

 

Now you can read the contents in a format already defined in a typedef struct in SD/utility/SDInfo.h called cid_t which is reproduced here:

typedef struct CID {
  // byte 0
  uint8_t mid;  // Manufacturer ID
  // byte 1-2
  char oid[2];  // OEM/Application ID
  // byte 3-7
  char pnm[5];  // Product name
  // byte 8
  unsigned prv_m : 4;  // Product revision n.m
  unsigned prv_n : 4;
  // byte 9-12
  uint32_t psn;  // Product serial number
  // byte 13
  unsigned mdt_year_high : 4;  // Manufacturing date
  unsigned reserved : 4;
  // byte 14
  unsigned mdt_month : 4;
  unsigned mdt_year_low :4;
  // byte 15
  unsigned always1 : 1;
  unsigned crc : 7;
}cid_t;

 

 

Summary

For industrial use-cases or any scenario where valuable data is being collected, it is worth spending some time specifying the exact microSD storage media.

 

The Swissbit storage reviewed here has extremely impressive, significant technical features (SLC architecture, large 4xnm process, physical card construction and so on) which combined with the tight loss specification with write operations during power failure, industrial temperature range capability, excellent wear levelling capability and very reasonable cost makes it a highly attractive choice for many data logging scenarios.

 

image

 

References

NAND Flash Innovations – Seiichi Aritome

Improving Flash Wear-Leveling by Proctively Moving Static Data – Yuan-Hao Chang

  • Sign in to reply

Top Comments

  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago +1
    Nice tutorial, added to my reference lookups, now to complete my arduino tutorials for SD cards
  • mcb1
    mcb1 over 10 years ago in reply to Problemchild +1
    I'm more worried that the cards have corrupted him ....have a look at the Avatar.
  • Problemchild
    Problemchild over 10 years ago in reply to mcb1 +1
    It happens to the best of us unfortunately
  • DAB
    DAB over 10 years ago in reply to Problemchild

    Sounds like a good use for a power up diagnostic function.

    Anything you can do to ensure good data capture is always useful.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Problemchild
    Problemchild over 10 years ago in reply to shabaz

    So in theory you can ask the card if it's failing well before it does and thus save the day by asking for a repair wor something or maybe using a different area of the storage

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 10 years ago in reply to Problemchild

    Hi!

     

    They do, plus some vendors implement proprietary commands too as I understand, for deeper information. That requires an NDA : )

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Problemchild
    Problemchild over 10 years ago

    Do any of these devices have memory wear/fault statistics you can pull back  to check the status  of your Sdcard

    a bit like S.M.A.R.T ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 10 years ago in reply to Robert Peter Oakes

    Hi Peter,

     

    Thanks! looking forward to the tutorial.

    Also, browsing through the source code made me realize that although the library works well, there is room for improvement, e.g. long file names. Also it would be good to have a higher-level library designed for specifically formatting up for data logging, e.g. timestamping, description, file name, file rotation (timestamped or on specific file size) etc. So much to always do. An opportunity for another day! image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube