LOMO Lubitel 166B Digital Camera – Page 1

See Page 2 for software and features

Some history

Many years ago I was a very keen photographer. This was back in the 1980s. My main camera was a Practica 35mm SLR, with screw mount lenses, fully manual, but with a built in light meter and a tell tale in the view finder to help with exposure. Its standard lens was a Pentacon 50mm, a magnificent quality lens in its day. It was cheap and cheerful, at a time when Olympus, Canon and Nikon were starting to produce sophisticated, expensive auto exposure cameras. I loved my Practica and built up a collection of lenses and accessories that allowed me to enjoy photography quite cheaply in the days of film. I also developed my own films, mostly 35mm slides. A burglary at my daughter’s house decades later saw it disappear from my life, much missed.

But what I really wanted was a big posh large format film (120) camera, such as a Hasselblad, or a twin lens reflex such as the Rolliflex, Yashica or Mamiya TLR cameras. As we were young and saving for a house, with a penchant for eating out and lots of social drinking, there was no money for such extravagances! Near where I worked in Liverpool in 1980 or thereabouts was one of those wonderful old shops, single frontage on a busy CBD street, with a dusty window display full of faded film boxes and Kodak adverts, and various second hand cameras. This is where I bought the Practica second hand, so I kept an eye on the window as I walked past to a local pub occasionally. One day they had a new camera in the window, a brand new in its box Lubitel 166B twin lens reflex 120 film camera. It was cheap (14 UK pounds) and it was Russian, but I didn’t care, I wanted that camera more than anything.

When I bought it, I loved the wonderful feel of it in my hands, a lovely solid Bakelite body, with a pop up sheet metal viewfinder cowl, and a lens with really tactile controls. I put a couple of films through it and realised that it was a truly awful camera. The lens had no colour correction, so colour prints were awful. The miniscule focusing area made accurate focusing impossible, and obviously there was no exposure assistance, so every shot had to be set up with a hand held lightmeter.  Some people love these cameras for the artistic effects they give to well composed shots, and in fact I think this is called Lomography – using old cameras for artistic photography. Lomography is named (I presume) after the manufacturer of this camera, LOMO – Lenningrad Optical Machine Association.

So this camera was put back in its cheap vinyl case and stored in various cupboards around the world, while our photography got more and more high tech and less and less interesting.

Fast forward to 2021, and Raspberry PI had released the Raspberry PI HQ camera. I am a bit of a Raspberry PI geek, and have developed a home automation system to control the garage doors over the internet using WIFI. One of my webcams failed (used to monitor inside and outside the garage doors when using the opener), and I replaced it with a Raspberry PI V1 camera. These cost just a few dollars, but I was very impressed with how easy it was to use, and the quality of its image. While installing it I researched its capabilities, and found the HQ camera by the same people, and it was a bit like the Lubitel moment above, I felt I had to have one.

But how to use it? There are many camera projects on the web using it, some with custom made 3d printed bodies, others using toy cameras or old Kodak box brownies to make “Retro PI Cameras”, and while they are all very good, with all due respect they are a bit “makeshift” – big red buttons stuck through the side of a black camera to control the shutter, permanently connected to a laptop and a power supply, and used for things like time lapse photography. I wanted something I could pick and take out with me, with subtle modifications to adapt to real world use.

Obviously where my mind eventually went was to use the Lubitel 166B and a Raspberry PI HQ camera and a Raspberry PI, and the project kicked off. This has not been an easy project, marrying technology effectively from the 1940s, with hobby electronics is not an easy thing, and it requires a lot of planning and design effort, and much changing of plans. I only have one camera to convert, so any changes made were final – they could not be easily undone. My initial goal was to use the externals of the camera with NO changes whatsoever other than the lens, but I have had to moderate this a little as time has gone by, and now it is nearing completion, I am reasonably pleased with the results.

So lets look at the components.

Lomo Lubitel 166B camera

