engines

AltSql Instant: A Battery-Free Sensor on MRAM Saved 1,428 Readings in a Simulated Minute, Against 220 for AltSql Core on Flash

Some sensors have no battery. A small solar cell charges a capacitor, and when it is full the sensor wakes and works until the charge runs out. Then the power goes, wherever the sensor happens to be. It might be between readings or in the middle of writing one. Every bit of energy spent on storage is a reading not taken.

Flash memory makes this hard. It writes in pages and has to erase before it can write again, so a storage engine for flash keeps a log and cleans it up later. MRAM and FRAM work differently. They write single bytes, need no erase and keep what was written the moment the write ends.

AltSql Instant is storage built for that kind of memory. Each record sits in a fixed place and is updated there. A write is kept as soon as its call returns, and if the power goes at any byte of a write, that write is left whole or not there at all. Opening the store after a power cut reads a fixed part of the memory, 6,200 bytes for the 256 KiB store measured in its report, and writes 16 bytes. Instant’s records are AltSql Core’s, byte for byte, so a gateway running Core takes them as they are.

The AltSql Instant demo: two capacitors charging and draining over a minute, one sensor on MRAM with AltSql Instant and one on NOR flash with AltSql Core.

What the Alpha Found

On models of a common MRAM chip and a common NOR flash chip, with energy computed from their datasheets, a loop that writes a value and a row each cycle used 1.66 µJ a cycle with Instant on MRAM. AltSql Core took 4.04 µJ on the same MRAM and 74.2 µJ on flash. In the demo, with 500 µW of light and a 2,200 µF capacitor, the sensor on Instant and MRAM saved 1,428 readings in a minute, and the one on AltSql Core and NOR flash saved 220. With a 1,000 µF capacitor the counts were 1,092 and 51. Neither lost a reading it had saved. The demo’s energy comes from its model of the chips, and the microcontroller’s share is an assumption.

Try It

Open the AltSql Instant demo and run a minute in good light. Try a smaller capacitor, then dim light. You can also cut the power at a byte of your choosing in the middle of a reading’s write and look at the bytes Instant left on the MRAM.

Where It Stands

AltSql Instant is one C file of 1,270 lines, its own storage layer with AltSql Core’s records and sync. It works and is tested in simulation on a PC, and it has not yet run on a microcontroller. The chips are emulated, and their time and energy come from their datasheets.