PressureSensorLogger
During the weekend I wanted to create a small project which logs the data provided by an athmospheric pressure sensor to an SD card.
Parts
Previously I ordered a micro SD card shield from Banggood.com and I have a BMP180 pressure sensor from Adafruit.
The idea was to connect these two components to an Arduino Nano microcontroller and put the whole project onto a breadboard.
Wiring
The electrical connections among the project components can be seen on the following Fritzing diagram:
Code
The code was written in Arduino IDE. An excerpt can be seen below:
First the following required libraries have to be included:
1 |
The baud rate of the Serial connection has to be adjusted. I used 19200 as it can be seen below:
1 | Serial.begin(19200); |
The maximum amount of log lines is customizable through the following variables:
1 | //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:
Index | Pressure | Temperature | Altitude |
---|---|---|---|
milliBar | celsius | meters |
Debug
In order to help debugging everything is written to the serial interface, so it can be viewed in Serial Monitor:
Repository
The PressureSensorLogger GitHub repository contains all project related materials.