The original Lubitel camera was a copy of a Voigtlander twin lens reflex made in the 1940s (possibly the 1930s too). It was in production for a while, and was succeeded by the Lubitel 2.

These are both basic cameras, 120 roll film, manually wound, a clockwork shutter with a self timer, a cable attachment, and manual aperture control. The shutter had to be cocked before each use, and was not connected to the film advance so dual exposures were both possible and likely. I grew up with my father using Kodak Box Brownies to take family snaps, and am used to all these things. Focusing turned both the primary lens and the viewfinder lens. The viewfinder lens had a mirror at 45 degrees behind it, which reflected the light up onto a viewing lens, which had a ground glass spot about 10mm across to focus with.

In the 1970s, LOMO got very ambitious, and produced a camera called the Lubitel 166, basically the same as the Lubitel 2, but with a complex connection between the film advance and the shutter. Advancing the film cocked the shutter, which could only be fired when the film had been advanced. Other technical stuff may have been included. This was much too complicated, did not work very well, and was dropped. In its place they produced the 166B, which just used the 166 body, without the complex mechanisms in place. This makes the camera an odd shape, completely unsymmetrical, as one side of the camera is 10 to 12 mm thick with a cavity with very little in it. This feature is both a nuisance when working on the camera, but eventually became very useful later in the build.

One of the great things about using this camera as a basis is how easy it is to strip down and rebuild. The whole lens mechanism is removed with just 4 screws inside the camera. This is the main lens, and its shutter and aperture controls. The viewfinder lens is left behind when this is removed – the two lenses are just geared together using the knurled grips on the lenses. The whole film path just unclips and is taken out in seconds. The viewfinder cowl is held in with three screws, and when removed, the viewing lens and mirror can be removed.

Raspberry PI HQ camera

There is a lot written about this module. It is a small circuit board with a 12 mega pixel sensor built on to it. Rather than a fixed lens like previous PI cameras, this module has a C or CS lens mount on the board, allowing different lenses to be used. The C and CS mount system is used for security cameras, and a large number of lenses are available to fit, from very wide angle, to very telephoto, and even zoom lens. Some of these have fixed aperture, and some have an aperture control. The lenses are a bit industrial in their design, and a bit fiddly to use, but are in some cases surprisingly good quality. I bought my HQ camera with a 6mm lens, which is quite wide angle, and I will probably get the 16mm when the project is nearer completion. 16mm is a moderate telephoto, what I would have called a portrait lens many years ago.

There is some interesting software available to run the PI cameras. Built into the Raspberry PI OS is Raspistill and Raspivid, which allow command line access to the camera, to take pictures with extra parameters to control the image. More importantly, there is a software package called PiCamera by Dave Jones. This allows access to a whole bunch of features on the camera, very similar to what you get on a modern digital camera or mobile phone. Add to that the ability to write a user interface in Python, to control the camera and access PiCamera, and there are so many possibilities.

For instance, so far I have implemented White Balance, Image effects (Sketch, emboss etc), Digital Zoom, Resolution Control, Exposure controls including Meter Mode, Exposure Compensation, Shutter Speed, Exposure Mode (beach, night, fireworks etc), sensitivity (ISO) control.

One of the capabilities in PiCamera is to annotate images with text. This is quite crude, text is centred, only white text is available, but you can put it on a range of coloured backgrounds. Font sizes can go over a reasonable range, from 6 to 160. Using F-Strings in Python, you can specify a common “box” size, and left justify within the box, so slightly better appearance is possible. I use this to generate menus, which the user can move up and down through using the Encoder mentioned below, and select the item required using the pushbutton. The annotation has to be removed before taking photographs, otherwise it appears on the captured image.

Using an extra package called OpenCV, I have set up a simple focusing aid, that indicates what the contrast in the image is like as you focus, allowing the best contrast and therefore focus to be selected. Very simply it uses laPlacian edge detection to produce a very high contrast version of the images, and calculates a value for the level of contrast in the image.

