Tag Archives: PiVision

A Microscope with the Raspberry Pi

If you require a microscope, you can make one as a proof-of-concept using the RBPi or Raspberry Pi. It is simpler if you have a bagful of LEGO parts to build the structure, but you can also go with Plexiglas construction. Apart from being a useful addition to a science laboratory, making a microscope with the RBPi is a good way of learning computer programming and making things with your hands.

The microscope uses an electronic camera for resolving images and its maximum resolution is about 5µm per pixel. That means you will be able to see and analyze dust, salt, hair and fruit flies – objects mainly in the range of a 20th of a millimeter to 5mm. Since at high resolutions only a small area will be in focus, you may confront distortion and color effects, commonly known as chromatic aberration. That precludes seeing cell culture or blood cells.

If you make the microscope construction from pre-produced parts and do not glue them together, it will allow for subsequent modifications, optimizations and adaptations for special applications, if necessary. You will need an RBPi2 with its SD card, a keyboard, mouse, a monitor or TV. You will also need an electronic camera similar to the WaveShare B, along with a 50 cm cable. For the pre-produced parts, you can refer here. The illumination comes from a 1.6W LED lamp working off a 9V block battery, operated through a small switch.

The construction of the microscope starts with a base plate and a sled tray for placing and holding objects or object glasses. Then there is a tower for holding the plate, which acts as the camera mount. You should be able to move the camera plate and the object sled orthogonal to each other for placing the camera precisely above the object.

There are two ways to focus the camera. You can adjust the length of the columns of the camera tower to get a coarse adjustment – this will adjust the distance between the object and the camera lens. For a better focus, you can then turn the camera objective manually. You may have a worm gear arrangement with a toothed rack (possibly from the LEGO collection) and you can use that to adjust the focus. The gear wheel with toothed rack could guide the object tray and the worm gear could be attached to the camera.

For processing images from the camera, there is a large choice of software to use. You can use very good GUIs available for raspivid (video capture) and raspistill (for still images). Alternatively, you can use raspistill along with Mathematica and its image analysis functions, for processing the images for subsequent analysis.

You can also use PiVision, which offers an option to preview the image to see if the camera is properly focused on the area of interest, before capturing the image as a still photo. During preview, PiVision allows changing the options setting for expanding the preview image to get more details and to re-focus, if necessary. Once you have captured the image, remove the unwanted areas by cropping it.