Digitizing an Agfa Box Camera with a Raspberry Pi NoIR
Channel: joystickmusic
Date: 2019-11-12

I Built a digital camera into a 65 year old camera, and I use the actual shutter release of that camera to take the picture. The switch at the shutter was for the flash bulbs. 

It runs Apache2 as a webserver and logs on to either my home wifi.

The sensor has No IR filter. Since colors are off if there isn't an IR/UV filter in place, I let it only record the Y channel (black and white). The color channels U+V are replaced with integers, that made the image sepia. That fits the housing this camera is in.

My camera has two compartments, one on the front that contains the viewfinders and the shutter, and one big one that used to contain the frame that is the film holder and hold the optics. In the divider between these, I drilled two holes. In one, I put a screw to act as a ground connection. The other is to run some wires trough.

Install, upgrade, and update Raspbian. Then install Apache2. 

Then make a file called camera.sh on the desktop, make it executable and add it to cron. Below is the complete code. It is bash nested in python nested in a bash script. The camera is called using bash, as it was easier to yell the right orders at the camera that way.

You can find the camera's output on http://raspberry.local

Get the camera to run in the best quality

There are a delays between opening the shutter and taking the image (time.sleep(0.02) and -t 135). The first delay takes into account that the old camera shutter trips the flash before the shutter is fully open. The second delay is 2 or 3 frames. You see, the Pi cam is not a photo camera, it's is a video camera that is always on. It tunes itself to darkness. When the shutter opens, it needs to settle down on the new light intensity. You get a lot less noise when you do not grab the first frame after you open the stream, but the third or forth! Hence the -t 135 option. Each frame takes 66.6 msecs. 

Explanation of the camera code:

I spend time to tune the code for the Pi NoIR V1 (clone).
raspistill: This is the camera app of the pi
-o /var/www/html/AgfaBox-%03d.jpg -dt: open this file, add a date code
-mm average: Averages the brightness of the frame to choose the shutter time
-drc med: This enlarges the dynamic range of the sensor.
-t 135: This is de delay to let the camera adjust and reduce noise.
-cfx 124:136: B&W image. 128:128 makes it proper black and white, no toning. Removing this produces a color image.
-ISO 200 -ag 2: Optimum ISO and analog gain for the V1 camera. Sensitive, but not too noisy!
Other variables were tested, but gave no advantage for me.


The code

https://pastebin.com/tpDt0Xvf