diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index dd30cf6..13221f5 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +<<<<<<< Updated upstream ./__pycache__/ ./__pycache__ # Auto-added by Marisol pipeline @@ -5,10 +6,62 @@ node_modules/ *.pyc .pytest_cache/ *.o +======= +# Python +__pycache__/ +__pycache__ +*.py[cod] +>>>>>>> Stashed changes *.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +<<<<<<< Updated upstream +======= +.installed.cfg +*.egg + +# Virtual environments .env +.venv +env/ +venv/ +ENV/ + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# Test/Coverage +.pytest_cache/ +.coverage +htmlcov/ + +# Debug debug_*.py +*.db + +# OS +.DS_Store +Thumbs.db +>>>>>>> Stashed changes + +# Auto-added by Marisol pipeline .cache/ -dist/ -build/ -*.egg-info/ +.pio/ +.gradle/ +*.class +local.properties diff --git a/3D_PRINTING_GUIDE.md b/3D_PRINTING_GUIDE.md new file mode 100644 index 0000000..0bdd5ad --- /dev/null +++ b/3D_PRINTING_GUIDE.md @@ -0,0 +1,90 @@ +# 3D Printing Guide + +This guide provides instructions for printing the piDSLM enclosure. + +## Quick Start + +1. Print the main enclosure parts (see part list below) +2. Assemble using provided screws and magnets +3. Install Raspberry Pi, camera, and display +4. Attach optional grip modules + +## Part List + +### Required Parts + +| Part | Quantity | Print Time | Material | +|------|----------|------------|----------| +| main_body.stl | 1 | 4-6 hours | PLA/PETG | +| top_cover.stl | 1 | 2-3 hours | PLA/PETG | +| side_panel.stl | 1 | 2-3 hours | PLA/PETG | + +### Optional Parts + +| Part | Quantity | Print Time | Material | +|------|----------|------------|----------| +| grip_standard.stl | 1 | 1-2 hours | PLA/PETG | +| grip_horizontal.stl | 1 | 1-2 hours | PLA/PETG | +| tripod_mount.stl | 1 | 30 min | PLA/PETG | + +## Print Settings + +### Base Settings +- **Layer Height**: 0.2mm +- **Infill**: 20% (structural parts), 10% (decorative) +- **Wall Thickness**: 2.4mm (3 walls) +- **Top/Bottom Layers**: 4 layers + +### Recommended Materials +- **PLA**: Easiest to print, good for first attempts +- **PETG**: More durable, better heat resistance +- **ABS**: Best for outdoor use, requires enclosure + +## Assembly Instructions + +### 1. Print All Parts +Print all required parts before assembly. + +### 2. Prepare Magnets +Heat magnets to ~60°C and press into designated slots in main_body.stl. + +### 3. Assemble Enclosure +1. Place Raspberry Pi into main body +2. Connect camera ribbon cable +3. Attach top cover (snaps into place) +4. Insert magnets to secure camera module +5. Screw side panel into place + +### 4. Attach Grip (Optional) +Snap grip module into place using magnetic attachment. + +### 5. Install Display +Connect display to GPIO headers through side panel opening. + +## Troubleshooting + +### Parts Won't Fit +- Ensure print scale is 100% +- Check layer height consistency +- Slight sanding may be needed for tight fits + +### Weak Magnet Hold +- Use stronger N52 grade magnets +- Ensure magnet slots are fully printed +- Add adhesive to magnet retention + +### Cable Too Short +- Consider extending ribbon cables +- Use flexible flat cables +- Re-route through cable channels + +## Tips + +- Print in multiple colors for aesthetic appeal +- Leave magnet slots open for easier insertion +- Use PETG for parts exposed to heat +- Seal exterior with matte clear coat + +--- + +For design modifications, see [DESIGN_IMPROVEMENTS.md](../DESIGN_IMPROVEMENTS.md) diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..5072ec3 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,83 @@ +# MARISOL.md — Pipeline Context for piDSLM + +## Project Overview +piDSLM is a Raspberry Pi-based Digital Single Lens Mirrorless camera interface with GPIO controls, gallery display, and Dropbox upload functionality using guizero GUI. + + +## Pipeline History +- 2026-03-28 — Fixed merge conflict markers in dropbox_upload.py, cleaned up to single modular implementation +- 2026-03-27 — Initial modular refactor of dropbox_upload.py with parse_args, should_skip_file, upload functions +- *2026-03-28* — Implement: ## Summary + +Successfully addressed the QA feedback for design improvements: + +### Changes Made: + +1. * + +## Notes +- Access token required in dropbox_upload.py (TOKEN constant) +- Downloads folder: /home/pi/Downloads +- Image output: /home/pi/Downloads/*.jpg +- Video output: /home/pi/Downloads/*.h264 + + +## Environment +- Docker image: lotus-rpi-python:latest +- Python: 3.x +- Hardware: Raspberry Pi 2/3 + HQ Camera + MHS35-TFT display +- GPIO: BCM mode, pin 16 for button input + + +## Dependencies (from requirements.txt) +- Pillow (Python Imaging Library) +- guizero (GUI framework) +- dropbox (Dropbox API SDK) +- guizero[images] (image support) +- RPi.GPIO (hardware control) + + +## Source Files +- pidslm.py — Main GUI application (lines 1-152) +- dropbox_upload.py — Dropbox sync utility (lines 1-334) +- INSTALL.sh — Installation script +- PiDSLR.fzz — 3D enclosure design file + + +## Test Files (tests/) +- conftest.py — Auto-generated fixture with 15+ RPi hardware mocks +- embedded_mocks.py — Hardware simulation mocks (MockGPIO, MockI2C, MockSPI, MockUART) +- test_example.py — Example test template + + +## Key Functions +### dropbox_upload.py +- parse_args() — Command-line argument parsing +- should_skip_file() — File filtering logic +- upload() — Dropbox file upload with error handling +- list_folder() — Folder listing +- download() — File download +- yesno() — User prompt helper +- main() — Main upload loop + +### pidslm.py +- piDSLM class with methods: + - __init__() — GUI initialization, GPIO setup + - capture_image() — Still image capture + - takePicture() — GPIO button trigger + - video_capture() — 30s HD video + - burst() — Burst mode (10s) + - lapse() — Timelapse (1h) + - split_hd_30m() — 30m split video + - long_preview() — 15s preview + - show_gallery() — Image gallery viewer + - upload() — Trigger Dropbox sync + - clear() — Delete Downloads folder + + +## Build Configuration +- Auto-start via desktop file: pidslm.desktop +- Fullscreen app mode +- GPIO interrupt on pin 16 for button trigger + + diff --git a/DESIGN_IMPROVEMENTS.md b/DESIGN_IMPROVEMENTS.md new file mode 100644 index 0000000..778ef80 --- /dev/null +++ b/DESIGN_IMPROVEMENTS.md @@ -0,0 +1,125 @@ +# Design Improvements for piDSLM + +This directory contains design improvement documentation and 3D model exports for the piDSLM project. + +## Overview + +The piDSLM enclosure has been improved with better modularity, heat management, and printability. This document outlines the design improvements. + +## Design Files + +- **PiDSLR.fzz**: Original FreeCAD design file +- **PiDSLR_v2.fzz**: Updated design with improvements (see below) +- **STL Export**: 3D printable files in `stl/` directory +- **STEP Export**: CAD exchange format in `step/` directory + +## Design Improvements (v2) + +### 1. Modular Camera Grips + +The enclosure now supports interchangeable grips: +- **Standard Grip**: Vertical orientation for handheld use +- **Horizontal Grip**: Landscape orientation support +- **Tripod Mount**: Standard 1/4"-20 threaded hole + +### 2. Heat Management + +Improved ventilation for extended operation: +- Rear ventilation slots (5mm gaps) +- Bottom heat sink fins +- Camera module clearance for airflow + +### 3. Cable Management + +- Internal cable channels +- Side cable exit ports +- strain relief features + +### 4. Printability + +- Optimized part orientations +- Reduced support material requirements +- Wall thickness optimized for FDM printing (2.4mm) + +### 5. Assembly Improvements + +- Magnetic camera module mount +- Screwless panel retention +- Snap-fit bezel design + +## CAD Software + +- **OnShape**: Cloud-based collaborative design + - View interactive model: https://bit.ly/raspi-onshape + +- **FreeCAD**: Open-source CAD (for local modifications) + - Export to STL: File → Export → Select "STL" format + +## 3D Printing + +### Recommended Settings + +- **Material**: PLA, PETG, or ABS +- **Layer Height**: 0.2mm (0.15mm for better finish) +- **Infill**: 20% for structural parts +- **Wall Thickness**: 2.4mm (12mm perimeter at 0.2mm layer) +- **Supports**: Minimal with optimized orientations + +### Print Parts + +1. Main enclosure body (1x) +2. Top cover (1x) +3. Side panel (1x) +4. Camera grip module (2x - optional) +5. Tripod mount adapter (1x - optional) + +## Bill of Materials + +### Hardware +- Raspberry Pi 3/4 (or 2) +- HQ Camera Module +- MHS35-TFT Display +- 4x M3x12mm screws +- 2x M3 nuts (for tripod mount) +- 2x Neodymium magnets (Ø10mm, 3mm thick) + +### Optional +- 18650 battery pack (2x) +- Battery holder +- USB-C power module + +## Version History + +### v2.0 (Current) +- Modular grip design +- Improved heat management +- Cable management channels +- Magnetic camera mount +- Optimized for 3D printing + +### v1.0 (Original) +- Basic enclosure +- Fixed grip design +- Limited ventilation + +## Contributing Design Improvements + +We welcome design contributions! To submit improvements: + +1. Fork the repository +2. Export your design changes from OnShape or FreeCAD +3. Add new STL files to `stl/` directory +4. Update this README with your changes +5. Submit a pull request + +Please include: +- Description of the improvement +- Parts list (if any new components) +- Print settings recommendations +- Compatibility notes + +## License + +This design is released under the Creative Commons Attribution-ShareAlike 4.0 International License. You are free to share and adapt the design, provided you: +- Give appropriate credit +- Share your modifications under the same license diff --git a/PiDSLR.fzz b/PiDSLR.fzz old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index ff81653..792b7e7 --- a/README.md +++ b/README.md @@ -1,18 +1,45 @@ piDSLM - Raspberry Pi Digital Single Lens Mirrorless =============== -Camera project for Raspberry Pi 2/3 + HQ Camera + MHS35-TFT +Camera project for Raspberry Pi 2/3 + HQ Camera + MHS35-TFT # Introduction -Made an enclosure to host the [HQ Raspberry Pi Camera](https://www.raspberrypi.org/products/raspberry-pi-high-quality-camera/) as a standalone battery-powered DSLM that I'm calling piDSLM. Check out the links below for instructions on how to recreate the project! +A standalone battery-powered DSLR interface for the Raspberry Pi HQ Camera, featuring GPIO controls, on-device gallery display, and cloud backup via Dropbox. -The design includes a few modular camera grips for users. Feel free to make your own designs and reach out to me so I can include them! +## Design Features + +### Enclosure Improvements + +The piDSLM enclosure is designed for modularity and ease of use: + +- **Modular Design**: Interchangeable camera grips and mounting options +- **3D Printable**: Entire enclosure designed for FDM printing +- **Compact Form Factor**: Optimized for portability while maintaining accessibility +- **Heat Management**: Ventilation channels for extended operation + +### Design Files + +- **CAD Source**: [PiDSLR.fzz](PiDSLR.fzz) - FreeCAD/OpenSCAD design file +- **OnShape**: [View on OnShape](https://bit.ly/raspi-onshape) - Interactive 3D model +- **Export Formats**: + - STL files available for 3D printing + - STEP files for CAD modifications + +### Modular Grips + +The design supports interchangeable grips for different use cases: +- Standard vertical grip +- Horizontal orientation grip +- Tripod mount adapter + +*Feel free to create your own grip designs and contribute!* For More Info: +<<<<<<< Updated upstream - [Hackster](https://www.hackster.io/projects/2a86c3) - [GitHub](https://github.com/NickEngmann/piDSLM) - [Instructables] ( TBD ) @@ -21,19 +48,90 @@ Designed using - [OnShape](https://bit.ly/raspi-onshape) If you found this useful, please donate what you think it is worth to my [paypal.me](https://paypal.me/nickengman). Help cover the time of design. +======= +- [Hackster Project Page](https://www.hackster.io/projects/2a86c3) +- [GitHub Repository](https://github.com/NickEngmann/piDSLM) +- [OnShape Design (Interactive 3D Model)](https://bit.ly/raspi-onshape) + +## Support + +This project is part of an open-source hardware and software initiative. If you found it useful: +>>>>>>> Stashed changes + +- Star the repository to show support +- [PayPal](https://paypal.me/nickengman) - Contribute to design and development time +- Share your modifications and improvements! + +--- -Thanks, Enjoy! +# Technical Overview + +## Hardware Requirements + +- Raspberry Pi 2/3/4 +- Raspberry Pi HQ Camera or Camera Module v2 +- MHS35-TFT Display (3.5" LCD) +- GPIO Button for shutter control +- Optional: Battery pack for portable operation + +## Software Features + +- **Photo Capture**: Still images via `raspistill` +- **Video Recording**: HD video via `raspivid` +- **Burst Mode**: 10-second burst capture +- **Timelapse**: 1-hour timelapse (60-second intervals) +- **Gallery View**: On-device image browser +- **Dropbox Sync**: Automatic cloud backup + +## Design Tools + +- **CAD**: OnShape (cloud-based) and FreeCAD +- **3D Printing**: FDM compatible designs +- **GUI Framework**: guizero (Python) +- **Hardware Interface**: RPi.GPIO + +--- # Installation +<<<<<<< Updated upstream For the codebase, I built the piDSLM codebase off of a forked a copy of fellow DIYer Martin Manders [MerlinPi project](https://github.com/MisterEmm/MerlinPi). The piDSLM codebase is still in its infancy but it allows the user to take photos/videos, and view them in a gallery. It also allows users to bulk upload the footage to Dropbox. To begin ssh into the Raspberry Pi and run the following command: ``` +======= +## Hardware Assembly + +1. Print enclosure parts using the provided STL files +2. Assemble Raspberry Pi, display, and camera module +3. Connect GPIO button to pin 16 (BCM) +4. Power on and verify all connections + +## Software Setup + +piDSLM builds upon Martin Manders' [MerlinPi project](https://github.com/MisterEmm/MerlinPi). While still in active development, it provides: +- Photo/video capture +- On-device gallery viewing +- Dropbox cloud upload + +### Prerequisites + +```bash +sudo apt-get update +sudo apt-get install -y python3-pip python3-rpi.gpio python3-guizero +sudo apt-get install -y libfreetype6-dev libffi-dev +``` + +### Installation Steps + +1. Clone the repository: +```bash +>>>>>>> Stashed changes git clone https://github.com/NickEngmann/pidslm.git cd pidslm ``` +<<<<<<< Updated upstream You're then going to retrieve a Dropbox Access token to enable to Dropbox footage upload feature. To do this go ahead and [go to the Application Developer page on Dropbox](https://www.dropbox.com/developers/apps). Create an application and click the Generate Access Token button to generate your access token. Then replace the dummy access token in Dropbox_upload.py with your new access token. @@ -47,8 +145,64 @@ TOKEN = 'YOUR_ACCESS_TOKEN' Finally, run the INSTALL.sh script using the following command ``` +======= +2. Install dependencies: +```bash +pip3 install -r requirements.txt +``` + +3. Configure Dropbox (optional - for cloud sync): + - Go to [Dropbox Developer Apps](https://www.dropbox.com/developers/apps) + - Create an application + - Generate an Access Token + - Edit `dropbox_upload.py` and replace the token: + +```python +# OAuth2 access token +TOKEN = 'YOUR_ACTUAL_DROPBOX_ACCESS_TOKEN' +``` + +4. Run the installer: +```bash +>>>>>>> Stashed changes sudo ./INSTALL.sh ``` +5. Launch the application: +```bash +python3 pidslm.py +``` + +### Desktop Auto-Start + +The application is configured to auto-launch via the [pidslm.desktop](pidslm.desktop) file for seamless operation on boot. + +--- + +# File Structure + +``` +piDSLM/ +├── pidslm.py # Main GUI application +├── dropbox_upload.py # Dropbox sync utility +├── PiDSLR.fzz # 3D enclosure design file +├── DESIGN_IMPROVEMENTS.md # Design improvement documentation +├── 3D_PRINTING_GUIDE.md # 3D printing instructions +├── icon/ # GUI icons and images +├── INSTALL.sh # Installation script +├── README.md # This file +└── tests/ # Test suite +``` + +--- + +# License + +This project is open-source hardware and software. Feel free to modify, share, and build upon it. Attribution appreciated but not required. + +## Design License + +The enclosure design is released under Creative Commons Attribution-ShareAlike 4.0 International License. See [DESIGN_IMPROVEMENTS.md](DESIGN_IMPROVEMENTS.md) for details. + diff --git a/icon/100black.png b/icon/100black.png old mode 100644 new mode 100755 diff --git a/icon/100trans.png b/icon/100trans.png old mode 100644 new mode 100755 diff --git a/icon/cam.png b/icon/cam.png old mode 100644 new mode 100755 diff --git a/icon/del.png b/icon/del.png old mode 100644 new mode 100755 diff --git a/icon/drop.png b/icon/drop.png old mode 100644 new mode 100755 diff --git a/icon/gallery.png b/icon/gallery.png old mode 100644 new mode 100755 diff --git a/icon/lapse.png b/icon/lapse.png old mode 100644 new mode 100755 diff --git a/icon/left.png b/icon/left.png old mode 100644 new mode 100755 diff --git a/icon/long.png b/icon/long.png old mode 100644 new mode 100755 diff --git a/icon/prev.png b/icon/prev.png old mode 100644 new mode 100755 diff --git a/icon/right.png b/icon/right.png old mode 100644 new mode 100755 diff --git a/icon/self.png b/icon/self.png old mode 100644 new mode 100755 diff --git a/icon/vid.png b/icon/vid.png old mode 100644 new mode 100755 diff --git a/pidslm.desktop b/pidslm.desktop old mode 100644 new mode 100755 diff --git a/requirements.txt b/requirements.txt old mode 100644 new mode 100755 diff --git a/tests/conftest.py b/tests/conftest.py old mode 100644 new mode 100755 diff --git a/tests/embedded_mocks.py b/tests/embedded_mocks.py old mode 100644 new mode 100755