rpi_data_collection
Raspberry Pi Based Data Collection Device
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.5%) to scientific vocabulary
Repository
Raspberry Pi Based Data Collection Device
Basic Info
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
Open Source Raspberry Pi Based Data Collection
This is an open-source project for Data Collection based on low-cost Raspberry Pi single-board computers, low-cost sensor modules, 3D-printed housings, and Python code to generate human-readable data in the form of spreadsheets, either Excel (.xls) or Comma-Separated Values (.csv) files.
Goal
Python-based code for collecting data on Raspberry Pi Zero 2 W from external sensors and writing it to an internal microSD card as an Excel file. The code can be run through a simple terminal command outlined below.
This device can be used as a modular biometric and environmental data collection device or as a standalone data collection device.
The goal of this project is on making the entire process as user-friendly and accessible as possible.
Navigation
For first time setup: Directions for First Time Setup
For information on Modules: Sensors and Modules
For 3D printable enclosures: 3D Files or in a collection on Printables.com
Python File Explanation and Directions
File organization and Directions for how to use specific configurations.
Python Files Overview
collect_all.py
Collects data using the camera (via libcamera-still), GPS, and temperature/humidity sensors. Use this for full environmental and location data collection.
camera.py
Collects data using only the camera module. Use this for image/video data collection without GPS.
camera_gps.py
Collects data using both the camera and GPS modules. Use this for synchronized image/video and location data collection.
How to Run
- Navigate to the directory:
cd rpi_data_collection - Run the desired Python file:
python3 camera.py # For camera-only data collection python3 camera_gps.py # For camera + GPS data collection python3 collect_all.py # For camera + GPS + temperature/humidity data collection
Sensors and Modules
Supported Sensors and Modules
- GPS Module: Provides geotagging data for mapping in GIS applications.
- Camera Module: Collects environmental data and facial data for later use with computer vision analysis.
- Battery Module: PiSugar battery that enables wireless operation of the data collection device.
Future Sensors and Modules
- Temperature/Humidity Sensor: Measures ambient temperature and humidity for environmental monitoring.
- Air Quality Sensor: Measures air quality parameters (e.g., particulate matter, VOCs, CO2) for pollution and health studies.
- Microphone Module: Measures environmental noise levels for noise pollution data collection.
- Heartrate Sensor: Measures heart rate to detect stress for biometric data collection.
- Additional Air Quality Sensors: For more advanced pollution and health monitoring.
Directions for First Time Setup
Step-by-Step Setup for Beginners
1. Flashing the microSD Card with Raspberry Pi OS
- Download and install Raspberry Pi Imager on your computer.
- Insert your microSD card into your computer.
- Open Raspberry Pi Imager and select "Raspberry Pi OS (32-bit)" as the operating system.
- Click the gear icon (⚙️) or "Edit settings" before writing the image:
- Set a hostname (e.g.,
rpi-data) - Enable SSH (choose "Enable SSH" and set a password)
- Set username and password (default:
pi/raspberry) - Configure WiFi:
- Enter your WiFi SSID (network name) and password
- Tip: Institutional WiFi (e.g., university/corporate) often does not work reliably with Raspberry Pi. Instead, use a personal hotspot from your laptop or smartphone. See below for hotspot setup.
- Set locale, timezone, and keyboard layout if needed
- Set a hostname (e.g.,
- Click "Save" and then "Write" to flash the microSD card.
- Safely eject the microSD card and insert it into your Raspberry Pi Zero.
2. Setting Up a Personal Hotspot (Recommended)
Smartphone Hotspot
- On your phone, go to Settings > Network & Internet > Hotspot & tethering (Android) or Settings > Personal Hotspot (iPhone).
- Turn on the hotspot and set a simple WiFi name (SSID) and password.
- Enter these credentials in Raspberry Pi Imager when flashing the SD card.
Laptop Hotspot (Windows)
- Go to Settings > Network & Internet > Mobile hotspot.
- Turn on "Mobile hotspot" and set the network name and password.
- Enter these credentials in Raspberry Pi Imager when flashing the SD card.
3. Powering and Finding Your Raspberry Pi
- Insert the flashed microSD card into your Raspberry Pi Zero and power it on.
- Wait 1-2 minutes for it to boot and connect to WiFi.
- Find the Pi's IP address:
- Check your hotspot device for connected devices
- Use a network scanner app (e.g., Fing)
- If you set a hostname, try:
ping rpi-data.localfrom your computer
4. Connecting to the Raspberry Pi via SSH
- Open Terminal:
- On Windows 10/11: Use the built-in Windows Terminal or Command Prompt (no need to install PuTTY unless you prefer it)
- On Mac: Use the built-in Terminal app
- On Linux: Use your system's Terminal
- Connect using:
ssh pi@<raspberrypi_ip_address>- Replace
<raspberrypi_ip_address>with the actual IP address or hostname - Enter the password you set in Raspberry Pi Imager
- Note: PuTTY is an alternative SSH client for Windows, but most users can use Windows Terminal or Command Prompt without installing extra software.
- Replace
5. Cloning the Repository to Your Raspberry Pi
- Once connected via SSH, update your Pi:
sudo apt-get update sudo apt-get upgrade - Install git:
sudo apt-get install git - Clone the repository:
git clone https://github.com/hleve/rpi_data_collection.git cd rpi_data_collection
6. (Optional but Recommended) Create and Activate a Python Virtual Environment
- Install Python 3 and venv if not already installed:
sudo apt-get install python3 python3-venv - Create and activate the virtual environment:
python3 -m venv .venv source .venv/bin/activate
7. Install Required Python Packages
- Upgrade pip and install requirements:
python3 -m pip install --upgrade pip python3 -m pip install -r requirements.txt - If you see errors about missing system packages (e.g., pandas), install them:
sudo apt-get install python3-pandas - The camera scripts use the
libcamera-stillcommand-line tool (not picamera or picamera2). This is included by default on Raspberry Pi OS Bullseye and later. If you have issues, run:sudo apt-get install libcamera-apps - If you see a dpkg error (e.g., "dpkg was interrupted"), run:
sudo dpkg --configure -a
8. Running the Data Collection Code
- Navigate to the project directory:
cd rpi_data_collection - Run the Python file:
python3 collect_camera_gps.py
If you need to copy only specific files (not the whole repo), you can use scp from your computer:
sh
scp <local_file_path> pi@<raspberrypi_ip_address>:~/rpi_data_collection/
Replace <local_file_path> with the path to your file and <raspberrypi_ip_address> with your Pi's IP address.
License
This project is licensed under the Apache 2.0 License
Owner
- Login: hleve
- Kind: user
- Repositories: 1
- Profile: https://github.com/hleve
GitHub Events
Total
- Release event: 1
- Member event: 1
- Push event: 23
- Create event: 1
Last Year
- Release event: 1
- Member event: 1
- Push event: 23
- Create event: 1
Dependencies
- datetime *
- i2c-tools *
- numpy *
- openpyxl *
- os *
- pandas *
- pyaudio *
- pyserial *
- python3-smbus *
- serial *
- time *