๐Ÿงฉ 3.1 Pumps and Pipettes#

๐Ÿ”ฐ Tutorial#

In this module, you will develop software to:

  1. Manage a peristaltic pumpโ€™s operations using a microcontroller and motor driver

  2. Manipulate the linear actuator of the Digital Pipette

  3. Control a stepper motor for precise positioning

  4. Manage fan speed for temperature control in laboratory equipment

These skills are fundamental in creating automated liquid handling systems for various scientific applications.

Peristaltic Pump#

First, you will manage a peristaltic pumpโ€™s operations using a microcontroller and motor driver. Consider purchasing the hardware and setting it up yourself to enhance the experience. Hardware is optional for the completion of this module.

Bill of Materials#

Peristaltic pumps are the workhorses of many laboratories! ๐Ÿ‹๏ธโ€โ™€๏ธ Theyโ€™re used for precise liquid handling in various applications:

  • ๐Ÿงช Transferring chemicals in analytical chemistry

  • ๐Ÿฆ  Moving culture media in microbiology

  • ๐Ÿ’Š Dispensing precise volumes in pharmaceutical research

  • ๐ŸŒฑ Delivering nutrients in hydroponics systems

Fun fact: The pumpโ€™s mechanism mimics the peristalsis of your digestive system! ๐Ÿ˜ฎ

Demo#

โœ… Read the MDD3A DC Motor Driver datasheet

Understanding the motor driver is crucial for controlling the pump effectively.

โœ… Read PWM

Pulse-Width Modulation (PWM) is a key technique for controlling motor speed in many applications.

โœ… Read Control LED brightness with PWM

This tutorial provides a practical introduction to PWM control.

โœ… Read machine.PWM

Understanding the MicroPython PWM API is essential for implementing motor control.

Use your knowledge, the documentation above, and any relevant datasheets to set up the circuit to control the peristaltic pump. After setting up the hardware, run the following code on the microcontroller (ensure you select the appropriate PWM Pin):

from machine import Pin, PWM
from time import sleep

pwm = PWM(Pin(0))

pwm.freq(1000)

pwm.duty_u16(16384)  # 25% duty cycle
sleep(5)  # 5 seconds

pwm.duty_u16(0)  # stop the motor

You should observe the peristaltic pump turn on for five seconds.

sparks-baird/self-driving-lab-demo

Expanded Applications ๐Ÿš€#

  • ๐Ÿบ Craft breweries use peristaltic pumps for precise ingredient dosing

  • ๐Ÿฅ In hospitals, theyโ€™re crucial for IV drug delivery systems

  • ๐ŸŒˆ Theyโ€™re even used in fountain displays for creating colorful water shows!

Digital Pipette#

Next, you will control the linear actuator of the โ€œDigital Pipetteโ€ to carry out precise dispensing.

Bill of Materials#

Based on ac-rad/digital-pipette

Digital pipettes are the unsung heroes of precise liquid handling! ๐Ÿฆธโ€โ™€๏ธ Theyโ€™re essential in:

  • ๐Ÿงฌ Molecular biology for DNA/RNA work

  • ๐Ÿ”ฌ Preparing samples for microscopy

  • ๐Ÿงซ Setting up PCR reactions

  • ๐Ÿ“Š Preparing standard solutions for calibration curves

Did you know? Digital pipettes can be more accurate than traditional glass pipettes, especially for very small volumes! ๐ŸŽฏ

Demo#

โœ… Read Digital pipette: open hardware for liquid transfer in self-driving laboratories

โœ… Read the Digital Pipette GitHub README

Understanding the open-source implementation is crucial for customization and troubleshooting.

AccelerationConsortium/ac-training-lab

Run the following code on your microcontroller:

import utime
from machine import PWM, Pin

# Setup PWM
pwm = PWM(Pin(0))  # Use the appropriate GPIO pin
pwm.freq(50)  # 50 Hz frequency


def set_position(pulse_ms):
    duty = int((pulse_ms / 20.0) * 65535)
    pwm.duty_u16(duty)


# Example to set the actuator to different positions
set_position(1.1)  # Almost full retraction
utime.sleep(5)
set_position(1.9)  # Almost full extension

pwm.deinit()  # Deinitialize PWM

Cool Uses ๐Ÿ˜Ž#

  • ๐Ÿซ Chocolatiers use them for adding precise amounts of flavoring

  • ๐ŸŽจ Artists employ them for mixing exact paint colors

  • ๐Ÿง Bakers use them for adding food coloring or extracts in precise amounts

