{"id":18572161,"url":"https://github.com/nicokaiser/rpi-camera-import","last_synced_at":"2025-04-10T07:31:05.388Z","repository":{"id":51230648,"uuid":"121172147","full_name":"nicokaiser/rpi-camera-import","owner":"nicokaiser","description":"Raspberry Pi Camera Import","archived":false,"fork":false,"pushed_at":"2023-08-09T06:13:11.000Z","size":143,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-08-09T07:42:50.860Z","etag":null,"topics":["ansible","digital-camera","gphoto2","import","libgphoto2","ptp","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicokaiser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-11T22:08:02.000Z","updated_at":"2023-07-03T07:23:59.000Z","dependencies_parsed_at":"2022-09-13T19:03:20.099Z","dependency_job_id":null,"html_url":"https://github.com/nicokaiser/rpi-camera-import","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicokaiser%2Frpi-camera-import","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicokaiser%2Frpi-camera-import/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicokaiser%2Frpi-camera-import/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicokaiser%2Frpi-camera-import/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicokaiser","download_url":"https://codeload.github.com/nicokaiser/rpi-camera-import/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223430305,"owners_count":17143624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","digital-camera","gphoto2","import","libgphoto2","ptp","raspberry-pi"],"created_at":"2024-11-06T23:05:11.837Z","updated_at":"2025-04-10T07:31:05.377Z","avatar_url":"https://github.com/nicokaiser.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry Pi Camera Import\n\nThese instructions transform a Raspberry Pi to an automatic headless photo import device for digital cameras and SD card readers.\n\n![Raspberry Pi Camera Import](preview.jpg)\n\n## Features\n\nWhen a digital camera or and SD card reader is plugged in the USB port, all new photos are copied to the Pi's SD card automatically. Use a reasonably large SD card and build a headless photo backup device.\n\nThe files are ordered by file date (usually the capture date):\n\n`/mnt/pictures/2018-02-13/DSC01234.arw`\n\nThis way, the risk of duplicates is reduced (see \"Limitations\").\n\n## Requirements\n\n- Raspberry Pi with a free USB port\n- Raspberry Pi OS 12 Lite (tested with version 2024-11-19)\n- USB SD card reader or digital camera with USB mass storage support\n- Optional: Piromoni Blinkt! for graphical status display\n\n## Installation\n\nInstall a new Raspberry Pi OS image on the device and make sure it is connected to the network. The new device is assumed to be reachable by `camera-import.local`.\n\n### Remove unused packages and daemons\n\n```sh\n# Disable Bluetooth and Audio\nsudo systemctl disable bluetooth hciuart\necho \"gpu_mem=16\" \u003e\u003e /boot/firmware/config.txt\necho \"dtparam=audio=off\" \u003e\u003e /boot/firmware/config.txt\necho \"dtparam=disable-bt\" \u003e\u003e /boot/firmware/config.txt\n\n# Disable swap\nsudo dphys-swapfile swapoff\nsudo dphys-swapfile uninstall\nsudo systemctl disable dphys-swapfile\n\n# Remove unused packages\nsudo apt purge -y triggerhappy build-essential gcc-12 mkvtoolnix libc6-dev firmware-libertas firmware-atheros bluez gdb libc6-dbg manpages-dev dpkg-dev userconf-pi man-db rpicam-apps-lite\n\n# Disable apt timers\nsudo systemctl stop apt-daily.timer apt-daily-upgrade.timer\nsudo systemctl disable apt-daily.timer apt-daily-upgrade.timer\nsudo systemctl mask apt-daily.service apt-daily-upgrade.service\nsudo systemctl daemon-reload\n\nsudo apt autoremove --purge -y\n```\n\n### Install scripts and services\n\n```sh\n# Install packages\nsudo apt install -y --no-install-recommends exfat-fuse python3-blinkt python3-psutil overlayroot\n\n# Fix python3-blinkt timing, see https://github.com/pimoroni/blinkt/pull/73 \nsudo sed -i.backup 's/time.sleep(0.0000005)/time.sleep(0)/g' /usr/lib/python3/dist-packages/blinkt.py\n\n# Install files\nsudo install -m 0755 rootfs/usr/local/bin/blinkt-clear /usr/local/bin/\nsudo install -m 0755 rootfs/usr/local/bin/blinkt-disk-usage /usr/local/bin/\nsudo install -m 0755 rootfs/usr/local/bin/camera-import-msd /usr/local/bin/\nsudo install -m 0644 rootfs/etc/systemd/system/blinkt-clear.service /etc/systemd/system/\nsudo install -m 0644 rootfs/etc/systemd/system/blinkt-disk-usage.service /etc/systemd/system/\nsudo install -m 0644 rootfs/etc/systemd/system/camera-import-msd@.service /etc/systemd/system/\nsudo install -m 0644 rootfs/etc/udev/rules.d/99-camera-import-msd.rules /etc/udev/rules.d/\n\nsudo systemctl enable blinkt-disk-usage.service\nsudo systemctl enable blinkt-clear.service\n\n# Announce SSH service via Bonjour\nsudo cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/ssh.service\n\n# Clean up apt\nsudo apt clean\nsudo rm -rf /var/lib/apt/lists\n```\n\n### Create a \"pictures\" partition\n\nUse another device and gparted to resize the root partition to 2 GB and create a large partition called \"pictures\". Then reboot and add the mount point:\n\n```sh\nsudo mkfs.ext4 -L pictures /dev/mmcblk0p3\nprintf \"LABEL=pictures\\t/mnt/pictures\\text4\\tdefaults,noatime,ro\\t0\\t2\\n\" | sudo tee -a /etc/fstab \u003e /dev/null\nsudo mkdir /mnt/pictures\nsudo mount /mnt/pictures\n```\n\n### Enable overlay filesystem\n\n- Using `raspi-config`, enable \"Overlay File System\".\n- Change \"overlayroot=tmpfs\" to \"overlayroot=tmpfs:recurse=0\" in `/boot/firmware/cmdline.txt`\n\nThis allows the device to be switched off after transferring photos, without needing to properly shut down. The \"pictures\" partition is mounted read-write only during transfer, to minimize the risk of data loss if the device is switched off without being shut down.\n\n## Limitations\n\n- Only works with cameras that support USB mass storage mode.\n- An older version had support for PTP through gphoto2, this may or may not work correctly.\n- There could theoretically be filename duplicates. That usually is, when more than 10.000 photos are taken on the same day, or when backing up multiple cameras.\n- When using an USB card reader, you may need to unplug and replug the card reader when changing cards.\n\n## Optional Components\n\n### Pimoroni Blinkt!\n\n[Blinkt!](https://github.com/pimoroni/blinkt) is a pHAT stacking header for Raspberry Pi with 8 RGB LEDs. If it is installed, it is used for a simple status display:\n\n- When idle, disk usage is displayed with red/green LEDs\n- While copying, the progress is displayed [see video](https://www.youtube.com/watch?v=rcr646JgzJ4).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicokaiser%2Frpi-camera-import","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicokaiser%2Frpi-camera-import","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicokaiser%2Frpi-camera-import/lists"}