week-03-hw-lab-automation
Opentrone code
Using https://docs.opentrons.com/python-api/ and Gemini
from opentrons import protocol_api from opentrons.types import Point import math
metadata = { “protocolName”: “Fluorescent Agar Art from Coordinate Lists”, “author”: “OpenAI”, “description”: “Draws a multicolor design on agar using Opentrons from GUI coordinate lists.”, “apiLevel”: “2.15” }
mscarlet_i_points = [(-20.7, 26.1),(-20.7, 24.3),(-20.7, 22.5),(-18.9, 22.5),(-20.7, 20.7),(-18.9, 20.7),(-20.7, 18.9),(-18.9, 18.9),(-17.1, 18.9),(-20.7, 17.1),(-18.9, 17.1),(-17.1, 17.1),(-15.3, 17.1),(-18.9, 15.3),(-17.1, 15.3),(-15.3, 15.3),(-13.5, 15.3),(-18.9, 13.5),(-17.1, 13.5),(-15.3, 13.5),(-13.5, 13.5),(-11.7, 13.5),(-18.9, 11.7),(-17.1, 11.7),(-15.3, 11.7),(-13.5, 11.7),(-11.7, 11.7),(-9.9, 11.7),(9.9, 11.7),(22.5, 11.7),(24.3, 11.7),(26.1, 11.7),(-26.1, 9.9),(-17.1, 9.9),(-15.3, 9.9),(-13.5, 9.9),(-11.7, 9.9),(-9.9, 9.9),(-8.1, 9.9),(-6.3, 9.9),(8.1, 9.9),(9.9, 9.9),(11.7, 9.9),(-26.1, 8.1),(-24.3, 8.1),(-22.5, 8.1),(-15.3, 8.1),(-13.5, 8.1),(-11.7, 8.1),(-9.9, 8.1),(-8.1, 8.1),(-6.3, 8.1),(-4.5, 8.1),(-2.7, 8.1),(8.1, 8.1),(9.9, 8.1),(11.7, 8.1),(13.5, 8.1),(-24.3, 6.3),(-22.5, 6.3),(-20.7, 6.3),(-18.9, 6.3),(-13.5, 6.3),(-11.7, 6.3),(-9.9, 6.3),(-8.1, 6.3),(-6.3, 6.3),(-4.5, 6.3),(-2.7, 6.3),(-0.9, 6.3),(0.9, 6.3),(9.9, 6.3),(11.7, 6.3),(13.5, 6.3),(15.3, 6.3),(17.1, 6.3),(-22.5, 4.5),(-20.7, 4.5),(-18.9, 4.5),(-17.1, 4.5),(-15.3, 4.5),(-9.9, 4.5),(-8.1, 4.5),(-6.3, 4.5),(-4.5, 4.5),(-2.7, 4.5),(-0.9, 4.5),(0.9, 4.5),(2.7, 4.5),(11.7, 4.5),(13.5, 4.5),(15.3, 4.5),(17.1, 4.5),(-22.5, 2.7),(-20.7, 2.7),(-18.9, 2.7),(-17.1, 2.7),(-15.3, 2.7),(-13.5, 2.7),(-11.7, 2.7),(-9.9, 2.7),(-8.1, 2.7),(-6.3, 2.7),(-4.5, 2.7),(-2.7, 2.7),(-0.9, 2.7),(0.9, 2.7),(2.7, 2.7),(4.5, 2.7),(6.3, 2.7),(13.5, 2.7),(15.3, 2.7),(17.1, 2.7),(18.9, 2.7),(-18.9, 0.9),(-17.1, 0.9),(-15.3, 0.9),(-13.5, 0.9),(-11.7, 0.9),(-9.9, 0.9),(-8.1, 0.9),(-6.3, 0.9),(-4.5, 0.9),(-2.7, 0.9),(-0.9, 0.9),(0.9, 0.9),(2.7, 0.9),(4.5, 0.9),(6.3, 0.9),(8.1, 0.9),(13.5, 0.9),(15.3, 0.9),(17.1, 0.9),(18.9, 0.9),(-17.1, -0.9),(-15.3, -0.9),(-13.5, -0.9),(-11.7, -0.9),(-9.9, -0.9),(-8.1, -0.9),(-6.3, -0.9),(-4.5, -0.9),(-2.7, -0.9),(-0.9, -0.9),(0.9, -0.9),(2.7, -0.9),(4.5, -0.9),(6.3, -0.9),(8.1, -0.9),(9.9, -0.9),(15.3, -0.9),(17.1, -0.9),(18.9, -0.9),(6.3, -2.7),(8.1, -2.7),(9.9, -2.7),(15.3, -2.7),(17.1, -2.7),(18.9, -2.7),(9.9, -4.5),(11.7, -4.5),(15.3, -4.5),(17.1, -4.5),(18.9, -4.5),(11.7, -6.3),(15.3, -6.3),(17.1, -6.3),(18.9, -6.3),(11.7, -8.1),(15.3, -8.1),(17.1, -8.1),(18.9, -8.1),(11.7, -9.9),(15.3, -9.9),(17.1, -9.9),(11.7, -11.7),(15.3, -11.7),(17.1, -11.7),(11.7, -13.5),(13.5, -13.5),(15.3, -13.5),(9.9, -15.3),(11.7, -15.3),(13.5, -15.3),(9.9, -17.1)]
mko2_points = [(-11.7, 26.1),(-18.9, 24.3),(-11.7, 24.3),(-9.9, 24.3),(-11.7, 22.5),(-9.9, 22.5),(-11.7, 20.7),(-9.9, 20.7),(-8.1, 20.7),(-11.7, 18.9),(-9.9, 18.9),(-8.1, 18.9),(-9.9, 17.1),(-8.1, 17.1),(-6.3, 17.1),(-20.7, 15.3),(-9.9, 15.3),(-8.1, 15.3),(-6.3, 15.3),(-4.5, 15.3),(-8.1, 13.5),(-6.3, 13.5),(-4.5, 13.5),(-2.7, 13.5),(-8.1, 11.7),(-6.3, 11.7),(-4.5, 11.7),(-2.7, 11.7),(-0.9, 11.7),(-4.5, 9.9),(-2.7, 9.9),(-0.9, 9.9),(0.9, 9.9),(2.7, 9.9),(-0.9, 8.1),(0.9, 8.1),(2.7, 8.1),(4.5, 8.1),(6.3, 8.1),(2.7, 6.3),(4.5, 6.3),(6.3, 6.3),(8.1, 6.3),(4.5, 4.5),(6.3, 4.5),(8.1, 4.5),(9.9, 4.5),(8.1, 2.7),(9.9, 2.7),(11.7, 2.7),(9.9, 0.9),(11.7, 0.9),(11.7, -0.9),(13.5, -0.9),(11.7, -2.7),(13.5, -2.7),(13.5, -4.5),(13.5, -6.3),(13.5, -8.1),(13.5, -9.9),(13.5, -11.7)]
electra2_points = [(17.1, 17.1),(18.9, 17.1),(15.3, 15.3),(17.1, 15.3),(18.9, 15.3),(20.7, 15.3),(22.5, 15.3),(17.1, 13.5),(18.9, 13.5),(20.7, 13.5),(22.5, 13.5),(24.3, 13.5),(-18.9, -2.7),(-6.3, -2.7),(-4.5, -2.7),(-2.7, -2.7),(-0.9, -2.7),(0.9, -2.7),(2.7, -2.7),(4.5, -2.7),(-17.1, -4.5),(-15.3, -4.5),(-13.5, -4.5),(-11.7, -4.5),(-9.9, -4.5),(-8.1, -4.5),(-6.3, -4.5),(-4.5, -4.5),(-2.7, -4.5),(-0.9, -4.5),(0.9, -4.5),(2.7, -4.5),(4.5, -4.5),(6.3, -4.5),(8.1, -4.5),(-15.3, -6.3),(-13.5, -6.3),(-11.7, -6.3),(-9.9, -6.3),(-8.1, -6.3),(-6.3, -6.3),(-4.5, -6.3),(-2.7, -6.3),(0.9, -6.3),(2.7, -6.3),(4.5, -6.3),(6.3, -6.3),(-8.1, -8.1),(-2.7, -8.1),(-0.9, -8.1),(0.9, -8.1),(2.7, -8.1),(4.5, -8.1),(-6.3, -9.9),(-4.5, -9.9),(-2.7, -9.9),(-0.9, -9.9),(0.9, -9.9),(2.7, -9.9)]
azurite_points = [(13.5, 15.3),(11.7, 13.5),(13.5, 13.5),(15.3, 13.5),(11.7, 11.7),(13.5, 11.7),(15.3, 11.7),(17.1, 11.7),(18.9, 11.7),(20.7, 11.7),(13.5, 9.9),(15.3, 9.9),(17.1, 9.9),(18.9, 9.9),(15.3, 8.1),(17.1, 8.1),(-0.9, -6.3)]
mturquoise2_points = [(8.1, -6.3),(9.9, -6.3),(6.3, -8.1),(8.1, -8.1),(9.9, -8.1),(4.5, -9.9),(6.3, -9.9),(8.1, -9.9),(9.9, -9.9),(0.9, -11.7),(2.7, -11.7),(4.5, -11.7),(6.3, -11.7),(8.1, -11.7),(9.9, -11.7),(-0.9, -13.5),(0.9, -13.5),(2.7, -13.5),(4.5, -13.5),(6.3, -13.5),(8.1, -13.5),(9.9, -13.5),(-0.9, -15.3),(0.9, -15.3),(2.7, -15.3),(4.5, -15.3),(6.3, -15.3),(8.1, -15.3),(-2.7, -17.1),(-0.9, -17.1),(0.9, -17.1),(2.7, -17.1),(4.5, -17.1),(6.3, -17.1),(8.1, -17.1),(-4.5, -18.9),(-2.7, -18.9),(-0.9, -18.9),(0.9, -18.9),(2.7, -18.9),(4.5, -18.9),(6.3, -18.9),(-2.7, -20.7),(-0.9, -20.7),(0.9, -20.7),(2.7, -20.7),(4.5, -20.7),(-2.7, -22.5),(-0.9, -22.5),(0.9, -22.5),(2.7, -22.5),(4.5, -22.5),(-2.7, -24.3),(-0.9, -24.3),(0.9, -24.3),(-6.3, -26.1),(-4.5, -26.1),(-2.7, -26.1),(-0.9, -26.1),(-8.1, -27.9),(-6.3, -27.9),(-4.5, -27.9)]
sfgfp_points = [(-4.5, -20.7),(-6.3, -22.5),(-4.5, -22.5),(-9.9, -24.3),(-8.1, -24.3),(-6.3, -24.3),(-4.5, -24.3),(-11.7, -26.1),(-9.9, -26.1),(-8.1, -26.1),(-17.1, -27.9),(-15.3, -27.9),(-13.5, -27.9),(-11.7, -27.9),(-9.9, -27.9),(-15.3, -29.7),(-13.5, -29.7),(-11.7, -29.7),(-9.9, -29.7)]
DROP_VOL_UL = 1.0 DRAW_Z_MM = 1.0 TRAVEL_Z_MM = 10.0 EXTRA_ASPIRATE_UL = 2.0 MAX_BATCH_UL = 18.0 XY_SCALE = 1.0 X_OFFSET_MM = 0.0 Y_OFFSET_MM = 0.0
def run(protocol: protocol_api.ProtocolContext):
tiprack = protocol.load_labware("opentrons_96_tiprack_20ul", "1")
source_plate = protocol.load_labware("corning_96_wellplate_360ul_flat", "2")
agar_plate = protocol.load_labware("corning_6_wellplate_16.8ml_flat", "3")
p20 = protocol.load_instrument("p20_single_gen2", "right", tip_racks=[tiprack])
canvas = agar_plate["A1"]
color_sources = {
"mscarlet_i": source_plate["A1"],
"mko2": source_plate["A2"],
"electra2": source_plate["A3"],
"azurite": source_plate["A4"],
"mturquoise2": source_plate["A5"],
"sfgfp": source_plate["A6"],
}
design = [
("mscarlet_i", mscarlet_i_points),
("mko2", mko2_points),
("electra2", electra2_points),
("azurite", azurite_points),
("mturquoise2", mturquoise2_points),
("sfgfp", sfgfp_points),
]
protocol.max_speeds["X"] = 100
protocol.max_speeds["Y"] = 100
protocol.max_speeds["Z"] = 40
for color_name, points in design:
source = color_sources[color_name]
draw_points(protocol, p20, source, canvas, points, DROP_VOL_UL, DRAW_Z_MM, TRAVEL_Z_MM)
def draw_points(protocol, pipette, source, target, points, drop_vol_ul, draw_z_mm, travel_z_mm):
if len(points) == 0:
return
points_per_batch = max(1, int((MAX_BATCH_UL - EXTRA_ASPIRATE_UL) // drop_vol_ul))
pipette.pick_up_tip()
for start_idx in range(0, len(points), points_per_batch):
batch = points[start_idx:start_idx + points_per_batch]
total_asp = len(batch) * drop_vol_ul + EXTRA_ASPIRATE_UL
pipette.aspirate(total_asp, source.bottom(1.0))
pipette.air_gap(1.0)
pipette.move_to(target.top(travel_z_mm))
for x, y in batch:
target_loc = target.bottom(draw_z_mm).move(
Point(
x=(x * XY_SCALE) + X_OFFSET_MM,
y=(y * XY_SCALE) + Y_OFFSET_MM,
z=0
)
)
pipette.move_to(target_loc)
pipette.dispense(drop_vol_ul, target_loc)
pipette.move_to(source.top())
remaining = pipette.current_volume
if remaining > 0:
pipette.dispense(remaining, source.top())
pipette.drop_tip()
Ex 2, Project
- Gel dessert with different taste
- Robot that print different color and size base on <3 and bretahing pattern, detecting if you lie
- smell painting