Stepper Motor#

You will use a stepper motor driver to control the position of a stepper motor.

Bill of Materials#

Stepper motors are the precision dancers of the motor world! ๐Ÿ’ƒ Theyโ€™re used in:

  • ๐Ÿ–จ๏ธ 3D printers for precise nozzle movement

  • ๐Ÿ”ญ Telescope mounts for tracking celestial objects

  • ๐Ÿค– Robotic arms for accurate positioning

  • ๐Ÿ“ท Camera systems for smooth panning and tilting

Cool fact: Some high-end watches use stepper motors for moving the hands! โŒš

Demo#

โœ… Read specs for Tic500 Stepper Motor Driver

โœ… Read Example IยฒC code for MicroPython

โœ… Read datasheet for NEMA 17 Stepper Motor

โœ… Browse ticlib GitHub repo

Run the following on your microcontroller:

# Import necessary modules
from machine import I2C
from ticlib import TicI2C, MachineI2CBackend
from time import sleep

# Initialize I2C peripheral and specify the address of the Tic device
i2c = I2C(1)
address = 14

backend = MachineI2CBackend(i2c, address)
tic = TicI2C(backend)

tic.halt_and_set_position(0)
tic.energize()
tic.exit_safe_start()

target_position = 500
tic.set_target_position(target_position)

# Wait until the motor reaches the target position
while tic.get_current_position() != tic.get_target_position():
    sleep(0.1)

tic.deenergize()
tic.enter_safe_start()

Unexpected Applications ๐ŸŽญ#

  • ๐ŸŽฐ Slot machines use them for spinning reels

  • ๐ŸŽน Electronic musical instruments for key action

  • ๐Ÿš— Some car headlights use them for adaptive lighting systems

Fan Control#

Temperature control is crucial in many lab setups! ๐ŸŒก๏ธ Fan controllers help in:

  • ๐ŸงŠ Maintaining precise temperatures in incubators

  • ๐Ÿ’ป Cooling sensitive electronic equipment

  • ๐Ÿ”ฅ Managing heat in chemical reactions

  • ๐ŸŒฟ Controlling airflow in plant growth chambers

Did you know? Some advanced fan controllers can adjust fan speed based on multiple temperature sensors, creating temperature zones! ๐ŸŒก๏ธ๐ŸŒก๏ธ๐ŸŒก๏ธ

Creative Uses ๐ŸŽจ#

  • ๐Ÿท Wine cellars use them for maintaining optimal storage conditions

  • ๐ŸŽธ Musicians use them in amplifiers to prevent overheating during performances

  • ๐ŸŽ๏ธ Racing simulators use them to create realistic airflow sensations!

Bill of Materials#

Demo#

../../_images/fan-control-mwe.png

Minimal working example set up of fan control.#

../../_images/fan-wiring.png

Rough electrical diagram of control board.#

โœ… Read Adafruit EMC2101 I2C

โœ… View MicroPython_EMC2101

Run the following on your microcontroller:

from machine import Pin, I2C
import time
from EMC2101 import EMC2101

# Constants
PIN_I2C0_SDA = Pin(8)
PIN_I2C0_SCL = Pin(9)
I2C0_FREQ = 400_000
DESIRED_SPEED = 50  # Set desired fan speed percentage (0 to 100)

# Initialize I2C bus
i2c = I2C(0, scl=PIN_I2C0_SCL, sda=PIN_I2C0_SDA, freq=I2C0_FREQ)
print(f"I2C Bus Initialized! Devices found: {i2c.scan()}")

# Initialize fan controller
fan_controller = EMC2101(i2c)
print("Fan controller object created")

# Set fan speed
fan_controller.set_duty_cycle(DESIRED_SPEED)
actual_speed = fan_controller.get_duty_cycle()

print(f"Speed set to {DESIRED_SPEED}%")
print(f"Actual speed is {actual_speed}%")
print(f"Actual RPM is {fan_controller.get_fan_rpm()} RPM")

# Monitor fan speed
while True:
    time.sleep(5)
    print(f"Monitoring Fan:")
    print(f"  Actual speed is {fan_controller.get_duty_cycle()}%")
    print(f"  Actual RPM   is {fan_controller.get_fan_rpm()} RPM")

Additional Resources#

๐Ÿš€ Quiz#

๐Ÿ“„ Assignment#