A Raspberry Pi camera-based microscope, built just from LEGO parts.
Version: October 11, 2015
Introduction and overview
In the beginning I just had the idea to build a simple and cheap microscope using a raspberry pi and a picam with an adjustable lens. When I had received the camera and had sketched the general layout for a prototype of a microscope, I realized that using lego parts might be a simple, fast, effective and cheap way to test the concept and to optimize parameters.
In the presented version the device is a reflected light microscope. With a modified object tray (not from Lego bricks) with backlight it was possible to transform it to a transmitted light microscope.
The maximum resolution is about 5 µm/pixel at more than 2500 x 1900 pixels. You may take images in the jpg, png or gif format and high resolution videos in the h264 format.
I do have the intension to use the basic layout of the LEGO-scope to construct a device that can easily assembled from plexiglas parts. I will currently not have much time for this project. So try to built yours, and please hand your layout to the community.
If there are some technical improvements or new images, I will make an update.
So if you like his project it might be worthwhile to check for news every couple of weeks.
There is a German version of this presentation as well.
Note of November 5th, 2015: I have now got a working prototype of a comparable microscope, which is made using custom laser cut Plexiglas parts. It is presented on Instructables as well (https://www.instructables.com/id/ARPM-Another-raspberry-pi-microscope-made-from-Ple/). Have a look there if your interested. Omits the discussion with your kids about the bricks.
- a Raspberry Pi 2 running on Raspian, with Python and Mathematica installed.
- a LG monitor, a Logitech K400R keyboard.
- a WaveShare "model B" Raspberry Pi camera with an adjustable lens (focus length: 6 mm); four M2 x 10 mm screws and eight M2 nuts, used as spacers between camera and a 4x4 LEGO plate.
- a bit of hyperthermoplastic plastic to glue the camera/screws to a LEGO plate. Standard hot glue will work as well.
- a selection of LEGO parts I found in my son's room. Nothing really unusual, but a few LEGO technics parts as toothed racks, gear wheels and worm gear are part of the construct.
- a LED desktop lamp with a goose neck for illumination.
The microscope consists of a frame, which holds an movable object tray and a movable plate with the camera attached. Using simple gears (not absolutely neccessary, but handy) the object tray and camera can be moved orthogonal to each other. So you can place the camera above the relevant part of an object which was placed on the tray without touching it.
- The microscope has a resolution of about 10-20 µm, i.e. you may have look on ants, fruit flies, hairs or dust particles, but you will not be able to see single cells.
- The in-focus, sharp area of the pictures is not to large and usually restricted to a region in the center.
- The image of a white object will be yellowish in the center and violet further outside. This is probably due to an artefact of the lens that is called "chromatic aberration".
- So far, focusing requires to turn the lens manually. A rubber wheel around the lens housing gives a good grip, but
some kind of gear would be helpful to simplify focusing, and finally automize,in a later version.
- Illumination could be optimized, e.g. using an Adafruit LED circle or bar and an Ardulino.
- So far no z-axis movement, allowing to adjust the distance between object and camera, is implemented.
- Motorized adjustments and remote control would be nice, e.g. using an Ardulino and some (LEGO ?) step motors.
Alternative cameras and lenses:
I have been using the lenses of the WaveShare "B" and "F" camera models on a "B" camera, and chromatic abberation was seen in both cases. For high res images I would recommend the "B" version, but the "F" version is also working and it comes with IR lamps. Please let me know if you find a better s-mount lens for this purpose.
- Raspberry Pi 2 with µSD card and case: about 50€.
- WaveShare Raspberry camera model B (http://www.waveshare.com/catalogsearch/result/?q=camera+b): 22US$, or about 25 € in Europe. I got mine from my local (Berlin) vendor (Waveshare B at AVC-shop.de).
- A keyboard and mouse, a monitor or TV screen: these details depend on you. I like my Logitech K400R keyboard.
- LEGO: a large base plate, several standard and a few LEGO technics parts: the cost will strongly depend on what you already got at home. If required, there are vendors where you can order special parts individually.
At step 3 you find a variety of images and videos taken with the device.
To control the camera and take the pictures I often use Pi Vision. I am also using and can recommend a python script developed by sixbacon/Bill Grainger (see https://www.raspberrypi.org/forums/viewtopic.php?... and a very nice Mathematica script developed by "Bob the chemist" aka Prof. Robert LeSuer for his "raspiscope" (see https://www.raspberrypi.org/forums/viewtopic.php?..., in the original or a in slightly modified version.
I have a specific application in mind, namely ELISpot analysis, and herefore have developed some Mathematica scripts for narrowing down and isolate a circular region of interest, and for the quantitative and qualitative analysis of "spots" in this ROIs. I plan to add optimized versions of the scripts at "step 4" as soon as I find them good enough for public use.
I got several ideas from Bobs LEGO-based "raspiscope" concept and from André Maia Chagas' FlyPi project. André has build a very complex Raspi microscope with illumination and temperature controls and other features. He is using the same WaveShare camera I then adopted for my project. If you would like to see what is really possible, please have a look on the FlyPi web site (https://hackaday.io/project/5059-flypi). I would like to thank André for his support.
- Please be aware that this is still work in progress! Let me know your ideas for improvements.
- I am not a native speaker, so hints and corrections are welcome.
I would like to thank my son Elias for his support of this project, with his bricks and ideas.
Step 1: The Object Tray and the Slipway
The object tray is basically a 6x12 plate with two rows of toothed rack and low profile strips on top. The knobbed strips on the side of the tray area can be used to attach bricks that hold the object of interest in place. If required they might be replaced by flat ones. On the back of the plate are small convex plates to reduce friction on the slipway.
The slipway consists of two rows of flat strips and walls to fix the direction of the object tray. A pair of gear wheels is used to move the object tray and keep it at a defined heigth. LEGO specialist may have seen a very similar construct before, in a Lego Starwars MTT.
You may turn the microscope into a transmitted light microscope by using an object tray with a backlight. As a first prototype I had build one using a small 1.5 W 12V LED lamp powered by a 9V block battery for illumination, two pieces of a 10x10 mm aluminum profile and a piece of plexiglas to place the object on. As diffusor I used a piece of 3 mm opaque white plexi glas. The objects, e.g. petals or fine cut slices of apple and onions, were placed on the diffusor plate or on a standard microscopic glas slide. The current construct is working, but requires some optimization to be of wider use.
Step 2: The Camera, the Camera Holder Plate and a Worm Gear to Move It
The camera is fixed to a 4x4 holder plate which was attached to a larger 6x14 plate with two row of flat strips and a toothed rack on top. This rests, and moves, on two flat strips that are placed on the microscope frame.The camera plate is moved by a worm gear.
Four 10mm M2 screws were fixed to the camera with two nuts each. Herefore it was neccesary to carefully widen the holes in the camera's PCB to 2 mm. The screws function as spacers, which probably are necessary as the camera produces some heat, and this construct does allow to remove the camera and apply minor adjustments to the camera's position. I glued the screws to a 4x4 plate which had been flatend at the corners. The 4x4 plate with the camera was then attached to the center of the larger plate.
The camera plate is moved by a simple worm gear. This allows a relatively precise movement and fixes the camera at its defined position. For easier and more precise adjustments a gear with a larger turn wheel was implemented.
Turning the lens to change the camera's focus is a bit difficult. Therefore I modified a LEGO rubber wheel, so it now fits to the lens' housing (14 mm diameter). The wheel makes it much easier to turn the lens and adjust focus.
To adjust the distance between camera and object you may either modify the length of the columns, adding or removing standard or low profile bricks or you may put some bricks under the object, or both. The minimum distance between the lens of the B camera, that has a focal length of 6mm, and the object is about 8 mm. The lens of the F camera, with a focal length of 3.8 mm has a smaller magnification but you may move it closer to the object.
Step 3: Some Example Images
Here you find a selection of images and videos taken with the device.
You can see a yellow colored spot in the center of most images, and a violet area on the outside.
This seems to be a general problem of the lenses called chromatic aberration.
By now you will find:
- Lincoln and his nose (my regards to BobTheChemist) on a US$ 1 cent piece and his statue in the memorial building on the back of the coin
- details of a Euro 1 cent (and a facial hair)
- pieces of a broken CD, giving a rainbow spectrum
- new (of Oct. 11, 2015): transillumination and reflected light images of tiny petals of flowers as clover, lavander and some others if had found.
- a fossil shark tooth
- the LEGO logo on bricks. The two images are a comparison using the lenses from WaveShare B and F cameras (6 mm vs 3.8 mm focus length) on the same B camera, with about the same distance of the camera to the object. To get the same magnification with the "F"-lens, you have to get much closer to the object.
- a set of ELISpot-images (positive and negative controls, antigen reactions A and B), ELISpot is a very sensitive method to measure person's cellular immunity againsts bacteria or viruses.
- slightly damaged fruit fly, I had to kill
- an image of amophous microbeads with a average diameter of 100 µm. I had taken identical images as png, jpg, bmp and gif-files to see the differences on the single pixel level. For this png seems to be the best option.
- the tip of an insulin needle.
- a raspivid-video (h264-format) of playing with the micro beads using the insulin needle.
- a 100 µm bead and tiny particles, which are yeast cells. These have size of about 8 µm or two pixel
- a piece of onion skin.
- some fine feathers
- new: thin slices of an apple and an onion, in transillumination and reflected light view.
More images may follow. Let me know your ideas and suggestions.
Step 4: Some Software to Take and Analyse Images (will Be Added Here Later)
As mentioned before:
I will place some of my Mathematica scripts here when I think they are ready and usable for the public.
Please come back later.