0% found this document useful (0 votes)
144 views79 pages

Instructions PDF

Uploaded by

hexapodo2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views79 pages

Instructions PDF

Uploaded by

hexapodo2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

HOW TO BUILD A MICROSCOPE

USING LEGO BRICKS, ARDUINO


AND RASPBERRY PI by Yuksel Temiz

Raspberry Pi Camera

stepper stepper stepper


driver driver driver

LED
Arduino
driver

stepper stepper stepper


driver driver driver
IBM Research - Zurich Images © 2020 Yuksel Temiz
modular
fully
motorized
11001 image
01010 processing
11011
using Python
Focus

macro
photography water contact
angle
measurements
microscopy Tilt
(reflected or
transmitted light)

KEY FEATURES
• Raspberry Pi operation system Y X
• 8 MegaPixel CMOS camera (Full HD 30 fps video) Rotation
• Imaging features from several centimeters to several micrometers
without changing the lens
• 6 stepper motors (X, Y, tilt, rotation, magnification, and focus)
• Variable speed control using a joystick controller or a keyboard
• Uniform illumination for imaging reflective surfaces
• Modular design: stages and modules can be arranged in any
configuration depending on the application

IBM Research - Zurich Images © 2020 Yuksel Temiz


Contents
6. Electronics
1. Linear
actuators

4. Illumination

7. Final
2. Camera assembly
module

3. Rotary
stage

5. Tilt
mechanism 8. Software BOM
IBM Research - Zurich Images © 2020 Yuksel Temiz
Linear actuators

IBM Research - Zurich Images © 2020 Yuksel Temiz


Linear actuators

8x 2653
1x 3027

IBM Research - Zurich Images © 2020 Yuksel Temiz


Linear actuators

2x 2357
1x 3036

1x 3795

IBM Research - Zurich Images © 2020 Yuksel Temiz


Linear actuators

Super glue
Some parts need
to be glued for
better stability

1x 3020

RackGear.stl (3D printed)

2x 32028
IBM Research - Zurich Images © 2020 Yuksel Temiz
Linear actuators

Both sides of the 3D-printed


rack can be polished using a
file or sandpaper to achieve a
smoother movement

IBM Research - Zurich Images © 2020 Yuksel Temiz


Linear actuators
28BYJ-48
stepper motor MotorHousing.stl
(3D printed)
2x M4 screw

MotorGear.stl
(3D printed) 1x 3020

IBM Research - Zurich Images © 2020 Yuksel Temiz


Linear actuators

Symmetrical

The motor can be positioned on either side of the rack. This would be useful to quickly change the movement direction of
the stages with respect to the joystick action (the direction can also be changed from the software).

IBM Research - Zurich Images © 2020 Yuksel Temiz


Linear actuators (Photograph)

IBM Research - Zurich Images © 2020 Yuksel Temiz


Linear actuators – 4x

X Y Z Camera
IBM Research - Zurich Images © 2020 Yuksel Temiz
Linear actuators – 4x (Photograph)

X Y Z Camera
IBM Research - Zurich Images © 2020 Yuksel Temiz
Camera module

IBM Research - Zurich Images © 2020 Yuksel Temiz


Camera module
CameraAdapter.stl
(3D printed)

Raspberry Pi camera v2
1x 99207
(Lens removed)

2x M2

remove the lens not needed

Recommendation:
1x Linear actuator
(Camera)

remove the glue the image


rubber spacer sensor directly
to the board

IBM Research - Zurich Images © 2020 Yuksel Temiz


Camera module

IBM Research - Zurich Images © 2020 Yuksel Temiz


Camera module

IBM Research - Zurich Images © 2020 Yuksel Temiz


Camera module

8x 60581

IBM Research - Zurich Images © 2020 Yuksel Temiz


Camera module

1x 3027

Camera
cable
1x 21731

1x 3958

LensAdapter.stl
(3D printed)

Objective lens

⌀12mm
IBM Research - Zurich Images © 2020 Yuksel Temiz
Camera module

The opening at the back


can be closed if needed

IBM Research - Zurich Images © 2020 Yuksel Temiz


Camera module (Photograph)

Smaller aperture
(when needed)

33291

JST extension cable Raspberry Pi


(when needed) Zero

IBM Research - Zurich Images © 2020 Yuksel Temiz


Camera module (Photograph)

Raspberry Pi 3 or 4

IBM Research - Zurich Images © 2020 Yuksel Temiz