The physical size of the camera module is very similar to the lens module taken out of the original camera. This made it quite easy to make up an adapter plate, to which the Pi HQ is attached, and which is attached to the camera using the original fixing holes. A cosmetic plate off the old lens, used to hide “the gubbins” behind the lens, was adapted to sit in front of the circuit board, therefore hiding the more modern, and very bright green “gubbins” of the camera module. 4 new screw heads are visible on the front, around the lens module, but I am cool with this, I am just glad it fitted so well!

The mounting plate is 3mm steel, about 40mm square with rounded corners. 4 holes to match the HQ lens module, and 4 to match the mounting holes in the camera body. These holes are all tapped with M2.5 threads, and screws carefully selected for the correct length from my stash of computer parts were used to mount the camera module to the plate, and the plate to the camera.

The ribbon cable goes through a new slot into the cavity vacated by the roll of film, and from there goes across the body to the Raspberry Pi.

All this requires a computer to control it.

Raspberry PI 3 Model A+

There are quite a few models of Raspberry PI around, I have a Raspberry Pi Model B, a PI 2 Model B, and a couple of Raspberry PI Zero W. I was very tempted to use a PI Zero W as these are tiny with WIFI built in. I chose not to in the end, these are basically a Raspberry Pi 1 made a bit faster, but still not as fast as higher models. They also need a special ribbon cable to connect to the camera.

A lot of Raspberry PIs are aimed at the hobby market, and these are the easiest to get hold of. The B+ models all have a large selection of extra USB ports, ethernet ports etc, and this give them a larger footprint and vertical profile than the Model A devices, which have a single USB ports, an HDMI port and a power port. These are shorter and lower profile than other models. Unfortunately the PI 4 does not yet come in an A+ format, so I went for the Pi 3 A+.

I am not using any of the sockets and ports provided, other than the camera ribbon table connection. All other connections, including 5v power, are connected directly to the GPIO pins. I have also added a Real Time Clock device to allow unique naming of image files.

The Pi 3 is not located in the main body of the camera, but is attached to the inside of the back of the case. When the case is shut, it slides into the main cavity, where the film plane was located. When the case is open, access to the rest of the camera is much easier with it out of the way. 4 new screws are visible on the back of the camera, but these blend in quite nicely.

Normally I set these PIs up as headless, with no X windows, but in this case I need to connect a viewfinder screen, and this needs to use HDMI as part of its connection. So this PI boots up into the normal user interface, which is then mostly ignored.

But this leads to the

Waveshare 2″ LCD screen

I decided to use a dedicated screen as a viewfinder for the camera, carrying a laptop, or using the phone were considered, but not for long.

The viewfinder cavity of the Lubitel is quite limited. The extra width of one side of the camera, and the fittings of the cowl made it such that only a very small screen would fit horizontally across the top of the camera, and the 45 degree platform fo the reflex mirror doesn’t help. I had ordered a 2″ screen (just $12.00 or so)  to experiment with and found the best place it would fit was vertically, across the front of the viewfinder cavity, immediately behind the now redundant viewfinder lens. Obviously this is not visible from above very easily. However, the old viewfinder mirror (the “reflex” part of twin lens reflex), while not suitable for reuse because of its shape, did sit on a 45 degree sloping platform, onto which I could mount a new mirror, giving a perfect top down view of the vertically mounted screen. A piece of acrylic from an old laptop screen keeps the dust off the mirror.

I tried a normal mirror (50mm by 50mm), which cost just a few cents as part of a pack of 12 for $2.50! But this mirror was silvered on the back, which made the image difficult to see and focus due to reflections from both the top surface and from the silvered surface. After much searching, I finally got a piece of First Surface Mirror (silvering on the front not the back) made up by a couple in New Zealand that make Kaleidoscope kits, and the result is now perfect.

The 8 wires needed for this screen are soldered directly to the board, as the plug and socket took up too much room. They pass through into the main body cavity through a slot cut into the base of the viewfinder cavity, and 6 of them continue through another slot into the lower film cavity, to then follow the back of the body to the Raspberry PI. Two (5V and GND) go off to connect to the power booster directly, rather than using the Raspberry PI connections, freeing up GPIO pins if ever needed.

