Widget Recent Post No.

Labels Max-Results No.

ARDUINO LESSON 21: LOG SENSOR DATA TO AN SD CARD

Image result for sd card arduino
In most of our work so far, we have just watched our data go by on the Serial Monitor. In most cases, you will want to have some means to store your data. The easiest way to do this is to use a simple SD card reader. For this example, we use the Virtuabotix SD Card Reader.



Arduino connected to a BMP180 pressure sensor and an SD Card Reader

In this tutorial, we will need to have some sensor hooked up so we will have some data to store. We will be using the BMP 180 Pressuer and Temperature sensor from adafruit.  We have a complete tutorial on this sensor  HERE.  You will need to go to that lesson and get the sensor hooked up, the library installed, and the software done. All this is explained step-by-step in the LESSON.
The BMP180 is connected to the arduino as follows:
Connecting Up the BMP180 Pressure and Temperature Sensor
BMP180 PinArduino Pin
Vin5V
GNDGND
SCLA5
SDAA4
Once you have the BMP180 connected, test and make sure your code is working, and you are getting good pressure and temperature readings. Once that is working, you are ready to connect your SD card Reader/Writer.
The SD card reader should be connected as follows:
Connecting the SD Card Reader
Sd Card Reader PinArduino PinDetails
GNDGNDCommon Ground
3.3 V – (NOT USED)
+55VPower
CS4Chip Select
MOSI11SPI Data
SCK13Clock
MISO12SPI Data
GNDGNDCommon Ground
In the video we will show step-by-step how to develop the software. You should follow along in the video, and not copy and paste the code below. You will never learn to program if you do not write your own code. The code below is to help you in case you get stuck.
If you have the BMP180 and the SD card connected correctly,  this should create a file called PTData.txt on the card, and write comma delimited data to the file. Note that if the file does not exist on the card, the command:
will create the file. If the file already exists, this command will append data to the existing file. If you want to start with a clean new data set, erase the old PTData file.
When you run the program, you end up with a PTData.txt file on the SD card. When you have finished logging your data, you can pop the card out, put it into your PC, and then import the data into excel. You should now be able to plot, graph or analyze the data using all the powerful features of Excel.
appeared here
ARDUINO LESSON 21: LOG SENSOR DATA TO AN SD CARD ARDUINO LESSON 21: LOG SENSOR DATA TO AN SD CARD Reviewed by Reshaper on September 23, 2018 Rating: 5

No comments:

Powered by Blogger.