Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ debug_*.py
dist/
build/
*.egg-info/

# Auto-added by Marisol pipeline
.pio/
.gradle/
*.class
local.properties
Empty file modified PiDSLR.fzz
100644 → 100755
Empty file.
219 changes: 191 additions & 28 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,54 +1,217 @@
piDSLM - Raspberry Pi Digital Single Lens Mirrorless
===============
# piDSLM - Raspberry Pi Digital Single Lens Mirrorless

Camera project for Raspberry Pi 2/3 + HQ Camera + MHS35-TFT
![piDSLM Interface](https://i.imgur.com/VspFA5V.jpg)

<img src="https://i.imgur.com/VspFA5V.jpg" data-canonical-src="https://i.imgur.com/VspFA5V.jpg" width="400" height="400" />
A standalone battery-powered DSLM camera interface for Raspberry Pi 2/3 with HQ Camera and MHS35-TFT display.

# Introduction
## Features

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!
- **Photo Capture**: Take high-quality photos using the Raspberry Pi HQ Camera
- **Video Recording**: Record HD video (30s clips) or split 30-minute sessions
- **Timelapse**: Capture timelapse photos with 60-second intervals over 1 hour
- **Burst Mode**: Capture rapid sequential photos (up to 10,000ms)
- **Gallery View**: Browse captured photos with left/right navigation
- **Long Preview**: 15-second preview mode
- **Dropbox Upload**: Bulk upload footage to Dropbox cloud storage
- **GPIO Control**: Button-activated photo capture with pin 16
- **Clear Function**: Delete all files from Downloads folder

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!

For More Info:
## Project Links

- [Hackster](https://www.hackster.io/projects/2a86c3)
- [GitHub](https://github.com/NickEngmann/piDSLM)
- [Instructables] ( TBD )
- [OnShape Design](https://bit.ly/raspi-onshape)

The enclosure design is modulare—feel free to make your own designs and reach out to include them!

## Installation

### Prerequisites

- Raspberry Pi 2 or 3 (Pi 4 may work with modifications)
- Raspberry Pi HQ Camera
- MHS35-TFT Display (3.5" HDMI LCD)
- Battery pack for portable operation

### Setup

1. Clone the repository and navigate to the directory:
```bash
git clone https://github.com/NickEngmann/piDSLM.git
cd pidslm
```

2. **Configure Dropbox Access Token**:
- Go to the [Dropbox Developers page](https://www.dropbox.com/developers/apps)
- Create a new application
- Generate an Access Token
- Edit `dropbox_upload.py` and replace the placeholder token:
```python
TOKEN = 'YOUR_ACCESS_TOKEN' # Replace with your token
```

3. **Run the Installation Script**:
```bash
sudo ./INSTALL.sh
```
This will:
- Install Python dependencies (Pillow, guizero, dropbox SDK)
- Set up auto-start configuration
- Configure camera settings in `/boot/config.txt`
- Reboot the system

### Manual Installation

If you prefer manual setup:

```bash
# Install dependencies
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install --upgrade Pillow

# Set up auto-start (optional)
sudo mkdir -p /home/pi/.config/autostart
sudo cp pidslm.desktop /home/pi/.config/autostart/

# Configure camera (if needed)
sudo nano /boot/config.txt
# Add: start_x=1 and gpu_mem=128
```

Designed using
- [OnShape](https://bit.ly/raspi-onshape)
## Usage

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.
### Starting the Application

Thanks, Enjoy!
Run the main application:
```bash
python3 pidslm.py
```

# Installation
The application starts in fullscreen mode with the following controls:

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:
| Button | Function |
|--------|----------|
| **Focus** | 15-second preview mode |
| **Gallery** | Browse captured photos |
| **HD 30s** | Record 30-second video |
| **Burst** | Capture up to 10,000ms of rapid photos |
| **1h 60pix** | Timelapse: 1 hour, 60-second intervals |
| **HD 30m** | Split 30-minute video into 5-second segments |
| **Upload** | Bulk upload to Dropbox |
| **Clear** | Delete all files from Downloads |

```
### GPIO Button Capture

git clone https://github.com/NickEngmann/pidslm.git
cd pidslm
```
The application monitors GPIO pin 16. Pressing the connected button will:
- Trigger a photo capture (3.5-second exposure)
- Save to `/home/pi/Downloads/` with timestamp filename

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.
### Dropbox Upload

Then replace the dummy access token in Dropbox_upload.py with your new access token.
When you click the **Upload** button:
1. The app creates a busy indicator
2. `dropbox_upload.py` runs in background
3. Files in `/home/pi/Downloads/` are uploaded to Dropbox
4. Dot files, temp files, and generated files are automatically skipped

```
### Gallery Navigation

# OAuth2 access token. TODO: login etc.
TOKEN = 'YOUR_ACCESS_TOKEN'
```
In gallery mode:
- Use left/right arrow buttons to navigate photos
- Thumbnails show captured `.jpg` files from Downloads folder
- Press Escape or close window to return to main menu

Finally, run the INSTALL.sh script using the following command
## File Structure

```
sudo ./INSTALL.sh
piDSLM/
├── pidslm.py # Main GUI application
├── dropbox_upload.py # Dropbox sync utility
├── INSTALL.sh # Installation script
├── pidslm.desktop # Auto-start configuration
├── PiDSLR.fzz # 3D enclosure design (Fusion 360)
├── icon/ # UI icons (14 images)
└── tests/ # Test suite
├── test_example.py # Example tests
├── conftest.py # Test configuration with mocks
└── embedded_mocks.py # Hardware simulation mocks
```

## Testing

The project includes a test suite with hardware mocking:

```bash
pytest tests/ -v
```

### Test Infrastructure

- **RPi.GPIO mocked**: Simulates GPIO pin control
- **I2C/SPI/UART mocked**: Hardware communication simulation
- **guizero mocked**: GUI framework simulation
- **Source loading**: Custom fixture loads and tests actual source files

### Running Tests

Tests run successfully in both hardware and mocked environments. The mock system provides 15+ hardware module simulations for safe testing.

## Dependencies

- **Python 3.12+**
- **Pillow**: Image processing
- **guizero**: GUI framework
- **dropbox**: Dropbox API v2 SDK
- **RPi.GPIO**: Hardware control (production only)
- **raspistill/raspivid**: Camera utilities (production only)

## Troubleshooting

### Camera not working

1. Check `/boot/config.txt` has `start_x=1` and `gpu_mem=128`
2. Verify camera is connected to CSI port 0
3. Run `vcgencmd get_camera` to check detection

### GPIO button not responding

1. Verify pin 16 wiring (BCM numbering)
2. Check for button bounce issues (currently set to 2500ms)
3. Ensure RPi.GPIO is not being used elsewhere

### Dropbox upload fails

1. Verify TOKEN is set in `dropbox_upload.py`
2. Check internet connection
3. Review Dropbox app permissions

### Gallery not showing photos

1. Ensure photos are saved to `/home/pi/Downloads/`
2. Check file permissions on Downloads directory
3. Verify photo format is `.jpg`

## Design Notes

The piDSLM project is built as a fork of the [MerlinPi project](https://github.com/MisterEmm/MerlinPi) by Martin Manders. Key differences:

- Custom enclosure design (3D printable)
- MHS35-TFT display integration
- Enhanced GUI layout
- Bulk Dropbox upload feature
- GPIO button capture support

## License

This project is built on the MerlinPi foundation. Please respect the original project license and any third-party dependencies.

## Support

If you found this project useful, consider supporting the design work through [PayPal](https://paypal.me/nickengman).

For questions or contributions, please reach out via the [GitHub repository](https://github.com/NickEngmann/piDSLM).

---

*Designed for Raspberry Pi enthusiasts and DIY camera projects.*
Loading