Category menu

Digital Holga part 3 – taking photos with the inputs

This is my follow up to my previous posts about building a digital camera out of a Raspberry Pi Model A and a medium format Holga 120 film camera.

My aim being to build a hackable portable digital camera which hopefully would be able to capture images not possible with a normal digital camera, and to recapture the unpredictable spirit of film cameras (without the expense of the chemicals).

In my first post I fitted a Raspberry Pi model A and camera board into a hollowed out Holga 120. The Holga’s plastic construction makes it easy to work with and it’s roomy enough to accommodate a Pi without having to remove components from the board.

Pi camera case with Pi fitted

Here it’s sitting in it’s case. Snug.

In my second post I added the final inputs to the Holga case – a rotary selector switch with 3 positions, a push button switch on the side (with a trigger input on the bottom) and a power switch. I added a filter adapter to the front lens and I also took a few pictures by remotely triggering commands on the Pi.

Holga 120d Raspberry Pi Camera Case

Here’s the 3/4 view with the big clunky switch. It now switches the mode of the camera.

I’ve now connected up the switches and added 2 LEDs to the Raspberry Pi, making the Holga 120d a practical portable digital camera.

The rotary switch combined with the trigger switches effectively gives the Holga 120d 3 input buttons. The 2 LEDs (blue and orange) indicate the ‘mode’ the camera is in when I push the shutter button.

Each of the 3 ‘modes’ is programmable – at the moment I have 2 set up – one takes a photo which is saved to the Pi’s SD card, and the other performs a safe shutdown. It’s possible to add any command to the python script – and I’m working on an additional artistic mode which I’ll detail in a later blog.

I soldered all the inputs & the 2 LEDs to a Slice of Pi Breakout Board – these are available for around £5 and fit neatly over the Raspberry Pi without taking up too much space.

Raspberry Pi Holga 120d internals

Bit of a cram, but it all fits.

Holga 120d LED viewfinder

These light up to tell you the mode the camera is in.

From the board leading to the case, the green wires are to the push switch and trigger input, the 3 red wires & black to the right lead to the rotary switch and the red and black pairs lead to the LEDs.

The yellow wires just out of shot are to the flash hot-shoe. I did consider connecting this using an opto-isolator LED and there this space to do this at a later date.

There is also (just) about enough space to add a real time clock module – I used the Adafruit DS1307 Real Time Clock which connects to the 5v, GND, SDA and SQL pins on the slice of pi board. I followed Adafruit’s instructions (leave the resistors off the board!) and it works well.

The LEDs themselves slot into the viewfinder and light up according to the position of the switch. So in mode 1 the blue LED lights up, 2 both LEDs light and in 3 just the orange LED. This gives a bit of useful feedback to show that everything is working properly and the Pi is taking pictures when you click the shutter button.

For an easier to understand diagram – here’s the circuit laid out in Fritzing.

GPIO 23,24 & 25 are the inputs, with GPIO 17 and 18 driving the 2 LEDs. The switch at S2 is the rotary selector switch.

I used 330 ohm resistors for the LEDs and 10K resistors for the GPIO inputs.

Holga 120d wiring schema

Try on a breadboard first


The code I used is really simple.

Make sure you’ve run sudo apt-get update and have installed the Camera py modules first.

#!/usr/bin/env python

import time
import picamera

from time import sleep
import os
import RPi.GPIO as GPIO

GPIO.setup(23, GPIO.IN)
GPIO.setup(24, GPIO.IN)
GPIO.setup(25, GPIO.IN)
GPIO.setup(17, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)

while True:
        if ( GPIO.input(23) == False ):
                print('Orange: Taking photo')
                GPIO.output(17, True);
                date_string = time.strftime("%Y-%m-%d-%H:%M:%S")
                with picamera.PiCamera() as camera:
                        camera.capture('image' + date_string + '.jpg');
                GPIO.output(17, False);
        if ( GPIO.input(24) == False ):
                GPIO.output(18, True);
                os.system("sudo shutdown -h now")
        if (GPIO.input(25) == False):
                GPIO.output(17, True);
                GPIO.output(18, True);
                GPIO.output(17, False);
                GPIO.output(18, False);

In the code above, one of the settings takes a photo which is saved with a time / date stamp, the other safely shuts the Pi down, and the other is yet to be used.

The easiest way to get your photos off the Pi is to use Filezilla and to connect to your Pi using sFTP – this uses your SSH login and enables you to easily to download and delete photos.

For connecting to your Pi remotely see my previous post about finding your Pi on your network.

I’ve had lots of interesting feedback about the Holga 120d – with the Pi model A (and potentially a smaller model A+ in the works) there are lots of opportunities for adding a digital camera to an existing film camera.

Now i’ve got my Holga 120d up and running I’m going to do some experimenting – my aim being to capture images that you can’t recreate with Instagram. If you’ve got any creative ideas to share please leave them in the comments below!

, , , ,


  1. Digital Holga: part 2 putting it all together - October 26, 2014

    […] Update: I’ve added the inputs and 2 LED outputs to the GPIO on the Raspberry Pi – check out this post for more details, circuit diagrams and code. […]

  2. Take photographs and convert them to ASCII | Raspberry Pi Pod - November 15, 2014

    […] Taylor has extended his Holga camera project by using a script by Steven Kay to convert images into ASCII art. You can see Pete’s modified […]

Leave a Reply