Skip to content

Raspberry Pi: Getting Data

Ryan edited this page Jun 12, 2018 · 1 revision

Current Raspberry Pi Setup

Snippets here are taken from Raspberry Pi 2b

  1. See what sensors are running
  2. Crontab
  3. Getting the data

See what sensors are running

Each logging program is named <sensor>_logger.py so you can see what sensors are running by typing ps -ef | grep logger. For example, on the Rasberry Pi 2b this command produces the following output:

jason@2B:~/sensors/raspberry_pi $ ps -ef | grep logger
jason      444   435  0 May24 ?        00:11:11 python /home/jason/sensors/raspberry_pi/pms5003/PMS5003_logger.py
jason      445   437  1 May24 ?        05:07:16 python /home/jason/sensors/raspberry_pi/bme280/BME280_logger.py

Which means we are collecting data for PMS5003 and BME280. It appears however that PMS5003 is a zombie process. Not sure why this is the case atm considering PMS5003 is on the crontab. Nonetheless, another way to check what sensors are running is to go to a sensor's respective folder, then type the command ls -alh to see when the csv was last updated.

Crontab

su into the user jason, then run crontab -e to see what sensors are setup to run.

Getting the data

Data for each sensor is located in its respective folder. For example, if you want data from the BME280 sensor, navigate to /home/jason/sensors/raspberry_pi/bme280 and open pi_bme280_log.csv. The following snippet shows which sensors have recorded data for the raspberry pi 2b:

jason@2B:~/sensors/raspberry_pi $ tree
.
├── bme280
│   ├── Adafruit_BME280.py
│   ├── Adafruit_BME280.pyc
│   ├── bme280_check.sh
│   ├── BME280_logger.py
│   └── pi_bme280_log.csv
├── bmp280
│   ├── Adafruit_BMP280.py
│   └── BMP280_logger.py
├── pms5003
│   ├── pi_pms5003_log.csv
│   ├── pms5003_check.sh
│   └── PMS5003_logger.py
├── si7021
│   ├── si7021_check.sh
│   └── Si7021_logger.py
├── tsl2591
│   ├── tsl2591_check.sh
│   ├── TSL2591_logger.py
│   └── tsl2591.py
└── voc_co2
    └── CCS811_logger.py

6 directories, 16 files