During the weekend I wanted to create a small project which logs the data provided by an athmospheric pressure sensor to an SD card.
The idea was to connect these two components to an Arduino Nano microcontroller and put the whole project onto a breadboard.
The electrical connections among the project components can be seen on the following Fritzing diagram:
The code was written in Arduino IDE. An excerpt can be seen below:
First the following required libraries have to be included:
The baud rate of the Serial connection has to be adjusted. I used 19200 as it can be seen below:
The maximum amount of log lines is customizable through the following variables:
//Vairables for log count
The data will be logged into a file called pressure.log, which will be found in the root folder of the SD card:
The content of the log file is in the following format:
In order to help debugging everything is written to the serial interface, so it can be viewed in Serial Monitor:
The PressureSensorLogger GitHub repository contains all project related materials.