Tutorial: Building an Inline Holographic Microscope
In this workshop, we will construct an inline holographic microscope using the UC2 modular microscope toolbox. Inline holography is a lensless imaging technique that uses coherent light interference to capture and reconstruct 3D images of transparent samples. This experiment demonstrates fundamental principles of wave optics, Fresnel diffraction, and digital image reconstruction while providing hands-on experience with modern computational imaging techniques.

Materials Needed
Optical Components:
- LED light source (preferably white LED for broad spectrum)
- Gel color filter (green or red) for quasi-monochromatic illumination
- Aluminum foil or thin metal sheet for pinhole creation
- Precision pinhole (10-50 μm diameter) or needle for custom pinhole
- Transparent samples (biological specimens, microstructures, dust particles)
Detection Equipment:
- ESP32 camera module with wide-angle lens
- Computer with WiFi capability for wireless image capture
- Optional: Higher resolution camera (HIKrobot or similar) for advanced applications
Mechanical Components:
- UC2 modular microscope toolbox (minimum 4 cubes)
- LED holder insert for UC2 cube
- Sample holder for transparent specimens
- Base plates for system stability
- Puzzle pieces for cube connections
Software and Analysis:
- Jupyter notebook environment
- Python libraries: NumPy, Matplotlib, SciPy
- OpenUC2 holographic reconstruction code
- ImSwitch software (optional for real-time processing)
Safety and Environment:
- Dark or controlled lighting environment
- Stable surface for vibration isolation
- Proper sample handling equipment
TODO: Add specific LED wavelength recommendations and optimal power levels TODO: Include computer system requirements for real-time reconstruction

Diagram

