Low-cost, sub-micron resolution, wide-field computational microscopy using opensource hardware

The revolution in low-cost consumer photography and computation provides fertile opportunity for a disruptive reduction in the cost of biomedical imaging. Conventional approaches to low-cost microscopy are fundamentally restricted, however, to modest field of view (FOV) and/or resolution. We report a low-cost microscopy technique, implemented with a Raspberry Pi single-board computer and color camera combined with Fourier ptychography (FP), to computationally construct 25-megapixel images with sub-micron resolution. New image-construction techniques were developed to enable the use of the low-cost Bayer color sensor, to compensate for the highly aberrated re-used camera lens and to compensate for misalignments associated with the 3D-printed microscope structure. This high ratio of performance to cost is of particular interest to high-throughput microscopy applications, ranging from drug discovery and digital pathology to health screening in low-income countries. 3D models and assembly instructions of our microscope are made available for open source use.


37
One of the aims when building this microscope was to use only off-the-shelf 38 components that can be easily bought anywhere and to design the microscope in such 39 a way that it could be assembled with minimal external components. Avoiding 40 complexity allowed us to build a very low-cost and robust microscope, which can be 41 assembled and used with opensource software. Designs for the parts were made 42 using OpenSCAD open source CAD software and printed with Ultimaker 2+ 3D printer. 43 The microscope was designed around the Raspberry Pi 3 computer board due 44 to a wide opensource community and the support available. The computer itself has a 45 CSI port to which a Raspberry Pi camera can be connected. For the illumination we 46 used a Unicorn HAT HD 16x16 LED array, which is an add-on designed for the 47 Raspberry Pi boards. It mounts directly onto the GPIO pins on top of the board. 48 Camera and the LED board can be connected and controlled easily via opensource 49 libraries available for Python or C++ programming languages. 50 Furthermore, Raspberry Pi camera comes mounted with a mobile-phone-camera 51 type lens. It was unscrewed from the camera and used as our microscope objective. 52 The component list required to build the setup is provided below, along with a step-53 by-step instruction set for assembly and operation of the microscope.

65
Supplementary Figure S1 1 shows the assembled setup together with 3D printed parts 66 required. It was built using components described in Supplementary Table S1 1. Once 67 each component is 3D printed, the assembly is very simple and requires only a few 68 screwdrivers. 69

70
The plastic base shown in Supplementary Figure S1 1(c) was printed such that the 71 Raspberry pi and the sample stage could be screwed onto it. The base itself has 4 72 holes which can be used for screwing the microscopes to the optical bench if needed. 73 This was designed to provide higher stability when longitudinal imaging might be 74 required. 75 Sample stage

76
The sample stage shown in Supplementary Figure S1 1(b) was designed to be 77 mounted on the Raspberry Pi board with an LED array on top. The four screw holes 78 on the 3D printed sample stage match those found on the Raspberry Pi and the plastic 79 base. All components can be screwed tightly together to form a single microscope unit. 80 There is another 3D printed part that goes on top of the sample stage legs. It has 81 3 holes on it where the central one acts as an aperture for the sample, reducing any 82 stray light and reflections from the LED array. The other 2 holes were made for screws 83 that attach the focusing stage to the sample stage. The camera holder module (the first 3D printed part seen in Supplementary Figure  88 S1 1(a)) was designed to mount the microscope objective (the unscrewed camera 89 lens) in place and screw the camera above it. This was designed for finite-conjugate 90 microscope configuration to be established. The unscrewed lens from the camera has 91 a 1.5mm aperture only on one side; lens must be mounted such that the aperture is 92 facing downwards (towards the sample). This compact design was set to achieve 1.5× 93 magnification, but it can be easily modified by changing the distance between the lens 94 and the detector. It should be noted that the sensor is not glued to the camera board 95 well. To ensure correct alignment it is best to re-glue the sensor. 96 The camera holder mount, (the second 3D printed part seen in Supplementary 97 Figure S1 1(a)) serves several purposes including focusing the sample. Firstly, it has 98 rails onto which camera holder module is mounted and can be moved up or down for 99 focusing. The central hole in the camera holder mount is for the 0.25mm pitch screw. 100 Springs are fed through the inner pair of holes in the camera holder mount and the 101 corresponding holes in the camera holder module. They are held in place by sliding 102 the pins shown in Supplementary Figure S1 1(a) through each end of both springs.

103
The screw is used to push down on the camera holder module while the springs and 104 bottom pin provide a counter force to push it upwards. This way the module can slide 105 along the rails with high-precision, by turning the screw. Springs provide stability and 106 push the module upwards when the screw does not provide a downward force 107 anymore, which should minimize the backslash error. 108 Secondly, the outer holes in the camera holder mount enables addition of screws 109 or bolts to attach the whole focusing module to the top of the sample stage. While the 110 focusing is done via a translation stage, the sample must be translated by hand. In our 111 setup, the FOV is large so precise translation is not required; hence, we chose to use 112 this design. However, there are 3D printed sample translation stages available in the 113 opensource community that can be integrated into our design. 114

Assembly instructions
115 Access to a 3D printer is required to print several parts required for the assembly. We 116 used Ultimaker 2+ with a nozzle size of 0.25mm for the camera holder module and 117 0.4mm for the other components. Also, the lens from the Raspberry Pi V2.0 camera 118 must be unscrewed before the assembly.
Step-by-step instructions to assemble the 119 microscope: 120 1. 3D print all the parts using a printer of your choice. We used openSCAD to 121 design, render and save the designs in .STL format. CURA software was used 122 to create the files that can be read by the Ultimaker 2+ 3D printer. Black PLA 123 filament and a 0.4mm diameter nozzle was used for printing the sample stage 124 parts, while a 0.25mm nozzle was used to print the focusing stage. Our files 125 were designed to match the tolerance of the nozzles on our printer. The 3D 126 models need to be tweaked when a different nozzle size or a different 3D 127 printer is used due to change in the tolerances. that it is stretched out and apply a strong counter-balance force to the screw.  Image acquisition codes can also be downloaded from the Links section. Various 180 python packages will need to be installed before these can be used. The packages 181 needed are: 182 • Unicornhathd 183 • Numpy 184 • Picamera 185 • Matplotlib 186 • Io 187 • Random 188 • Fractions 189 These can be installed using the pip package management system or by installing 190 anaconda on the raspberry pi. However, the picamera and unicornhathd packages are 191 not included in anaconda and will need to be installed separately. Links to the 192 installation guides of these packages and a more general guide to installing python 193 packages on the Raspberry Pi are provided in the Links section. Python2 is used for 194 image acquisition so follow instructions for Python2.7 as opposed to Python3. 195 We have also provided a cloned Raspberry Pi image which can be cloned onto 196 an SD card: 197 https://drive.google.com/open?id=1Z59lnhNKuGGGVIF1KtoCw2bAcdZESKBo. You 198 can download it and clone onto an SD card by following this tutorial 199 https://beebom.com/how-clone-raspberry-pi-sd-card-windows-linux-macos/. The 200 cloned image contains image capture codes and all the required packages pre-201 installed for easy plug-and-play operation of the microscope. 202 Data Acquisition 203 1. Connect the Raspberry Pi to a keyboard, mouse and monitor, and turn it on. 204 Supplementary Figure S2 1 Reconstructions from images obtained with a monochrome sensor (no Bayer filter) using the standard FPM algorithm. First row shows the expected ideal reconstruction and the remaining rows shows the reconstructions from datasets captured with (1) various image sampling criteria and (2) overlap between the spatial frequencies captured by any two adjacent illumination angles. Noise and aberrations are added in the simulated images to mimic the experimental conditions.