Camera module (Photograph)

TREEYE M12 lens holder


TREEYE 15.3mm
(alternative to the
magnifying lens
3D printed adapter)

IBM Research - Zurich Images © 2020 Yuksel Temiz


Rotary stage

IBM Research - Zurich Images © 2020 Yuksel Temiz


Rotary stage – Option 1 (simple)

1x 89523

1x 92947
ShaftAdapter.stl
(3D printed)

1x 3020

IBM Research - Zurich Images © 2020 Yuksel Temiz


Rotary stage – Option 2 (precise)

RotationGear.stl
(3D printed)

1x 59900

1x 21462

1x 14918

1x 3029

IBM Research - Zurich Images © 2020 Yuksel Temiz


Rotary stage – Option 2 (precise)

IBM Research - Zurich Images © 2020 Yuksel Temiz


Rotary stage – Option 2 (precise) (Photograph)

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism – Vertical supports

1x 4282 2x 2465

2x 3710
1x 99207 2x 3023
2x 3710 4x 2357

1x 3023
1x 64799

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism – Camera stage

1x 3034

2x 3700
1x 44237

1x 3034

2x 43093

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism

1x 11010

Fixed to a
rigid base

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism

Vertical
support

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism

3x 92947 1x 3680
1x 3679

3x 3020

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism

TiltGear.stl
(3D printed)

1x 92947

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism

1x 92947
1x 3679
1x 3680

1x 3020
Vertical
support

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism

Camera stage

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism

IBM Research - Zurich Images © 2020 Yuksel Temiz


Tilt mechanism (Photograph)

Double sided
tape

Wooden base
(26 x 26 cm2)

IBM Research - Zurich Images © 2020 Yuksel Temiz


Illumination

IBM Research - Zurich Images © 2020 Yuksel Temiz


Illumination – LED diffuser

High power LED


(e.g. Opulent Americas LED backlight module – Large
LST1-01G03-5070-01) (Adafruit 1621 – integrated LED removed)
Heatsink
(if needed)

LEDhousing.stl LEDfixture.stl
(3D printed) (3D printed)

43093

IBM Research - Zurich Images © 2020 Yuksel Temiz


Illumination – Reflected light

1x 57909

1x 4282
1x 92013

2x 2465

Vertical
support

IBM Research - Zurich Images © 2020 Yuksel Temiz


Illumination – Transmitted light

Uniform illumination

43093 optional

Position the motor so that


the gears match nicely

IBM Research - Zurich Images © 2020 Yuksel Temiz


Illumination (Photograph)

Reflected light

Transmitted light

IBM Research - Zurich Images © 2020 Yuksel Temiz


Electronics

IBM Research - Zurich Images © 2020 Yuksel Temiz


Electronics
Flex cable
Raspberry Pi Raspberry Pi
5V (Zero, 3 or 4) camera module v2
(USB)

5V Serial communication with


6x stepper motors
Power Raspberry Pi and power (USB)
supply High-power
X Y Z Potentiometer
LED OLED display (LED intensity)
Mainboard
• Arduino microcontroller
Y Z T
DC-DC • 6x stepper motor drivers
converter • High power LED driver
12V Serial communication X C R
(LED driver) (UART)
Tilt 3x thumb joysticks
Rotate Camera

Note-1: Stepper motors and the illumination LED can be controlled from the controller (UART) or the Raspberry Pi (USB) or both
Note-2: Some high-power LED drivers may require more than 5V, then a DC-DC converter or a separate power supply can be used
IBM Research - Zurich Images © 2020 Yuksel Temiz
Electronics – Mainboard (Photograph)

Arduino Stepper motor drivers Raspberry Pi Arduino microcontroller


(USB) (Adafruit 3677)
Stepper
signals X 6x stepper motor driver
EN
Driver 5V (Adafruit 3297)
enable
signals
Controller RX
Y 6x 5pin JST-XH
EN
TX connectors
Raspberry
(Stepper motors)
USB
Pi Z
PWM EN

C LED driver
EN
12V LED driver (RECOM RCD-24-0.70/PL/B)

R
LED EN
4x 92947
NeoPixel
T NeoPixel LED
status LED
EN 2pin JST-XH
(optional) Controller (Adafruit 1655)
connector
(LED) (UART)
IBM Research - Zurich Images © 2020 Yuksel Temiz
Electronics – Controller (Photograph)

