CSV output of pulse data with Raspberry Pi (CSV output)

Procedures and links

  1. Preparation and basics http://qiita.com/tkyko13/items/62ff91bce7d9e555c434
  2. Analog input confirmation http://qiita.com/tkyko13/items/981989a006a95821ccde
  3. Check with python http://qiita.com/tkyko13/items/44ca53b027fa249acdc6
  4. Pulse sensor http://qiita.com/tkyko13/items/e4afc73add81d7bbb426
  5. csv output here

CSV with python

If you search, you will find many reference articles. I also referred to it from the following URL. http://qiita.com/okadate/items/c36f4eb9506b358fb608 First, put a simple sample code regardless of the pulse sensor. If you do this, data.csv will be created in the same folder as this python code, and the numbers from 0 to 99 will be lined up vertically. Finally, make this number the pulse rate.

csvSample.py


import csv

f = open('data.csv', 'w')

for i in range(0, 100):
    writer = csv.writer(f, lineterminator='\n')
    writer.writerow([i])

f.close()

If you can confirm that it works, instead of using the for statement, match it with the sample code created in "3. Confirm with python" two times before.

sample.py


import smbus
import time
import threading
import csv

I2C_ADDRESS = 0x48

bus = smbus.SMBus(1)
f = open('data.csv', 'w')

def loop(count):

    count = count+1
    bus.write_byte(I2C_ADDRESS, 0xFF)
    value = bus.read_byte(I2C_ADDRESS)
    print value

    writer = csv.writer(f, lineterminator='\n')
    writer.writerow(value)

    if count < 100 :
        t = threading.Timer(0.1, loop, args=(count,))
        t.start()
    else :
        f.close()
        print 'finish'

t = threading.Thread(target=loop, args=(0,))
t.start()

Pulse measurement

Now, when the pulse sensor can be wired (last time) and the above python code can be executed, we will measure it. The trick is to release your finger a little.

csv data transfer

If you can safely create csv data in Raspberry Pi, you are successful. Transfer data to your PC. The method is free, but I used ftp software (Cyberduck because it is a mac). It is also possible to insert a USB memory into the Raspberry Pi.

Open the data in Excel and insert the graph

It seems that my data wasn't working. Below is a graph image comparing when the finger is placed and when it is not placed at all.

スクリーンショット 2016-02-23 18.42.38.png

Wiring, environment, data acquisition interval too wide ... If hoe ... is already dead ...?

Summary

Whatever the result, this is a semi-forced end. Improvement I would like to continue to improve. It's been a long time, but thank you for your hard work.

Recommended Posts

CSV output of pulse data with Raspberry Pi (CSV output)
CSV output of pulse data with Raspberry Pi (confirm analog input with python)
GPGPU with Raspberry Pi
Get CPU information of Raspberry Pi with Python
DigitalSignage with Raspberry Pi
Measure CPU temperature of Raspberry Pi with Python
Take the value of SwitchBot thermo-hygrometer with Raspberry Pi
Log the value of SwitchBot thermo-hygrometer with Raspberry Pi
How to output CSV of multi-line header with pandas
Let's operate GPIO of Raspberry Pi with Python CGI
Mutter plants with Raspberry Pi
Extract Twitter data with CSV
Check! Get sensor data via Bluetooth with Raspberry Pi ~ Preparation
Production of temperature control system with Raspberry Pi and ESP32 (1)
I sent the data of Raspberry Pi to GCP (free)
[Raspberry Pi] Stepping motor control with Raspberry Pi
Use vl53l0x with Raspberry Pi (python)
Servo motor control with Raspberry Pi
Serial communication with Raspberry Pi + PySerial
Output to csv file with Python
Output from Raspberry Pi to Line
OS setup with Raspberry Pi Imager
Try L Chika with raspberry pi
VPN server construction with Raspberry Pi
Try moving 3 servos with Raspberry Pi
Using a webcam with Raspberry Pi
I tried to automate the watering of the planter with Raspberry Pi
Notify LINE of body temperature from BLE thermometer with Raspberry Pi # 1
Notify LINE of body temperature from BLE thermometer with Raspberry Pi # 2
Output log file with Job (Notebook) of Cloud Pak for Data
Graph display of household power consumption with 3GPI and Raspberry Pi
Output csv with different number of digits for each column with numpy
Periodically log the value of Omron environment sensor with Raspberry Pi
Measure SIM signal strength with Raspberry Pi
Pet monitoring with Rekognition and Raspberry pi
Data input / output in Python (CSV, JSON)
Hello World with Raspberry Pi + Minecraft Pi Edition
Build a Tensorflow environment with Raspberry Pi [2020]
Get BITCOIN LTP information with Raspberry PI
Try fishing for smelt with Raspberry Pi
Programming normally with Node-RED programming on Raspberry Pi 3
Improved motion sensor made with Raspberry Pi
Try Object detection with Raspberry Pi 4 + Coral
UnicodeEncodeError struggle with standard output of python3
Power SG-90 servo motor with raspberry pi
Plot CSV of time series data with unixtime value in Python (matplotlib)
Working with sensors on Mathematica on Raspberry Pi
Use PIR motion sensor with raspberry Pi
Make a wash-drying timer with a Raspberry Pi
Recommendation of Altair! Data visualization with Python
Infer Custom Vision model with Raspberry Pi
Operate an oscilloscope with a Raspberry Pi
Logging the value of Omron environment sensor with Raspberry Pi (USB type)
Create a car meter with raspberry pi
Read the data of the NFC reader connected to Raspberry Pi 3 with Python and send it to openFrameworks with OSC
Example of efficient data processing with PANDAS
Inkbird IBS-TH1 value logged with Raspberry Pi
Production of temperature control system with Raspberry Pi and ESP32 (2) Production of transmission device
Working with GPS on Raspberry Pi 3 Python
Simple VPN construction of IPsec gateway with Ubuntu 20.04 and Raspberry Pi ―― 1. StrongSwan introduced
[Python] From morphological analysis of CSV data to CSV output and graph display [GiNZA]