Source: https://mokxi.com/teachers/plans/data-logging-and-storage
Updated: 2026-11-19

Lesson plan

# Data logging: SD, EEPROM and flash lesson plan

Keep data through resets and power cuts: the Uno's EEPROM and its wear, a 24LC256 on I2C, SD cards and FAT, CSV logs with DS3231 timestamps, safe writes, and a month-long weather balloon flight recorder.

4 chapters, 7 lessons, about 6 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- Small memories that survive the power going off.
- FAT, CSV logs and real timestamps.
- What reaches the card when the power goes.
- A weather balloon flight recorder built to log for a month.

### Materials for the whole unit

- Arduino Uno R3
- Half breadboard
- I2C EEPROM, 24LC256
- LED
- microSD card module
- Real-time clock, DS1307
- Real-time clock, DS3231
- Resistor x 2
- Temperature sensor, DS18B20

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 40 min

## EEPROM

Small memories that survive the power going off.

Lesson | Time | What students do

EEPROM and wear The Uno's own 1024 bytes of EEPROM: a boot counter that survives a reset, settings saved as a struct, and the sums for a cell rated at 100,000 writes. | 50 min

- Run it: memory that remembers
- Press reset
- Settings as a struct
- Cells wear out
- Save less often
- Spreading the wear

A 24LC256 on the bus 32 KB of I2C EEPROM: page writes, the write cycle found by ACK polling, and the page wrap bug that a wrong page size causes. | 50 min

- Run it: two chips, one bus
- The write cycle
- The page wrap bug
- Fix the page size
- How much fits
- Which memory for what

### Materials

- Arduino Uno R3
- Half breadboard
- I2C EEPROM, 24LC256
- Real-time clock, DS1307

### Check for understanding

Each student finishes "A 24LC256 on the bus" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Which memory for what".

Chapter 2. About 2 h 30 min

## Files on an SD card

FAT, CSV logs and real timestamps.

Lesson | Time | What students do

SD cards and FAT A microSD card on SPI: blocks, a FAT16 file system, listing the card, and why a file name has to fit in eight characters and three. | 50 min

- Run it: a card on SPI
- FAT: names on top of blocks
- Eight and three
- A name that fits
- No card
- Treat cards kindly

CSV logs A temperature every second appended to LOG.CSV: a header row, one record per line, a separator, and the file printed back on demand. | 50 min

- Run it: a log file
- One record per line
- Warm it up
- Read the file back
- A European spreadsheet
- CSV habits

Timestamps from an RTC Rows stamped by a DS3231: why millis() is not a time, Unix time, a date that rolls over at midnight by itself, and an ISO 8601 timestamp. | 50 min

- Run it: a clock on the bus
- Stamp every row
- Unix time
- Midnight, New Year
- ISO 8601
- Log in UTC

### Materials

- Arduino Uno R3
- Half breadboard
- LED
- microSD card module
- Real-time clock, DS3231
- Resistor x 2
- Temperature sensor, DS18B20

### Check for understanding

Each student finishes "Timestamps from an RTC" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Log in UTC".

Chapter 3. About 50 min

## Surviving power loss

What reaches the card when the power goes.

Lesson | Time | What students do

Power-loss safe writes A file kept open for speed: what flush() really does, a power cut that loses the unflushed rows, and the trade between speed, wear and safety. | 50 min

- Run it: a fast logger
- Written is not saved
- Pull the plug
- Past the flush
- Flush every row
- Designing for power loss

### Materials

- Arduino Uno R3
- Half breadboard
- LED
- microSD card module
- Real-time clock, DS3231
- Resistor x 2
- Temperature sensor, DS18B20

### Check for understanding

Each student finishes "Power-loss safe writes" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Designing for power loss".

Chapter 4. About 1 h 5 min

## Boss project

A weather balloon flight recorder built to log for a month.

Lesson | Time | What students do

Boss: a month-long flight recorder A weather balloon logger built for a month: a file per day named by the RTC, timestamp, temperature and altitude rows, the flight number in EEPROM, and a resume after a power cut. | 65 min

- Run it: flight recorder
- Will a month fit?
- Rows with time, temperature and height
- A blink you can see
- Power cut in flight
- A file per day
- Stretch the battery
- Make it your recorder

### Materials

- Arduino Uno R3
- Half breadboard
- LED
- microSD card module
- Real-time clock, DS3231
- Resistor x 2
- Temperature sensor, DS18B20

### Check for understanding

Each student finishes "Boss: a month-long flight recorder" on their own, without opening the hints. The simulator checks 8 of its 8 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Make it your recorder".

Your class

## Teach this unit as a class

Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