Mainboard

128x32
OLED display Mainboard
OLED display
(UART, power)
Arduino microcontroller 10Kohm Potentiometer
I2C (Adafruit 3677) (Adafruit 4133)
SDA SCL 5V GND TX RX 5V GND

Arduino

Analog inputs

43mm
3x thumb joysticks
Thumb joysticks
(Sparkfun COM-09032)

This joystick controller is fun to use but it is optional, the microscope can also be controlled
directly from a keyboard connected to Raspberry Pi using the Python code.

IBM Research - Zurich Images © 2020 Yuksel Temiz


Electronics – Controller (Photograph)

3D printed
housing

IBM Research - Zurich Images © 2020 Yuksel Temiz


Electronics – Operation (Photograph)

Serial communication
Serial communication Status LED (UART) and power
with Raspberry Pi (optional)
and power

12V
(LED driver)
LED intensity
(0-100%)

Speed control
(3 levels)
IBM Research - Zurich Images © 2020 Yuksel Temiz
Final assembly

IBM Research - Zurich Images © 2020 Yuksel Temiz


Final assembly

There are several different ways of assembling the microscope. Here is one. Modules can be placed differently
depending on the length of the cables, size of the object to be visualized and the microscopy technique.

Tilt
mechanism

IBM Research - Zurich Images © 2020 Yuksel Temiz


Final assembly

3020

Linear
actuator (X)
IBM Research - Zurich Images © 2020 Yuksel Temiz
Final assembly

Linear
actuator (Y)

IBM Research - Zurich Images © 2020 Yuksel Temiz


Final assembly

Rotary stage

IBM Research - Zurich Images © 2020 Yuksel Temiz


Final assembly

Linear
actuator (Z)
3020

IBM Research - Zurich Images © 2020 Yuksel Temiz


Final assembly

2x 60594

IBM Research - Zurich Images © 2020 Yuksel Temiz


Final assembly

IBM Research - Zurich Images © 2020 Yuksel Temiz


Final assembly

Camera
module

IBM Research - Zurich Images © 2020 Yuksel Temiz


Final assembly

Illumination

IBM Research - Zurich Images © 2020 Yuksel Temiz


Final assembly

Mainboard

Controller

HDMI
Display

Keyboard, Mouse, Touchscreen… Raspberry Pi


IBM Research - Zurich Images © 2020 Yuksel Temiz
Final assembly
Z

Camera

Tilt Uniform light

Lens

Sample

z Y
Rotation

y X

High magnification Low magnification


(Microscopy) (Macro photography)

z e.g. 5-10 cm
e.g. <1 cm

y
e.g. 5-10 cm
x e.g. <1 cm

IBM Research - Zurich Images © 2020 Yuksel Temiz


Software
1100100111…

IBM Research - Zurich Images © 2020 Yuksel Temiz


Arduino (Photograph)
Mainboard

Controller

Arduino IDE
Arduino IDE
Controller.ino
MainBoard.ino

Board: Adafruit ItsyBitsy 32u4 - 5V 16MHz Board: Adafruit ItsyBitsy 32u4 - 5V 16MHz

Required libraries: Required libraries:

• AccelStepper (for the stepper motors) • Wire (for the OLED display)
• Adafruit NeoPixel (for the optional status LED) • Adafruit_GFX (for the OLED display)
• Adafruit_SSD1306 (for the OLED display)

IBM Research - Zurich Images © 2020 Yuksel Temiz


Raspberry Pi – Python
MicroscoPy.py: a program written in Python 3 to control the microscope, modify camera settings and take photos
and videos from keyboard
• Sends commands to Arduino
mainboard to control the
stepper motors and the LED
from keyboard (alternative to
the joystick controller)

• Modules used:
• sys
• easygui
• pySerial
• time
• Pynput

• In Raspberry Pi 4, GPU
memory increased to 144MB
from 128MB to achieve max.
camera resolution (simulated screenshot)

IBM Research - Zurich Images © 2020 Yuksel Temiz


Raspberry Pi - Python (Photograph)

USB hub

Raspberry Pi 4 Raspberry Pi 3 Raspberry Pi Zero


HDMI
adapter
Power Power HDMI adapter

Camera Camera

Power

Camera

Tested at 3280×2464 (max.) Tested at 1920×1080 Tested at 1920×1080


camera resolution camera resolution camera resolution
IBM Research - Zurich Images © 2020 Yuksel Temiz
Examples of images - macro

