Raspberry Pi as a Macro Camera

Who does not know the problem, during soldering very small packages on a PCB, sometimes it would be nice to have a closer look.
A microscope or a macro camera would be nice. Of cause one could take a picture with a digital camera and look at it on the screen. Other people have also microscopes for this purpose.

But how nice would it be to have a big resolution picture on the computer screen which also updates quickly if for example moving the object under observation? A macro video camera would be awesome.

After reading the article on the Raspberry Pi blog [1] about how to use the Raspberry Pi camera as a macro camera I thought this is exactly what I need. Since I have two of these cameras lying around I thought it is worth a try.

In order to change the focus of the Raspberry Pi camera one needs to move the lens, which can break the camera.
By screwing out the the lens one changes from the fixed focus, which is sharp from around 70 cm to infinity, to a focus which is sharp under short distances.

And it works extremely good.

With the Raspberry Pi camera one can make pictures with a resolution of 2592×1944 and get videos with Full HD resolution 1920x1080p.

This shows already quite some details on the screen.

Since I don’t want to directly connect a screen to the Raspberry Pi I stream the video to my work computer and watch the video there.

This can be easily done by two commands:
On the Raspberry Pi

sudo raspivid -o - -w 1920 -h 1080 -rot 180 -b 5000000 -fps 5 -t 10000000 | nc.traditional -l -p 5000

and on the computer

nc.traditional 5000 | mplayer -fps 60 -cache 1024 -

Looking on a 0805 SMD resistor, no problem to read the value.


Also in order to examine a IC package for solder bridges, one sees enough details:


The whole setup looks like this:

Macro_RaspberryPi2 Macro_RaspberryPi1

I have mounted in front of the camera, after putting the lens in macro position, a second lens.
This lens I bought on EBAY, and it is a wide angle mobile phone lens.
With this lens I can come even closer to the object, even if this lens is not made for this purpose, but it changes the focal point a second time. Pictures get even bigger.

[1] http://www.raspberrypi.org/macro-photography-with-the-camera-board/

One comment on “Raspberry Pi as a Macro Camera
  1. Timothy E Crane says:

    Great information! I’m trying to get as close as possible(>5cm) to a 1.5″ x 2″ LCD. Any idea how close you could get your lens to 2D object that size?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: