SD Card Datalogger [SAM7]

The purpose of this project is to create a temperature and pressure logger.

The logger measures and stores temperature and pressure readings on a SD card using the FAT filesystem, so the user can easily download the stored data by plugging the SD card straight into a PC. Data can then be graphed, printed or exported to any other application.

The user can also easily setup different parameters (like the logging rate, the filename that represents the log, etc.) without reporgramming the device, using the "BeRTOS ini reader" module.

Hardware Requirements

  • an Atmel AT91SAM7X-EK board,
  • an SD card,
  • and few electronic components (part list reported below):
Part Value
C1 100nF
C2 100nF
J1 A
J2 B
J3 C
JP1 USER'S GRID 5V
JP2 USER'S GRID 3V3
JP3 USER'S GRID GND
R1 10K
R2 5K6
U1 MPXA6115A Datasheet
U2 TMP123 Datasheet

Software Requirements

BeRTOS components used for this project:

  • Device drivers: SD, UART, SPI, ADC, tmp123 (temperature sensor), mpxx6115a (pressure sensor)
  • Filesystem: FAT32
  • Configuration file parser (ini reader module)

Implementation

The hardware schematic is reported below:

bertos sd logger schematic

From the software's point of view, BeRTOS already provides all the required drivers and libraries to get informations from the used temperature and pressure sensors and log them on UART or a file on the SD card over the FAT32 filesystem.

The application uses a single process to poll data from the sensors and, depending on the user's configuration file, log those informations on a file on the SD card or the UART port.

To start the application simply create the file "sd_fat.ini" on the SD card (see the example below), plug the SD on the board and start looking at the logs.

Example configuration:

        [log]
        # Name of log file
        name = test.log
        # Enable the logging on serial device (enable = 1, disable = 0)
        log_on_serial = 1
        # Enable logging on sd file (enable = 1, disable = 0)
        log_on_file = 1
        # Period between two log in millisecond
        sample_time = 1000
        
        [serial_log]
        # Select serial port where log
        port = 0
        # Serial port baudrate
        baud = 115200
        
        [log_format]
        # Default text to insert on each log line
        line_header = BeRTOS Log:
        # Use this char to separate each log field
        field_sep = ;
        
        [temperature]
        unit_label = C
        
        [pressure]
        unit_label = hPa
        
        [voltage]
        unit_label = V

Download BeRTOS SDK!

  • With BeRTOS SDK you can generate and edit directly a sample project and setup your work environment in a few click! Download it now!