Git Product home page Git Product logo

raspiasusbstickwithcloudsync's Introduction

RaspiAsUSBStickWithCloudSync

A Raspberry Pi Zero W is used as a USB Stick with integrated cloud syncronization. All files written to the USB drive are either copied to a Dropbox account or another linux server. Power is supplied by the USB port.

Overview pic

This project can be used in conjunction with a camera system which has the possibility to store the video files locally on a USB stick, but not in the cloud.

Each new video file is automatically uploaded to a free Dropbox account and can subsequently be viewed and replayed with the Dropbox app.

Some very basic linux skills are necessary. Should also work with a "Raspberry Pi Zero 2 W".

This project is open source software licensed via GNU General Public License v3.0, use at your own risk.

Quickstart

Basic process: Install a Raspberry Pi Zero W, adjust project config.json, copy project files to home directory of the Raspi and execute the setup script.

The Micro-SD card should have at least 16GB.

  1. Install Raspberry Pi OS Lite (32bit) from category Raspberry Pi OS (other) with the Raspberry Pi Imager. Take note whether it is a Debian Bullseye or Debian Bookworm image. pi imager
  • Settings (After NEXT)
    • Set Hostname: raspberrypi.local
    • Enable SSH with Password
    • Username: pi
    • Password: YOUR_PASSWORD
    • Setup your Wifi (important)
  1. Be patient on first setup boot, it might take several minutes on Raspi Zero.

  2. Download latest released RaspiAsUSBStickWithCloudSync.zip and extract files

  3. Update settings in configuration file config.json:

    Entry Description
    ActivateDropboxSync Activate (1) or deactivate (0) sync to dropbox
    Dropbox... Prepare and configure for Dropbox sync

    Click here for all possible settings.

  4. Copy all extracted and updated files from home_pi to /home/pi on the Raspberry Pi.

    For example use WinSCP:

    • File protocol: SFTP
    • Host name: raspberrypi.local
    • User name: pi
    • Password: YOUR_PASSWORD
  5. Login to Raspberry Pi with SSH. For example use Putty with Host name: raspberrypi.local and user: pi

    • For Debian Bullseye image type and execute command: bash /home/pi/execute_setup_bullseye.sh
    • For Debian Brookworm image type execute command: bash /home/pi/execute_setup_bookworm.sh

Note

The setup script downloads and installs necessary software components, configures driver modules as well as services and creates the USB drive image.

  1. Restart and you are all set. For a first test connect the pi with it's USB port to your PC and see whether the USB drive is accessible. Create a folder with some files and check whether it is auto uploaded to configured Dropbox or linux server.

    • Connect the USB cable to the USB port and not to the PWR port.
    • Make sure to have a data capable USB cable and not a cable which only support power via USB.
  2. Connect to system of your choice, for example camera system with video sync to USB.

View videos in dropbox mobile app:

dropbox app

Diagnose

Diagnose issues

More information

Detailed documentation

raspiasusbstickwithcloudsync's People

Contributors

koseng avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

mk386

raspiasusbstickwithcloudsync's Issues

Dropbox Uploading 0 Bytes

when file transfer start to storage it create a temp fodler on "transfer" but as soon as its done the folder dissapear and the file get updates with 0 bytes. If i transfer files to "transfer" then create folder manually example: /home/pi/transfer/1715941444/
and put the video file in there , it gets uploaded fine. How to fix ?

Everything is working just fine it seems

Everything looks like its running fine but never see the transfer from the transfer directory to my nas. I followed your tutorial to a T and am just wanting to see if you know why this would be happening?

when I check the logs for usb_copy... it shows the blink folders and sub folders even the .mp4 files, but then it sends to the transfer directory, then disappears.

InvalidAccessToken

I am getting the following error:

2024-07-29 14:21:01,066 [MainThread ] [INFO ] ----STARTED upload_new_files.py----
2024-07-29 14:21:01,073 [MainThread ] [INFO ] Configuration loaded.
2024-07-29 14:21:01,080 [MainThread ] [INFO ] START UPLOAD Path: /System Volume Information/IndexerVolumeGuid
2024-07-29 14:21:01,088 [MainThread ] [INFO ] Refreshing access token.
2024-07-29 14:21:02,932 [MainThread ] [ERROR] AuthError('4302cf9bf2d848aeb55dbebea22201ac', AuthError('invalid_access_token', None))
Traceback (most recent call last):
File "/home/pi/upload_new_files.py", line 82, in
transfer_to_dropbox(folder, config)
File "/home/pi/upload_new_files.py", line 59, in transfer_to_dropbox
file_metadata = dbx.files_upload(f.read(), destination_path, mode=WriteMode('overwrite'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/dropbox/base.py", line 3208, in files_upload
r = self.request(
^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/dropbox/dropbox_client.py", line 304, in request
self.check_and_refresh_access_token()
File "/usr/lib/python3/dist-packages/dropbox/dropbox_client.py", line 372, in check_and_refresh_access_token
self.refresh_access_token(scope=self._scope)
File "/usr/lib/python3/dist-packages/dropbox/dropbox_client.py", line 406, in refresh_access_token
self.raise_dropbox_error_for_resp(res)
File "/usr/lib/python3/dist-packages/dropbox/dropbox_client.py", line 628, in raise_dropbox_error_for_resp
raise AuthError(request_id, err)
dropbox.exceptions.AuthError: AuthError('4302cf9bf2d848aeb55dbebea22201ac', AuthError('invalid_access_token', None))

I created the App in Drobox as described in the ReadMe and placed the AppKey, AppSecret and RefreshToken to the config.json.
Is there anything I missed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.