Holga Front Open with all parts connected

I was struggling trying to get a USB capture device working with the Pi. Annoyed by those difficulties, I stumbled upon Kimondo's Digital Holga 119d project. I had a Raspberry Pi Model A and a camera module laying around, so I decided to build one myself. I started off with his ideas and went my own direction where I felt necessary.


Camera Modifications

Empty Holga case

The camera body needs to be modified to make room for the Raspberry Pi, battery, rotary switch and connector board. The plastic that holds the film in place will have to be removed and trimmed. The Raspberry Pi itself will take up most of the room in the case. Remove the film reel and film frame plastic. Cut down plastic tabs and remove foam until you have made as much space as possible.

In the front of the camera the lens and shutter switch are a separate square mechanism. Disassemble the shutter housing and remove shutter mechanism. Remove the plastic lens but put back the other parts that were holding the lens in place. These pieces give the Pi camera something to push up against and hide the camera board a bit.

In place of the shutter switch I used some prototyping board and a button to replace the mechanical switch. If you cut the prototyping board correctly it can stick in a slot that housed the old mechanism. Solder wire to the button and fish it through the square hole in the middle of the camera.

Camera Mounting

I mounted the camera by holding the Pi camera and marking holes for screws. I drilled four holes and mounted it in place against the remaining pieces of the old lens assembly. Make sure to feed the camera ribbon cable along side the button wires through middle square hole.

Power Supply Mounting

Power supply moutning

The top part of the case, above the film area where the see through lens is mounted, has a hollow area that perfectly fits a DC-DC buck converter board. Drill holes on either end of the hollow area where you can feed wires soldered to the converter board through and out into the main cavity of the camera. I added a DC power jack next to the DC-DC converter wired in such a way it will disconnect the battery and allow powering the board from an external source.

Raspberry Pi Modifications

Modified Raspberry Pi board

The Raspberry Pi itself requires extensive modifications to make it fit and powered efficiently. First some unneeded parts should be removed so the board fits in the case more easily. Remove the composite video jack and audio jack. I decided to run the Pi off 3.3V since this would make more efficient use of 3.7V lithium batteries than a boost converter would. Remove the 3.3V regulator and connect the 3.3V line to 5V line where regulator was according to these directions.

Rotary Switch

Rotary switch

Replacing the film advance knob with a rotary switch gives a way to select between different modes of operation. I bought a 2 pole 6 way switch that included the knob. It fits almost perfectly with some fussing. If you were to make the hole on the top of the camera larger, it would make the knob sit lower and less likely to fall off, however I have not done that yet.

I chose to use one of the poles to make the switch serve dual duty as a power switch. Since this is a make before break switch we can connect all but one of the ways for a pole together and then wire that inline with the power source. The 5 ways of the other pole are connected to the GPIO pins and its pole is connected to ground. When a position is select it pulls the GPIO pin to ground.

GPIO Breakout Board

Custom breakout PCB Custom breakout PCB

I created my own PCB to connect up everything to the GPIO board after initially starting with a hand wired prototype board. The board connects power to the 3.3V rail on pin 1 from the rotary switch. The 5 rotary switch connections and the shutter button are connected to GPIO pins through 10K pull up resistors. I also attached a buzzer to one of the GPIO lines for audible feedback. Furthermore, I added some pin headers to bring out the serial UART pins for easy connection to a serial converter board. I had plans to attach a real time clock but on my PCB I used the wrong footprint size for the DS3231 RTC I was going to use.

Wifi and SD Card Adapter

In order fit the Raspberry Pi board inside the camera case, it is very useful to obtain a low profile MicroSD card adapter. This eliminates the extra space a normal SD or adapter card would take.

Since we are running the board off 3.3V we need to use a WiFi adapter that will tolerate this voltage. I tried 3 adapters and it seems that those based on the RealTec 8188 Chipset will work. I tried both a Comfast adapter from eBay and an Etekcity adapter from Amazon and both worked. When I tested current consumption, the Comfast seemed to draw less power but operated at a slower speed.


