• I did some timing & power consumption measurements with a couple of SD cards.
    My setup is not perfect, don't have a scope set up, so just did reads and writes in a loop for 10 seconds, and measured the power consumption.


    • USB port :)
    • Ruideng UM25C to measure the current consumption. 100uA resolution. Don't know about it's absolute accuracy, but the values are pretty consistent. Update speed could be a bit faster...
    • Pixl.JS 2v04
    • SD card adapter, wire length is about 10cm

    SD Cards:

    • really old TwinMos 128Mb card
    • Sandisk Ultra 32Gb (got it like 5-6 years ago)
    • Sandisk EDGE 16Gb (got it last year with a Raspberry Pi bundle)

    Tests done:

    • append a 46 character long line to an existing file (to simulate adding a new line to a log file. This is my original use case)
    • read a 4 character file
    • read a 334 character long file

    A helper function (runs the funk function continuously for seconds seconds, and returns how many times it had executed):

    function doFor(seconds, funk) {
         if (isNaN(seconds)) {throw new Error("seconds NaN!")}
         if (!(typeof funk === 'function')) {throw new Error("funk ! function!")}
         // warmup
         var endT = (new Date()).getTime() + 1000 * seconds;
         var ts = 0;
         while ((new Date()).getTime() < endT) {funk(); ts++;}
         return ts;

    Test values and files for perf measurements:

    // two test files, one is 4 characters long, the other is 334 characters long Lorem Ipsum :)
    fs.writeFile("4ch.txt", "alma")
    fs.writeFile("334ch.txt", `In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document without relying on meaningful content (also called greeking).Replacing the actual content with placeholder text allows designers to design the form of the content before the content itself has been produced.`)
    // just a row of data
    sor = "Thu Jan 1 1970 00:06:43 GMT+0000,100,22.5,233\n"
    // reading the files:
    doFor(10, function(){fs.readFile("4ch.txt")})
    doFor(10, function(){fs.readFile("334ch.txt")})
    // writing data:
    doFor(10, function(){fs.appendFile("teszt.txt", sor)})

    Baseline power consumption:

    • Pixl idle, no BLE connection, LCD on: 100uA
    • Pixl idle, BLE connected: 0.9-1mA
    • Pixl idle, BLE disconnected after writing 128Mb (SD mounted, LCD off): 2-300uA
    • Pixl idle, BLE disconnected after writing 32Gb Sandisk (same if SD still mounted or unmounted): 5-600uA
    • Pixl idle, BLE disconnected after writing 32Gb Sandisk (SD unmounted, LCD off): 3-400uA
    • Pixl connected & running in a loop doFor(10, function(){}): 8.4mA

    Some surprises:

    • all cards work just fine at 8MHz SPI clock with this setup. (altho' I didn't check every single byte, data seems to be OK on all cards...)
    • reading 4 bytes of data takes almost as much time as reading 334 bytes. Ok, probably isn't surprising if someone knows that data is stored in sectors...
    • the old 128Mb card beats the 16Gb Sandisk in both speed and power consumption. Beats the newer card even more, if we adjust the power consumption for read/write speed.

    The 32Gb Sandisk Ultra is faster, and consumes more power.
    But if we assume that a single read or write takes the propotionally less time, it's overall energy consumption is lower, if we go to 1MHz reads and 2MHz writes and above. Write energy consumption:

    • 18mA, 14.8 write/sec with the old card -> 1.22 mili-amper-second for one write
    • 31.2mA, 27.4 write/sec with the 32Gb card -> 1.14 mili-amper-second for one write

    So looks like the fastest card at the highest speed is the winner?
    But 30mA current is a bit high if you run on a coin cell. Or might not matter, because a capacitor could smooth out a single write-spike? Dunno, I guess that's the point where a proper setup with an oscilloscope would be handy.

    Raw data in the attachment

    1 Attachment


Avatar for AkosLukacs @AkosLukacs started