3280 x 2464

IBM Research - Zurich Images © 2020 Yuksel Temiz


Examples of images - micro

3280 x 2464

IBM Research - Zurich Images © 2020 Yuksel Temiz


Examples of images

Macro photography and video taken


at different angles and magnification

2D and 3D (tilted) imaging


of biological samples
fruit fly rice neurons

Microscopy (reflected
or transmitted light)
1 cm1 mm 100 µm 100µm

Contact angle measurements

IBM Research - Zurich Images © 2020 Yuksel Temiz


Bill of materials
Item Total price ($) Remarks
LEGO bricks ~60 I recommend buying extra bricks in different sizes. • The prices and the links are for
Raspberry Pi 10-50 Any model works. exemplary components that
Raspberry Pi camera 25
were used in this prototype.
Camera flex cable 3 A long cable (>40cm) is preferred if the Raspberry Pi cannot be placed closer to the camera.
• Any other compatible model
Magnifying lens 10 M12 thread
should work in principle.
Micro SD card 10 Raspberry Pi operating system. Minimum 16GB is recommended.

HDMI display 50-150 Optional if an HDMI display is already available. The price varies depending on the size and the model.
• The total price varies
Arduino board x2 20 One for the mainboard, one for the controller. Any Arduino board with enough number of IO pins should work.
significantly depending on the
Stepper motor driver x6 30 Any other 5V compatible driver should work. Microstepping was not needed in this project. vendor and the model. For
Stepper motor x6 15 28BYJ-48, 5V, 1/64 gear ratio example, the type of the
JST-XH 5P 4S cables 7 A few of these cables are required the extend the default cable of the stepper motor (28BYJ-48) Raspberry Pi and the display
High-power LED 4 makes a big difference in the
High-power LED driver 14 price.
Light diffuser 3 An LED backlight module is modified by replacing the low-power LED by a high-power one

Potentiometer 1 LED intensity control using pulse-width modulation. • The cost of 3D-printed parts is
Thumb joysticks x3 12 Three joysticks for X, Y, Z, Camera, Tilt, and Rotation.
not included.
5V power supply 20 At least 3A is preferred. A more powerful supply may be needed if the display is also powered from the same supply.
• There are also a few other
DC-DC converter 3 In case the LED and its driver require more than 5V.
accessories needed, like USB
OLED display 3 Displays the LED intensity or any other information on the controller.
cables, an HDMI cable,
USB connector (type A) 0.5 Connection between the mainboard and the controller (mainboard side).
optionally a mouse and a
USB connector (micro) 0.5 Connection between the mainboard and the controller (controller side).
keyboard, an ON/OFF switch,
JST XH connector set 5 Connectors for the stepper motors and the LED screws and nuts, and printed
DC barrel connector 1 In case a separate DC input (e.g. 12V) is needed for the LED circuit boards (PCBs).
OVERALL TOTAL ~300

IBM Research - Zurich Images © 2020 Yuksel Temiz


List of 3D-printed parts
Click on the design name to go to the corresponding page

Design name Function/module Units needed Slicer settings – printing speed Remarks
1-RackGear.stl Linear stages 4 Super quality (0.12mm) – 20mm/s Requires support structures. Sides of the rack may require minor polishing
2-MotorGear.stl All stepper motors 6 Super quality (0.12mm) – 20mm/s
3-MotorHousing.stl All stepper motors 6 Low quality (0.28mm) – 50mm/s
4-CameraAdapter.stl Camera 1 Standard quality (0.2mm) – 50mm/s
5-LensAdapter.stl Camera 1 Standard quality (0.2mm) – 50mm/s Not needed if a commercial lens holder is used
6-ShaftAdapter.stl Rotary stage – option1 1 Super quality (0.12mm) – 20mm/s Not needed if the more precise stage (option 2) is used
7-RotationGear.stl Rotary stage – option2 1 Standard quality (0.2mm) – 50mm/s Not needed if the less precise stage (option 1) is used
8-TiltGear.stl Tilting mechanism 1 Standard quality (0.2mm) – 50mm/s
9-LEDhousing.stl Illumination 1 Low quality (0.28mm) – 50mm/s
10-LEDfixture.stl Illumination 1 Low quality (0.28mm) – 50mm/s A small piece to keep everything in place

