OpenFlexure Microscope OpenSCAD docs

libs/optics_configurations.scad

function rms_optics_camera_rotation(camera_type)
[Source]
function rms_optics_camera_rotation(camera_type) = let(
    rotations_dict = [["picamera_2", 45],
                      ["m12", 0],
                      ["logitech_c270", -45],
                      ["arducam_b0196", 45]]
) key_lookup(camera_type, rotations_dict);

Return the rotation angle for a camera type used in rms optics

camera_type:String defining the camera type

Returns:Angle to rotate the camera

function rms_f50d13_config(
    camera_type="picamera_2",
    beamsplitter=false,
    parfocal_distance=45,
    camera_rotation=undef,
    beamsplitter_rotation=0
)
[Source]
function rms_f50d13_config(camera_type = "picamera_2", beamsplitter=false, parfocal_distance=45, camera_rotation=undef, beamsplitter_rotation=0) = let(
    // if the parfocal distance is undefined, use the default.
    parfocal_distance_validated = (parfocal_distance == undef) ? 45 : parfocal_distance,
    // if parfocal distance is the default 45mm, the lens is 8.5mm below the objective.
    // if a shorter parfocal distance is used, we increase that distance, to stop the camera module
    // from rising up inside the microscope.
    lens_objective_distance = max(45 - parfocal_distance_validated, 0) + 8.5,
    // If the camera_rotation is undefined, use the default RMS rotation for this camera.
    camera_rotation_validated = (camera_rotation == undef) ? rms_optics_camera_rotation(camera_type) : camera_rotation,
    config_dict = [["optics_type", "RMS"],
                   ["camera_type", camera_type],
                   ["tube_lens_ffd", 47],
                   ["tube_lens_f", 50],
                   ["tube_lens_r", 12.7/2+0.1],
                   ["objective_parfocal_distance", parfocal_distance_validated],
                   ["beamsplitter", beamsplitter],
                   ["gripper_t", 1],
                   ["is_finite_conjugate", true],
                   ["objective_mechanical_tube_length", 160],
                   ["lens_objective_distance", lens_objective_distance],
                   ["camera_rotation", camera_rotation_validated], // camera rotation about z
                   ["beamsplitter_rotation", beamsplitter_rotation]]
) config_dict;

Return a dictionary of parameters for defining a finite conjugates RMS optics module

camera_type:String defining the camera type

beamsplitter:Boolean for adding a beamsplitter module

parfocal_distance:Parfocal distance for the microscope objective (mm)

camera_rotation:The angle of the camera mount (for PiCamera v2 the ribbon cable exits at 180 degrees from mount for '0' & 135 degrees from mount for '45')

beamsplitter_rotation:The angle of the block to hold the fl cube (0 for the fl cube exiting at 180 degree from the mount and -60 for the fl cube exiting at 120 from the mount)

Returns:optics configuration dictionary

function rms_infinity_f50d13_config(
    camera_type="picamera_2",
    beamsplitter=false,
    parfocal_distance=undef,
    camera_rotation=0,
    beamsplitter_rotation=0
)
[Source]
function rms_infinity_f50d13_config(camera_type = "picamera_2", beamsplitter=false, parfocal_distance=undef, camera_rotation=0, beamsplitter_rotation=0) = let(
    finite_config = rms_f50d13_config(camera_type, beamsplitter, parfocal_distance, camera_rotation, beamsplitter_rotation),
    replacements = [["is_finite_conjugate", false]]
) replace_multiple_values(replacements, finite_config);

Return a dictionary of parameters for defining an infinite conjugates RMS optics module

camera_type:String defining the camera type

beamsplitter:Boolean for adding a beamsplitter module

parfocal_distance:Parfocal distance for the microscope objective (mm)

camera_rotation:The angle of the camera mount (for PiCamera v2 the ribbon cable exits at 180 degrees from mount for '0' & 135 degrees from mount for '45')

beamsplitter_rotation:The angle of the block to hold the fl cube (0 for the fl cube exiting at 180 degree from the mount and -60 for the fl cube exiting at 120 from the mount)

Returns:optics configuration dictionary

function pilens_config(camera_type="picamera_2", upright=false)
[Source]
function pilens_config(camera_type = "picamera_2", upright=false) = let(
    rotation = upright ? 45+180 : 45,
    message = upright ? "upright" : "",
    config_dict = [["optics_type", "spacer"],
                   ["camera_type", camera_type],
                   ["lens_r", 3],
                   ["parfocal_distance", (3+1)], // For a lens spacer, this is the full lens thickness plus the working distance
                   ["lens_h", 2.5], // For a lens spacer this is the lens thickness to be gripped
                   ["lens_spacing", 17], // Minimum 17 for spacer to build correctly
                   ["mounting_post_height",4],
                   ["board_thickness",1],
                   ["rotation", rotation], // camera rotation about z
                   ["message", message]]
) config_dict;

Return a dictionary of parameters for defining a lens spacer module for a Pi Camera v2

camera_type:String defining the camera type

upright:Boolean to select values for using on an upright microscope

Returns:optics configuration dictionary

function c270lens_config(camera_type="logitech_c270")
[Source]
function c270lens_config(camera_type = "logitech_c270") = let(
    config_dict = [["optics_type", "spacer"],
                   ["camera_type", camera_type],
                   ["lens_r", (11.6/2)],
                   ["parfocal_distance", (6+1)], // For a lens spacer, this is the full lens thickness plus the working distance
                   ["lens_h", 4], // For a lens spacer this is the lens thickness to be gripped
                   ["lens_spacing", 17], // Minimum 13 for spacer to build correctly
                   ["mounting_post_height",4],
                   ["board_thickness",1],
                   ["rotation", 180], // camera rotation about z
                   ["message", "C270"]]
) config_dict;

Return a dictionary of parameters for defining a lens spacer module for a Logitech C270 webcam

camera_type:String defining the camera type

Returns:optics configuration dictionary

function b0196lens_config(camera_type="arducam_b0196")
[Source]
function b0196lens_config(camera_type = "arducam_b0196") = let(
    config_dict = [["optics_type", "spacer"],
                   ["camera_type", camera_type],
                   ["lens_r", 3],
                   ["parfocal_distance", (3+1)], // For a lens spacer, this is the full lens thickness plus the working distance
                   ["lens_h", 2.5], // For a lens spacer this is the lens thickness to be gripped
                   ["lens_spacing", 17], // Minimum 17 for spacer to build correctly
                   ["mounting_post_height",4],
                   ["board_thickness",1],
                   ["rotation", -45], // camera rotation about z
                   ["message", "B0196"]]
) config_dict;

Return a dictionary of parameters for defining a lens spacer module for an Arducam B0196 USB camera

camera_type:String defining the camera type

Returns:optics configuration dictionary