https://github.com/davicedraz/raspberry-usb-csv
Automatically detects new USB disks and copy to it the actual sensors readings on a .csv file
https://github.com/davicedraz/raspberry-usb-csv
csv-export raspberry-pi usb-drive
Last synced: 8 months ago
JSON representation
Automatically detects new USB disks and copy to it the actual sensors readings on a .csv file
- Host: GitHub
- URL: https://github.com/davicedraz/raspberry-usb-csv
- Owner: davicedraz
- Created: 2020-04-21T20:55:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-21T21:41:14.000Z (over 5 years ago)
- Last Synced: 2025-01-03T11:12:51.638Z (9 months ago)
- Topics: csv-export, raspberry-pi, usb-drive
- Language: Python
- Homepage:
- Size: 81.1 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Automatic .csv backup to USB Disks
This program creates an execution routine that basically works by: when connecting a USB drive to the device's USB port, the user will only needs to wait for an automatic copy of all the data collected by the device in .csv format. In order to have access to the data quickly when he has physical access to the machine and that it is not necessary to have access to the internet.
The script `save.sh` performs this backup once, exactly at the moment you execute it, as an example of the continuous operation of the software.
## Setup
Create a .env file and set the enviroment variables needed, for example:
```bash
FILE_PATH = ./temp/google_stock_data.csv
SERIAL_PORT = 'COM1'
DEBUG = 1
```## Usage
Create a ```__main__.py``` file in this directory:
```python
import export as export
from config import config as envbackup_thread = export.USBListener(thread.new_drive_signal)
if __name__ == "__main__":
payload = {} #your json dict
backup_thread.start()
print("Waiting for USB connections ...")
export.write_data(payload)
```Start the script creating a background proccess:
```bash
$ python3 __main__.py &
```
----## Install
Pip will install all the libraries required by the following command:
```bash
$ make install
```Or simply:
```bash
$ pip install -r requirements.txt
```## Build
In order to generate a package ready for execution and loading on the desired device, we recommend that you use the build command:```bash
$ make build
```## Test
```bash
$ make tests
```## Run
This command will execute the build product file generated by the build command:```bash
$ make run
```
Or simply run the good old build & run:```bash
$ python setup.py install && python firmware.py
```## Run USB thread only
Start the script creating a background proccess:
```bash
$ python usb.py &
```