• Parts were designed using FreeCAD (www.freecadweb.org/), sliced using Ultimaker Cura (ultimaker.com/software/ultimaker-cura), and printed using
Creality Ender 3 Pro printer with a metal extruder and a BLTouch auto bed-leveling sensor.

• 1.75mm white PLA filament (Purefil, Switzerland) was used (extruder Temperature: 200 °C, bed temperature: 60 °C).

• A good quality printing depends on many factors and parameters, especially a good bed leveling.

• Some parts, especially the holes fitting to the studs of LEGO bricks, may require soft grinding using a file or a sandpaper.

• Gears used in the illustrations and the first prototype had a larger pitch. The latest design files have a finer pitch for better precision. All designs have
been tested.

IBM Research - Zurich Images © 2020 Yuksel Temiz


Storage

• LEGO bricks
• 3D printed parts
• Raspberry Pi + camera
• Arduino mainboard
• Arduino controller
• HDMI display
• Cables …

26cm

IBM Research - Zurich Images © 2020 Yuksel Temiz


Learning by failing

“Experience is a truer guide than the words of others”


Leonardo da Vinci

IBM Research - Zurich Images © 2020 Yuksel Temiz


Learning by failing – 1 (stepper motors from CD-ROMs)

• XYZ stage: 3D printed linear actuators using stepper motors from CD-ROMs
• Camera focus/magnification: Moving the camera lens using a tiny stepper motor
• Electronics: Custom Arduino board using Attiny841 microcontroller (one board for each motor)
• Mechanical parts: Mostly 3D printed, only a few LEGO bricks
ISP programming
top side back side
Moving
Pi Camera v2 the lens
power and
1.8cm joystick

motor driver stepper Attiny841


2cm
motor

Issues:
• Custom-design components, not available off-the-shelf
• Limited travel distance and magnification range
• Linear movements not very smooth (18-degree per step)
• Difficult to protect the image sensor from stray light
• Assembly of the custom Arduino/motor driver board requires high
precision soldering
IBM Research - Zurich Images © 2020 Yuksel Temiz
Learning by failing – 2 (DC gear motors)

• XYZ stage: 3D printed linear actuators using DC gear motors


• Camera focus/magnification: Moving the camera lens using a tiny stepper motor
• Electronics: Custom Arduino board using Attiny841 microcontroller (one board for each motor)
• Mechanical parts: Mostly 3D printed, only a few LEGO bricks

Uniform illumination M3 thread


Bearing
Guide

XYZ stage 9cm


Camera DC
motor

Issues:
• Custom-design components, not available off-the-shelf
• Smoother movements but cannot take much load at lower speeds
• Thread and guides bend when pushed too much, resulting in
wobbles during movement

IBM Research - Zurich Images © 2020 Yuksel Temiz


Learning by failing – 3 (DC motor + pinion gear + rack)

• XYZ stage: Moving a LEGO piece using a gear + rack combination


• Camera focus/magnification: Moving the camera lens using a tiny stepper motor
• Electronics: Custom Arduino board using Attiny841 microcontroller (one board for each motor)
• Mechanical parts: Mostly LEGO bricks

Moving piece

Wheels
Gear

Rack

DC motor Issues:
• Difficult to assemble
Arduino + motor driver • Side-to-side and up-and-down movements
(custom designed)

IBM Research - Zurich Images © 2020 Yuksel Temiz


Learning by failing – 4 (Tiny stepper motor + pinion gear + rack)

• XYZ stage: Moving a LEGO piece using a gear + rack combination and LEGO sliding guides
• Camera focus/magnification: Fully enclosed housing with a dedicated lens (same as the latest design)
• Electronics: Custom Arduino board using Attiny841 microcontroller and driver with microstepping (one board for each motor)
• Mechanical parts: LEGO bricks and 3D printed parts

Electronics

Issues:
• Requires high precision 3D printing (expensive equipment)
3D printed • Stepper motor: expensive and not easily obtainable in popular
motor housing electronic stores
Stepper
motor
Pinion gear
1.5cm

IBM Research - Zurich Images © 2020 Yuksel Temiz


• This project did not receive any technical or financial support
from the companies mentioned in this document.

• LEGO® is a trademark of the LEGO Group of companies.

• Raspberry Pi is a trademark of the Raspberry Pi Foundation.

• Arduino® is a trademark of Arduino AG.

www.zurich.ibm.com/st/precision_diagnostics

IBM Research - Zurich Images © 2020 Yuksel Temiz

You might also like