I bought a pack of two replacement cell phone batteries for relatively cheap. They are small enough that the two will fit behind the Pi and still allow the case to close. I had to wire them in series because 3.7V was not enough to overcome the voltage drop of the wires and DC-DC converter. Using just one battery the Pi would reboot frequently when the voltage dropped through the regulator due to current demands. But two batteries in series has worked out fine so far. I soldered wires directly to the metal tabs on the batteries.

Software Steps

The following software instructions detail how I configured Raspbian to run my custom camera control and preview software. A Python script runs and monitors the GPIO pins. At position 1 the Pi the camera is not enabled. This allows the Pi to be on but have the camera off to save power. Switch positions 2-4 select default camera mode, low light mode and a video streaming mode. However, I never got the video streaming mode working successfully yet. Putting the switch in position 5 shuts down Linux gracefully. The script creates thumbnails from images as they are captured. It also sorts out images that are purely black, which can happen when you leave the lens cap on. It will give you a unique chirp through the buzzer to indicate you have just taken a blank picture.

I also wrote a small Flask application that runs under Ngnix. It presents a thumbnail gallery of pictures taken on the camera for previewing. You could review the images from your computer or mobile phone should you use WiFi sharing. You could set this up by modifying /etc/wpa_supplicant/wpa_supplicant.conf to connect to your phone's WiFi.

The following assumes you have installed Rasbpian and enabled the Raspberry Pi camera using raspi-config.

Bootup Changes

Switch to systemd to speed up boot, just doing this went from 25 to 14 seconds boot.

Fix serial console:

sudo systemctl start serial-getty@ttyAMA0.service
sudo ln -sf /lib/systemd/system/serial-getty@.service /etc/systemd/system/getty.target.wants//serial-getty@ttyAMA0.service

Disable unneeded services:

sudo update-rc.d lightdm disable
sudo update-rc.d triggerhappy disable

Disable sound modules by commenting out snd-bcm2835 in /etc/modules and by blacklisting others:

lsmod | grep ^snd | awk '{print "blacklist "$1}' | sudo sh -c 'cat > /etc/modprobe.d/snd-blacklist.conf`

Disable IPV6 by uncommenting “blacklist ipv6” in /etc/modprobe.d/ipv6.conf

Install rpi_holga software

Screenshot from camera software

Install software prerequisites:

apt-get install python-picamera imagemagick python-pip python-numpy python-imaging python-flask libffi-dev libjpeg8-dev

Install wiringPi and Python-WiringPi2 from Git source.

Install jpegtran-cffi:

pip install cffi jpegtran-cffi

Clone software:

git clone git@github.com:omwah/rpi_holga.git /home/pi/rpi_holga

Enable at boot up as soon as possible. Create /etc/systemd/system/holga-camera.service:

Description=Holga Camera Application
After=sysinit.target local-fs.target

ExecStart=/usr/bin/python /home/pi/rpi_holga/camera.py


Enable at startup:

sudo systemctl enable holga-camera.service

Webserver Setup

Install nginx to serve custom thumbnail software:

apt-get install nginx uwsgi uwsgi-plugin-python

Enable the site using the config included in the rpi_holga distribution:

rm /etc/nginx/sites-enabled/default
ln -s /home/pi/rpi_holga/preview/server/nginx_site /etc/nginx/sites-enabled/preview
ln -s /home/pi/rpi_holga/preview/server/uwsgi.ini /etc/uwsgi/apps-enabled/preview.ini

Create a thumbnail directory for the software and make it writable by nginx:

mkdir /home/pi/pictures/thumbnail
chgrp www-data /home/pi/pictures/thumbnail
chmod g+w /home/pi/pictures/thumbnail

Restart nginx and the preview software should be available at your camera's IP address.