technology
workshop
craft
home
food
play
outside
costumes
Raspberry Pi - Data Logging
by AdrieSentosa on November 20, 2015
Table of Contents
Raspberry Pi - Data Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Intro: Raspberry Pi - Data Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 1: List of Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 2: Hardware Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 3: Raspberry Pi Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 4: Read your Data Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 5: Enjoy! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
http://www.instructables.com/id/Raspberry-Pi-Data-Logging/
Author:AdrieSentosa author's website
A candle loses nothing of its light when lighting another
Intro: Raspberry Pi - Data Logging
In this project, we will learn how to logging data from Raspberry Pi using Python and Excel which collect data and save the output of the collection or analysis.
Its a quite quick project and can be used either on its own or part of something bigger (Check it Out >> Integrated Weather Station).
Step 1: List of Material
For this project, we will be using:
- Raspberry Pi (mine Raspberry Pi 2)
- Flashdrive cost: ~5.00 USD
http://www.instructables.com/id/Raspberry-Pi-Data-Logging/
Step 2: Hardware Connections
In general, the connections are fairly easy. Just connect Flash Drive to Raspberry PI with USB slot and check the name of Flash Drive in Raspberry pi by type "ls /media"
in Raspberry Pi terminal, the result should be content Flash Drive's name and you are good to go.
Step 3: Raspberry Pi Programming
Below is the Arduino Weather Station code. Edit the code any way you prefer, run the module , and you should have no problems.
import os
import time
from time import sleep
from datetime import datetime
file = open("/home/pi/data_log.csv", "a")
i=0
if os.stat("/home/pi/data_log.csv").st_size == 0:
file.write("Time,Sensor1,Sensor2,Sensor3,Sensor4,Sensor5\n")
while True:
i=i+1
now = datetime.now()
file.write(str(now)+","+str(i)+","+str(-i)+","+str(i-10)+","+str(i+5)+","+str(i*i)+"\n")
file.flush()
time.sleep(5)
file.close()
File Downloads
Python Code.zip (376 bytes)
[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Python Code.zip']
http://www.instructables.com/id/Raspberry-Pi-Data-Logging/
Step 4: Read your Data Log
Your file that located in your /home/pi/ or any location you prefer is a comma-separated value(CVS) file. Comma-separated values (CVS) file is a formatted file that stores
tabular data (numbers and text) which separated by comma. To open and modify this file, simply double click on it, or open it with Microsoft Excel. You can plot your data
with Chart tools that available in Microsoft Excel.
Image Notes
1. Our data_log.csv file
2. Description of our file
Image Notes
1. Plot your data with chart tools
2. Data plotting with Excel
3. Data we got from Raspberry
Step 5: Enjoy!
After making sure that everything works correctly, you can take this project into bigger project (Check it Out >> Integrated Weather Station) or integrated it with Real Time
Clock (RTC) for accurate logging (Check it Out >> Raspberry Pi - Real Time Clock) !
Power through power bank or a plug and youre good to go!
Related Instructables
Data loggers for
use by citizen
science
participants by
caren cooper
Raspberry Pi
solar logger by
Harsh298
Analog-Style
Temperature
temperature
meter and
Data Logger by
DataLogger with
hemu.katiyar
Intel Edison by
Divinecobra
http://www.instructables.com/id/Raspberry-Pi-Data-Logging/
Streaming
Sensor Data
from a ppDAQC
Pi-Plate Using
InitialState by
jwasinger
Arduino based
time-event
logger by
Mr.What
Advertisements
Comments
http://www.instructables.com/id/Raspberry-Pi-Data-Logging/