Schematic diagram showing the inline holographic microscope layout with LED source, pinhole, sample, and detector
Theory of Operation
The inline holographic microscope operates as a lensless imaging system where coherent light from a point source illuminates a transparent sample. The scattered light from the sample interferes with the unscattered reference beam directly on the detector surface, creating a holographic interference pattern. This pattern contains both amplitude and phase information about the sample, which can be computationally reconstructed to visualize the original object.
Unlike conventional microscopy that uses lenses to form images, holographic microscopy relies on digital reconstruction algorithms to focus and refocus images at different distances. This approach offers several advantages: large field of view, no optical aberrations, and the ability to focus on different depth planes post-acquisition.
Theoretical Background
Holography Principles
Holography is based on the recording and reconstruction of light wave interference patterns. In inline holography, three key wave components interact:
- Reference Wave: Unperturbed light passing through empty space
- Object Wave: Light scattered by the sample
- Interference Pattern: Superposition of reference and object waves
Fresnel Diffraction and Propagation
The propagation of light from the sample to the detector follows Fresnel diffraction theory. The complex amplitude at the detector plane is given by:
U(x,y,z) = -i/(λz) ∬ U(x',y',0) exp[ik/(2z)((x-x')² + (y-y')²)] dx'dy'
Where λ is the wavelength, z is the propagation distance, and k = 2π/λ is the wave number.
Digital Reconstruction
The reconstruction process involves numerically propagating the recorded intensity pattern back to the sample plane using the Fresnel-Kirchhoff diffraction integral. This is efficiently implemented using Fast Fourier Transform (FFT) algorithms:
- Forward FFT: Convert intensity pattern to frequency domain
- Phase Correction: Apply propagation phase factor
- Inverse FFT: Transform back to spatial domain
The propagation phase factor is: H(fx,fy,z) = exp[ikz√(1 - λ²fx² - λ²fy²)]
Limitations and Challenges
Inline holography faces several fundamental limitations:
- Twin Image Problem: Loss of phase information creates overlapping virtual images
- Limited Resolution: Bounded by pixel size and numerical aperture
- Sparse Sample Requirement: Dense samples create complex interference patterns
- Coherence Requirements: Spatial and temporal coherence affect image quality
Modern Applications
Inline holography has found applications in:
- Medical diagnostics: Blood cell analysis, malaria detection
- Environmental monitoring: Plankton and microorganism studies
- Industrial inspection: Particle size and distribution analysis
- Materials science: Thin film characterization
- Astronomical imaging: Space-based telescopy applications
TODO: Add mathematical derivations for advanced students TODO: Include specific resolution calculations for different system parameters
Tutorial: Inline Holographic Microscope Setup
Complete assembly showing all components needed for the inline holographic microscope
Step 1: Assemble the Optical Components
SAFETY INSTRUCTIONS
⚠️ GENERAL SAFETY WARNINGS:
- Handle optical components carefully to avoid scratches and contamination
- Work in controlled lighting conditions to minimize background interference
- Use proper sample handling techniques to prevent contamination
- Ensure stable mounting to prevent component movement during measurements
- Keep work area clean and organized to avoid losing small components
1.1: Prepare the Illumination Source
Create a quasi-coherent point source by:
- Insert LED into the UC2 LED holder
- Place gel color filter in front of LED (green or red recommended)
- Create a small pinhole (10-50 μm) in aluminum foil using a fine needle
- Mount the pinhole-filter assembly in the UC2 cube
Note: The pinhole size determines spatial coherence - smaller pinholes provide better coherence but reduced brightness.
1.2: Build the Base Configuration
Assemble the system with four UC2 cubes in a linear arrangement:
- Cube 1: LED source with pinhole
- Cube 2: Empty spacer cube
- Cube 3: Sample holder cube
- Cube 4: Camera detector cube
Connect all cubes with base plates for mechanical stability.
1.3: Position the Sample
Mount your transparent sample as close as possible to the camera sensor:
- Use minimal sample thickness (coverslip or thin film)
- Ensure sample is sparse (isolated particles work best)
- Avoid dense or thick samples that create complex scattering
1.4: Optimize Source-Sample-Detector Geometry
The key distances are:
- Source-to-sample distance (L1): 10-20 cm for good illumination uniformity
- Sample-to-detector distance (L2): <5 mm for high resolution
- Magnification ratio: M = L1/L2 (typically 20-100x)
TODO: Add specific distance calculations for different magnification requirements
Step 2: Electronics
2.1: ESP32 Camera Setup
- Connect ESP32 camera module to power supply
- Configure WiFi connection for wireless image capture
- Test camera functionality with basic image acquisition
- Adjust exposure and gain settings for optimal signal-to-noise ratio
2.2: Camera Software Configuration
- Connect to ESP32 web interface via WiFi
- Set image resolution (typically VGA or higher)
- Adjust compression settings (minimize JPEG artifacts)
- Test image capture and download functionality
TODO: Add specific firmware versions and configuration parameters
Step 3: Alignment and Optimization
3.1: System Alignment
- Turn on LED source and observe illumination pattern
- Check for uniform illumination across the field of view
- Ensure pinhole is properly centered and clean
- Verify camera is recording the sample area
3.2: Environmental Optimization
- Eliminate stray light: Cover system with dark enclosure
- Minimize vibrations: Use stable surface or isolation table
- Control air currents: Avoid drafts that can cause intensity fluctuations
- Thermal stability: Allow system to reach thermal equilibrium
3.3: Sample Optimization
Test with different samples to find optimal conditions:
- Start with sparse dust particles or pollen
- Progress to biological samples (cells, bacteria)
- Avoid thick or dense samples initially
Step 4: Digital Reconstruction (ImSwitch Integration)
4.1: Basic Python Reconstruction
import numpy as np
import matplotlib.pyplot as plt
from scipy.fft import fft2, ifft2
def reconstruct_inline_hologram(hologram, wavelength, pixel_size, distance):
"""
Reconstruct inline hologram using Fresnel propagation
Parameters:
hologram: 2D numpy array of intensity values
wavelength: light wavelength in meters
pixel_size: detector pixel size in meters
distance: reconstruction distance in meters
"""
# Get image dimensions
ny, nx = hologram.shape
# Create frequency coordinates
fx = np.fft.fftfreq(nx, pixel_size)
fy = np.fft.fftfreq(ny, pixel_size)
FX, FY = np.meshgrid(fx, fy)
# Calculate propagation phase factor
k = 2 * np.pi / wavelength
phase_factor = np.exp(1j * k * distance * np.sqrt(1 - (wavelength * FX)**2 - (wavelength * FY)**2))
# Apply Fresnel propagation
hologram_fft = fft2(hologram)
reconstructed_fft = hologram_fft * phase_factor
reconstructed = ifft2(reconstructed_fft)
return reconstructed
# Example usage
wavelength = 532e-9 # Green light wavelength
pixel_size = 2.4e-6 # Typical camera pixel size
distance = -0.01 # Reconstruction distance (negative for refocusing)
# Load and process hologram
img = plt.imread("hologram.png")
reconstructed = reconstruct_inline_hologram(img, wavelength, pixel_size, distance)
# Display results
plt.figure(figsize=(12, 4))
plt.subplot(1, 3, 1)
plt.imshow(img, cmap='gray')
plt.title('Original Hologram')
plt.subplot(1, 3, 2)
plt.imshow(np.abs(reconstructed), cmap='gray')
plt.title('Reconstructed Amplitude')
plt.subplot(1, 3, 3)
plt.imshow(np.angle(reconstructed), cmap='hsv')
plt.title('Reconstructed Phase')
plt.show()
4.2: ImSwitch Integration
For real-time reconstruction:
- Install ImSwitch software with holography plugins
- Configure camera connection in ImSwitch
- Set reconstruction parameters (wavelength, distances)
- Enable real-time processing for live focusing
4.3: Advanced Processing
Implement additional processing steps:
- Background subtraction: Remove illumination variations
- Noise filtering: Apply appropriate image filters
- Multi-distance reconstruction: Focus stacking for extended depth
- Phase unwrapping: Extract quantitative phase information
TODO: Add specific ImSwitch configuration files and parameters
Experiment 1: Basic Hologram Recording and Reconstruction
1.1: Capture Reference Holograms
- Start with no sample to establish background
- Record intensity pattern from pure illumination
- Note any interference fringes or artifacts
- Save reference image for background subtraction
1.2: Sample Hologram Acquisition
- Insert sparse sample (dust, pollen, or cells)
- Capture hologram showing interference fringes
- Verify sufficient contrast and fringe visibility
- Record multiple images at different positions
1.3: Basic Reconstruction
- Load hologram image into reconstruction software
- Set appropriate wavelength and distance parameters
- Perform reconstruction at the sample plane
- Compare with direct sample observation
Experiment 2: Multi-Distance Reconstruction
2.1: Focus Stacking
- Reconstruct at multiple distances around the sample plane
- Create focus stack to visualize 3D structure
- Identify optimal focus distance for each sample feature
- Generate extended depth-of-field image
2.2: 3D Visualization
- Map focused features at different depths
- Create 3D representation of sample structure
- Measure feature positions and sizes
- Compare with theoretical expectations
2.3: Resolution Analysis
- Measure resolution using known test samples
- Compare with theoretical resolution limits
- Identify factors limiting resolution
- Optimize system parameters for best performance
Experiment 3: Quantitative Analysis
3.1: Phase Imaging
- Extract phase information from complex reconstruction
- Unwrap phase data to obtain continuous values
- Convert phase to optical path differences
- Measure sample thickness or refractive index
3.2: Particle Analysis
- Use automated detection algorithms
- Measure particle sizes and positions
- Analyze size distributions
- Track particle motion (if applicable)
3.3: Comparative Studies
- Compare holographic and conventional microscopy
- Analyze advantages and limitations
- Determine optimal sample types and conditions
- Document measurement accuracy and precision
Safety Guidelines and Best Practices
General Laboratory Safety
- Clean optical surfaces carefully using appropriate lens tissues and solutions
- Handle samples properly to avoid contamination
- Store equipment safely when not in use
- Document all experimental parameters for reproducibility
Data Management
- Save raw holograms in uncompressed formats when possible
- Record all experimental parameters (distances, wavelengths, settings)
- Back up important data regularly
- Document reconstruction parameters for future reference
TODO: Add specific safety protocols for biological samples
Troubleshooting Guide
Common Problems and Solutions
Problem: No Interference Fringes Visible
Possible Causes:
- Insufficient coherence
- Poor pinhole quality
- Excessive background light
- Wrong sample-detector distance
Solutions:
- Check pinhole size and quality
- Improve light source coherence
- Better environmental light control
- Adjust geometric parameters