Flipping the screen vertically so that it appears in normal orientation is just a software change in the PI.

Rotary Encoder – the main control for the camera

While planning this project, I realised I needed something special for controlling the camera. I was planning a lot of features, I was not able to use a touch screen, and wanted as few modifications to the outside of the camera as I could get away with. While researching switches and things to fit, I came across the “Rotary Encoder”, in particular the Jaycar product SR1230. I had never really come across these before, obviously I had used them in electronic devices like car audio, mice wheels etc, but never considered how they worked. This particular model has a push button switch built in, as well as the rotary encoder.

These things are delightfully simple in principle, the code to control them is also very simple in principle, and their flexibility is endless!  With a very simple piece of code, a program can detect which direction the knob has been turned, and how many clicks, and detect a push of the knob. This “knowledge” can be used for scrolling through a menu, clicking on a menu item. It can also be used for direct functions, like zooming in and out digitally by turning the knob, and to take photos by pressing the knob. The programming logic behind this can seem a bit daunting, but once a decent menu system is devised, a few flags to hold the current menu, the current position, and what function of the camera you are in, its just a SMOP (small matter of programming).

Detecting the rotation and the presses is best done as an event driven process, and the use of this knowledge is done in a very simple “polling” process that handles a button press or a move of the rotary control, and takes the appropriate action.

However, this rotary encoder is very cheap ($11.00) and very small (14mm square, with a 1/4″ shaft) and hence is not very sophisticated. The main problem with it is contact bounce. So after the knob is turned  or pressed, and the event is detected, the contacts continue to bounce, and cause spurious signals. There is an “antibounce” parameter in the GPIO pin handling program, but this is not what is needed. Instead, there is a slightly more complicated process required to recognise a “bounce” and ignore it. Movements in the switch are detected by “edge detection”, where a change from off to on or on to off is detected. Bounce can be detected by looking at the state of the switch a short time after the edge was detected. Only if the switch is off after a falling edge was detected, or on if a rising edge was detected is the detection valid. A similar but slightly more complex process is required for the rotation, where two switches working slightly out of synchronisation are used to determine direction.  In addition, there is a sort of “prebounce” when turning the knob, where the falling edge of the previous move is detected, and this has to be ignored also. Once worked out, it is really quite easy!

This lives where the 120 roll of film was located, on the right of the camera.

Power supply

This is a work in progress. Currently it is made up of 4 components.

1. A Li-ion cattery battery. A single 3.7v cell extracted from a laptop battery, probably about 2Ah.

2. A Battery booster, which takes the cell voltage, and boosts it to 5.19V to drive the Raspberry Pi and the Waveshare 2″ LCD screen. This provides about 3A. This fits inside the cavity that was intended for the interlock mechanicals abandoned for this model. Wires from the battery, the on off switch and the battery charger, and to the Raspberry Pi and the Waveshare LCD screen (power only)are routed into this cavity also, and the vast majority of the messy wiring is hidden from view when the camera is opened.

3. A small battery charger which runs off a Micro USB cable, and charges the Li-ion battery. This lives inside the main body, which has to be opened to charge the battery.

4. A rotary, two position switch, which either provides power to the computer, or allows the charger to charge the battery. This lives where the 120 roll of film was located, on the left of the camera.

This battery is unprotected so can easily over discharge, which can destroy the battery and possible cause physical damage to the surrounding camera, so I am not happy to use it other when testing when I can monitor it. However it does fit very conveniently where the uptake reel for the film lived, and a protected battery won’t fit there! I may need to cut the camera body more to fit a bigger, safer battery.

Features and Software

see Page 2 for software and features

This page is a work in progress, started 24 August 2021. If you come across it by accident and are interested, let me know and I will keep you informed of updates as they happen. I will illustrate with photos as I get time and inclination.