Introduction: Super-fast DIY Slide Scanner

About: I play with electronics and stuff. Also manager of the electronics workshop at the Royal Academy for Arts (KABK) in The Hague.

Before digital photography entered our lives and became ubiquitous, people had their photos printed on paper, and they made slide shows. From the 1950s through to the 1970s, boring friends and family with slides of vacations or weddings was an accepted pastime. There was no internet, people didn't know any better.

Although we now have Facebook and Instagram to share family photos (I'll leave it for you to decide if that is an improvement), the remnants of the Kodachrome era are still in a lot of people's attics. Boxes full of 35 mm slides are still taking up space.

To remedy that, people buy a slide scanner, only to find out that scanning a big collection is a *lot* of work. That's mainly because you need to manually put in the slides and scan them, one by one. One of my family members calculated it would take him at least 50 hours of mindnumbing labour to process the collection of 2.000 slides his father-in-law left him. Nobody wants that. There are companies of course that offer to digitalise all those boxes for you, but their services are far from cheap. Nobody wants that either.

So why not hack an old slide projector and use a Raspberry Pi to turn it into a super-fast slide scanner? The Pi can switch slides automatically and store the images online in one go. It's fast, cool, massively useful and you'll reclaim all that space in the attic. Everybody wants that.

Note: this was a project I built and wrote about a couple of years ago. I didn't publish the Instructable because I wanted to improve the scanner first, but I finally realized perfection should not get in the way of progress :-)

Step 1: Materials

Here's all you need to build your own automatic slide scanner:

  • An old slide projector
  • Raspberry Pi with SD memory card and power supply
  • Raspberry Pi Camera Module V2
  • TIP120-transistor and a 1 kilo-ohm resistor (both are dirt cheap)
  • Wire, breadboard, duct tape and/or a rubber band
  • Neutral Density (ND) gel sheet (buy it at Amazon or your local camera store)

A little soldering may be required, a multimeter will come in handy and you may want to order one or two 3D printed parts.

You'll need an old slide projector. After I started the build, I found out that my projector had some impractical features. So I bought a new one, Voigtländer Spezial PM 35 A. 150 dollars on eBay, but I bought it for 17 euros in the thrift shop. I made sure it had these features:

  • autofocus
  • push button or remote control (so it needs a mechanism to automatically change slides)
  • easy to open
  • slide mechanism not incorporated in the case
  • made for universal slide trays

As a bonus its case is a cool-looking sturdy metal, and the slide mechanism works consists of sturdy metal push bars instead of loose plastic parts.

Older projectors look even nicer, but they don't work with the universal trays.

Step 2: Using an Old Projector As a Scanner

Slide projectors have a pretty, shiny set of optical elements. From back to front there are a concave mirror, a halogen lamp and two condensor lenses that focus the light and spread it out evenly. Between those two is a heat filter, a glass square that blocks the infrared radiation of the lamp.

After the convex lens comes the frame that holds the slides and the projector lens. I took out the projector lens by just unscrewing the cylinder until it came out.

The 24 volt, 150 watt Tungsten light bulb is insanely bright, and it produces a lot of heat. The Pi Camera should be able to handle the bright light on its chip, but heat is not very good for sensitive components. Taking out the plano-convex lens reduces the light and the heat that reaches the camera considerably. We don't really need all that light anyway because the image does not need to be projected onto a large screen on the other side of the room.

Even without it though, the light still is so bright that the pictures you take with the Pi Camera will mostly be overexposed, especially the brighter parts of the image. To block some more light, I put in a bit of ND sheet. This is what photographers use to block light to their cameras to create long-exposure shots even with bright daylight (for examples, see this excellent video).

Before I thought of the ND filter, I tried sticking white plastic sheet, acrylic and even paper on the slide holder, but those materials did not reduce the light enough and it didn't help the quality of the images. I also was worried about heating the plastics up to the point of vaporizing them into unhealthy gasses.

To digitize slides or negatives, you can also just use a panel of superbright LEDs. The great advantage of this setup however, is that we can use the projector's mechanism for slide transport to scan a lot of slides fast.

Step 3: 'Pushing' the Button

The slide projector I initially bought at a thrift shop is a Braun Novamat 515 AF. It had a remote control (with a wire) so you could operate the projector from the couch. I want the Pi to automatically advance every slide in a tray, and the remote's wires are a perfect way to do that.

I cut the wire and my multimeter showed that the projector sends 31 volts through the switch (on the Voigtländer it's 38 volts). The Raspberry Pi can't handle a voltage that high just by itself, so it needs a little help in the form of a TIP120 Darlington transistor. These transistors are a little old-fashioned; MOSFETs are more efficient than Darlington transistors and they don't get hot as fast, but many of them can switch 30 volts at most. The TIP120 can handle up to 60 volts and it only needs to close the circuit for a short moment, so for this application it's fine.

Connect the left pin of the TIP120 to GPIO pin 24 on the Pi. To limit the current through the transistor, put in a 1K Ohm resistor (see the schematic). Connect the middle pin with the switch wire from the projector, and then the right pin with both a ground pin on the Pi and the ground wire from the projector. After testing the circuit on a breadboard to see if it works correctly, solder the components in place permanently.

Step 4: Attaching the Camera to the Pi

You need to find a way to put the camera in the projector firmly but preferably in a way that you will also be able to move it a little afterwards.

I had a small case 3D-printed. The strong plastic case makes it easier to attach the camera module. The print quality was very good, and the case had a nice and shiny surface. Normally that would be fine, but now we need to make sure no light bounces back onto the slide. To prevent that, I sanded the case a little.

Placing the camera inside the projector at the right distance and focussing it is quite a challenge. I used a rubber band to wrap around the camera case and the now empty housing of the projector lens. That makes it easy to rotate the camera when it is tilted in reference to the slides, but it would probably be better to build it so it won't wiggle out of position again when I move the projector. What can I say, it's a work in progress.

I cut a small opening in the top of the projector where the camera is to bring out the flat cable of the camera module to the Pi. The Pi has a CSI connector which is there especially for the Pi Camera. Pull up the bracket (the wider part of the connector) and you can stick in the flat cable, with the blue strip facing the USB connectors. Push down the bracket and the cable is connected. Make sure the flat cable is not resting on anything conductive (such as the ethernet port) because that can cause interference in the data transfer.

Attach the Pi and the soldered components to the projector.

Step 5: Taking Photos With Python

Now we can start taking pictures.

I use Raspbian on a Raspberry Pi 2 with monitor, mouse and keyboard connected. In the Raspberry Pi config you have to enable the use of the camera.

In the desktop environment you can do this via the Preferences menu, Raspberry Pi configuration, and then enable the camera on the Interfaces tab. Then restart. A fresh Raspbian-installation already has an up-to-date version of the software for the camera, but on other OSes you can install it with this command from the terminal:

sudo apt-get update && sudo apt-get install python-picamera python3-picamera

To take a picture, all you need to do in the terminal is raspistill -o foto.jpg, but we first need video to help us with focussing the camera and testing.

Create a new Python file, either from the terminal or using the Python IDE via application menu > Programming > Python 3 (IDLE).

from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview()
sleep(60) # turn off the camera after one minute
camera.stop_preview()

Save this script as camera.py and then run it. You should now have video from the camera.

Step 6: Turn Your Raspberry Pi Camera Into a Macro Lens

Now that you can see what the camera is registering, you can use that to get the focus of the camera right. The Pi Camera unfortunately doesn't have autofocus. It is the same image sensor which is used in millions of mobile phones (Sony IMX219). In the factory it is set to infinite depth of field and it delivers wonderful crisp photos... but only from a minimal distance of 50 to 75 centimeters (19.7" to 29.5"). In our slide scanner that is not going to work, because at that distance the slides would be way too small which means we wouldn't be using all of the 8 megapixel goodness of the camera to capture them. Also, the camera module would have to be half a meter (20 inches) outside the projector, which is impractical.

One way to solve this, would be to buy a macro lens like the ones made for mobile phones, but that probably would not give the optimal results. Fortunately, the Raspberry Pi Foundation discovered something about its own hardware. With a bit of effort, it is possible to unscrew the lens a little in order to change the focus.

When I got my Raspberry Pi Camera, a plastic knob was included for this purpose. I used it to turn the lens about two turns counterclockwise. It's a bit fiddly, but the result is quite impressive: really sharp images at about 4 centimeters (1,5").

Now the camera can be close enough to have the slide almost in full view! By getting the focus so much closer, the depth of field is also a lot smaller. That means you will really have to carefully make sure the camera is at a right angle and at the right distance from the slide.

Don't use pliers!

Didn't get a focus tool with your camera? Whatever you do, don't go trying to turn the lens with pliers. You'll barely have grip and you can easily damage the lens. Thingiverse.com has several designs for a 3D printable focus tool.

Before turning, you could make a small pencil line next to the lens and its holder, so that you can turn the lens back to its original position should you want to.

Step 7: Taking a Lot of Pictures

Create this folder on the Raspberry Pi: /home/pi/scanned_sllides/. Put a text file in it /home/pi/serialnumber_slides.txt with just '0' in it. Then create the file diascanner.py (see attached below).

The script pushes the projector's button as it were, by sending a signal through the GPIO port to the transistor. It does that for 0.05 seconds (50 milliseconds), which is about the minimum duration for a human button press.

Start the script at the command line with python diascanner.py 1 if you want to insert and photograph just one slide. If you want to take in fifty slides in one go: python diascanner.py 50

Step 8: Speeding Things Up

To be honest: my scans are not as good as professional scanners. To get photos that approach their quality, you'll have to invest quite a bit of time in perfect focus and light measurement. Even then the results may not be satisfactory: professional slide scanners use real scanning instead of taking photographs of slides. This results in digital photos with a lot more dynamic range – and that is what you pay for. A result that is just as good as most home slide scanners should be attainable though.

Our modified slide projector has one big advantage over the from-the-store slide scanners: it's crazy fast! You can scan thousands of slides in no time. Even if the quality is not the best, I'm thinking I could still have the best photos scanned professionally. Not having to scan every antique vacation photo or out-of-focus photo of flowers saves a lot of time and money.

--

So how much time could an automatic slide scanner save us? To have a benchmark, I asked a family member about his efforts. His father-in-law left him a collection of over two thousand slides. Using the slide scanner he bought, it holds just four slides, which doesn't make life any easier. He manually has to take four slides from the slide tray, put them in the small scanner's tray and then push a button on the scanner's software on his computer.

That way, scanning and saving takes 1.5 minute per slide. To scan 2,000 slides would take him 50 hours. Even if he'd want to spend two hours every weekend with a slow slide scanner, it would still take him six months to digitize all the old photos. I suppose this is why all the slides are still in their boxes untouched.

The speed of my scanner is mainly determined by how fast the projector can change slides: 2.4 seconds. This means a whole tray of fifty slides can be digitized within two minutes. Two thousand slides can be photographed within 1.5 hours instead of having to sit down with a store bought slide scanner for fifty hours.

It could even go faster if you use camera.exposure_mode = ‘off' to skip the automatic light measurement. That requires you to get the settings exactly right. All settings for the Pi Cam can be found at http://picamera.readthedocs.io. Showing the preview on the monitor can also be switched off. In theory, scanning would only need to take 1.8 seconds, which means we could be done with the entire collection in less than an hour.

Step 9: Things to Do

Even this awesome slide scanner could be improved upon. It needs a conveyor belt that inserts slide trays into the projector one after the other, wouldn't that be cool? In that case, it also needs sensors to detect when a new tray starts (for the numbering of photos) and when all trays are done and the system can stop.

I would love to use OpenCV to use image recognition which could add a description to every photo, categorize them (mighty useful with a large collection of photos) and maybe even auto-rotate them.

I would also like to make it easier to focus and rotate the camera. I am thinking of cutting a long slot in the top of the projector, and use a nut and bolt attached to the camera case to be able to move if back and forth, and then screw it tight.

The main thing that could be improved, is the lighting. I have been experimenting with a 3 Watt LED, but diffusing such a bright light and striking the right balance with the camera settings is pretty hard. Combining multiple different exposure to get a photo with the highest dynamic range seems necessary.

Any suggestions you might have are welcome!

Automation Contest

First Prize in the
Automation Contest