computer-interfaced, servo-actuated microfluidic control

34
Computer-interfaced, Servo-actuated Microfluidic Control System for Single Cell Analysis © 2006 Scott Cromar. This work is licensed under a Creative Commons Attribution 3.0 United States License. Details on this license can be found at: http://creativecommons.org/licenses/by/3.0/us/

Upload: others

Post on 15-Nov-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer-interfaced, Servo-actuated Microfluidic Control

Computer-interfaced, Servo-actuated Microfluidic Control System for Single Cell Analysis

© 2006 Scott Cromar.

This work is licensed under a Creative Commons Attribution 3.0 United States License. Details

on this license can be found at: http://creativecommons.org/licenses/by/3.0/us/

Page 2: Computer-interfaced, Servo-actuated Microfluidic Control

2

Computer-interfaced, Servo-actuated

Microfluidic Control System for Single Cell Analysis

Scott Cromar Department of Electrical Engineering & Computer Science

University of California, Irvine

September, 2006

Mentor: Professor Mark Bachman Department of Electrical Engineering & Computer Science

University of California, Irvine

Page 3: Computer-interfaced, Servo-actuated Microfluidic Control

3

Abstract – Microfluidics and “lab-on-chips” are currently major areas of research. Integrated

chips provide many advantages over the current macroscopic methods in biological applications

such as increased throughput, better automation, reduced reagent consumption, increased

surface/volume ratios and stable laminar flows. Unfortunately, the control of flows in

microchannels has special challenges, and conventional flow control tools such as syringes or

peristaltic pumps are generally poorly adapted. In order to facilitate the further development of a

lab-on-chip system for single cell analysis, a special control system based on hydrostatic pressure

is used. The system is compact, portable, inexpensive, and computer-interfaced for precise

control and ease of use. The level of fluid in various reservoirs is changed by a computer-

controlled servo to create pressure differences. The change in fluid level causes flow through the

channels in the chip. A detailed description of the system is presented. Further development of

the system is possible and could lead to many improvements and adaptations for specific

applications.

Key Words – microfluidic control, single cell analysis, hydrostatic pressure, lab on chip.

1. Introduction

The purpose of this paper is to document the design and use of a control system that can be

implemented for the control and capture of individual cells. This was a project carried out over

two quarters at the University of California, Irvine as an undergraduate research project. Scott

Cromar was the primary researcher, who worked under the direction of Ph.D. candidate Wei Xu,

and Professor Mark Bachman, Associate Director of the Integrated Nanosystems Research

Page 4: Computer-interfaced, Servo-actuated Microfluidic Control

4

Facility (INRF) at UCI. It is part of an ongoing project in the Li/Bachman lab to develop a fast

method of single cell isolation and lysis. The system will hopefully facilitate further development

of this project.

Microfluidics and “lab-on-chips” are currently major areas of research. Integrated chips

provide many advantages over the current macroscopic methods in biological applications such

as increased throughput, better automation, reduced reagent consumption, increased

surface/volume ratios and stable laminar flows. Unfortunately, the control of flows in

microchannels has special challenges. In a microchannel the volume of fluid is very small,

generally much below 1 μL. Therefore, conventional flow control tools such as syringes or

peristaltic pumps are generally poorly adapted. Since the ratio of connection and microchannel

volumes is extremely large, small changes in the environment or control setup can create

spurious and dramatic flow changes.1,2

The proposed system was designed to overcome some of these difficulties. The goal of this

project was to design and implement an easy to use, computer-interfaced, compact, and portable,

control system that could quickly and accurately isolate a single cell to be lysed and analyzed.

The system was interfaced with an array of microfluidic channels with dimensions on the order

of 100 μm that could be observed under a microscope. The cells to be controlled were suspended

in a fluid and fed into the channels of the chip. Furthermore, the system was designed to be very

inexpensive.

2. Concept

Page 5: Computer-interfaced, Servo-actuated Microfluidic Control

5

To meet the requirements of the design, a system relying on relative heights of a fluid in two

cylindrical reservoirs was used. The primary principle behind the design is hydrostatic pressure,

or the pressure due to the weight of a fluid. This pressure is given by

ghp

where ρ is the density of the fluid; g is the acceleration due to gravity; h is the height of the fluid

column. By altering the height of the column of liquid, the pressure it creates can be changed.

Connecting the outputs of two columns of fluid together, as shown in Figure 1, will create a

pressure differential that over time will equalize as fluid flows from one column (reservoir) to

the other. When equalized, the pressure differential between the two reservoirs will be zero, and

there will be no flow.

Figure 1: Hydrostatic pressure diagram.

p

h

Flow Direction

Page 6: Computer-interfaced, Servo-actuated Microfluidic Control

6

This concept was utilized by designing a method to precisely control the heights of fluid in

the reservoirs. The idea is illustrated in Figure 2. A plunger is suspended in the reservoir, the

height of which is regulated by an actuator, such as a servo. For a plunger and reservoir with

given cross-sectional areas Aplunger and Areservoir respectively, dropping the plunger a distance Δd

into the column displaces a volume of fluid, which is forced upward a distance Δh such that

hAAdA plungerreservoirplunger )( .

Solving for Δh, the change in fluid height is given as:

)( plungerreservoir

plunger

AA

dAh

.

This results in a pressure change Δp = ρgΔh. By selecting the proper diameter and volume of

cylinder and size of plunger, and by controlling the plunger’s movement with precision, the

change in pressure can be finely controlled.

In the system used, the cross-sectional areas of the plunger and reservoirs are approximately

0.42 cm2 and 4.9 cm

2 respectively, while the minimum plunger drop distance is approximately

0.07 mm. If water is used as the fluid where ρwater ≈ 1 g/cm2, this results in a minimum fluid

height change, Δh, of 6.56 μm, and a pressure change, Δp, of 59.5 mPa. This number represents

the approximate resolution of the system as configured. Different resolutions could be obtained

be varying the parameters of the system.

Page 7: Computer-interfaced, Servo-actuated Microfluidic Control

7

Figure 2: Changing fluid height in a cylindrical reservoir with a cylindrical plunger

connected to a servo.

In order to obtain a high degree of precision, a mechanical actuation device controlled by a

computer is needed. Ideally, this would be a linear actuator that responded quickly with a high

resolution and a large range of motion, or stroke. With a large stroke there is a lot of variability

in the pressure that can be applied by the one reservoir, and with a high resolution, very small

increments in pressure can be achieved. These characteristics are essential to effectively control

the very small volume of fluid in the microchannel. Additionally, with two reservoirs working in

concert on either side of the channel, a greater pressure differential can be achieved. Relatively

large volumes of fluid are used in the reservoirs to minimize the percentage of fluid actually

moving through the microchannel. This allows constant pressure difference and flow through

channels to be approximated.

Servo

Displaced

Fluid Δh

Plunger

Δd

Aplunger

Areservoir

Page 8: Computer-interfaced, Servo-actuated Microfluidic Control

8

3. Design

3.1 Hardware

The actual design of the control system is shown in the photos in Appendix A. The reservoir

housing is constructed of acrylic because of its availability and ease of use. A rigid structure is

important to minimize vibrations or other sources of movement that could severely affect the

fluid flow in the channel. The pieces are glued together using a clear quick-setting epoxy. The

housing contains semi-circular slots where the reservoirs are held in place. The reservoirs can be

removed by removing a lockable brace. Being able to access the reservoirs easily is essential for

loading and calibrating the device. In the current design, six reservoirs are employed, but any

number could conceivable be used for a specific application.

The reservoirs themselves are 50 mL centrifuge tubes with the bottoms cut off. Plastic tube

connectors are glued into the tops of the reservoirs, and connect to the elastic tubing that

connects to the chip. The length and diameter of these tubes are kept small to limit the effect of

external forces on this volume of fluid that could adversely affect the accuracy of the device.

The plungers are made of acrylic and are designed to fit snugly into the columns to

minimize swinging and other motion. They are suspended by wires, which connect them to the

actuators.

Small servos were selected as the actuators. The servos have the advantages of being

inexpensive and very fast and of having a high resolution and very good accuracy. The

disadvantage of servos in this application is their circular motion resulting in a limited stroke and

Page 9: Computer-interfaced, Servo-actuated Microfluidic Control

9

nonlinearity. Figure 3(a) shows the particular servos that were used (GWS Naro) which have a

speed of 0.07 sec/60, and a standard 254 positions in approximately 100 of movement. The

servos are glued onto the top of the structure, and the plunger wire is attached to the servo arm so

as to maximize the range and precision.

Figure 3: (a)GWS Naro Servo. (b) Pololu 16-Servo Controller3.

The servos are managed by a 16-servo controller shown in Figure 3(b) that has a USB

computer interface. This controller provides a 0.5-microsecond resolution and a 50 Hz update

rate. This method of interface was chosen for its ease of implementation. An external power

supply provides a voltage in the range of 4.8 V to 6 V to power the servos. A generic USB cable

is used to interface the controller with the computer.

3.2 Software

(a) (b)

Page 10: Computer-interfaced, Servo-actuated Microfluidic Control

10

As stated earlier, a computer regulates the servo control. The 16-servo controller board has a

USB interface, which, when installed, appears as a serial port on the host computer. This offers

the advantage that programming is as simple as sending commands to the serial port. Further

specific information on the controller board to computer interface can be found in the references

in Appendix B.

Servo communications are simple and straightforward. The control signal to a servo consists

of a continuous stream of impulses that are 1 to 2 milliseconds long, at about 50 Hz. The length

of the pulses determines the servo position. Pulse generation is managed by the controller board,

whereas communications with the controller board is via the Mini SSC II protocol. By this

protocol, communication is established with the controller by initially setting the baud rate,

which in our case is 9600 baud. To set a servo position, a series of three byes is sent to the

controller. Byte 1 is a synchronization value of 255, byte 2 determines the servo number (0-15

for our controller), and byte 3 determines the servo position (0-254).

The software development was done in Visual Basic .NET. The actual code of the Servo

Controller program is included in Appendix C, and a screen-shot of the user interface is included

in Appendix A. A library was used called ssc05.dll available from Scott Edward’s Electronics,

Inc., containing three functions that interface with the control board: ssc_open(port,baudrate) sets

up the comm port for the specified baud rate, initializes memory for the DLL, and starts a

background thread that will update the Mini SSC via the serial port; ssc_move(servo,position)

moves the servo to position; and ssc_close() shuts down the background thread and closes the

serial port.4 The correct comm port is specified in the field labeled “comm port.”

As the goal of the control system is single cell isolation and analysis in a microchannel, or

more specifically, in a microchannel array, the software’s primary purpose is to allow easy

Page 11: Computer-interfaced, Servo-actuated Microfluidic Control

11

manipulation of fluid flows in these channels. An interface was developed that takes user input

from the arrow keys on a keyboard number pad, and changes the fluid flows and thus the cell

movement, in that same direction. For example, in one dimension (a single channel), two

reservoirs of fluid would be used, and thus two servos. When observing the channel under a

microscope in a horizontal position, one would press the left arrow key and observe that fluid

flow (and cell movement) go to the left. The right arrow key would result in movement to the

right. In the default scheme, flow would continue when the key was released and could be

adjusted by pressing the key in the opposite direction. In an alternate scheme, available by

selecting “Run Mode,” control could be calibrated so that holding down the key would cause the

flow to increase (until reaching a maximum velocity), and releasing the key would result in a

cessation of fluid movement.

In the Servo Controller program, there are six different servos represented by six scroll bars.

The position of the scroll bar represents the position of one of the servos. The position of each

servo can be adjusted individually, as would be useful in calibrating the setup to maintain a static

position of no flow. Also, two servos can be controlled simultaneously on the number pad with

any of the arrow keys. In this case each of the two servos would control fluid height in a

reservoir at opposite ends of a microchannel that would move in concert in opposite directions.

(In the convention of our device, servos 1 and 3 are controlled by the up and down keys, servos 2

and 4 are controlled by the left and right keys, and servos 5 and 6 are controlled by the 1 and 3

keys.)

In a cross-channel situation, the four servos that are controlled by the arrow keys are

arranged to allow channel flow in two dimensions that correspond to these arrows. (The

convention is that servos 1 through 4 correspond to the cardinal directions on the cross-channel

Page 12: Computer-interfaced, Servo-actuated Microfluidic Control

12

chip: 1=N, 2=E, 3=S, 4=W. See Figure 4.) The last two servos, 5 and 6, can be used for another

channel that may be present on the microfluidic chip.

Figure 4: Channel-servo connections.

To allow for more versatile operation, four memory buttons were added to the program,

each of which stores and recalls the current location of each of the six servos. Also, a “Center

All” button centers all of the servos, restoring the system to equilibrium. Further, the speed of the

servo response can be changed in two ways: one, the “Increment Speed” changes how many

steps the servo moves each time the key is depressed (or on each repeat), and two, the “Delay

Speed” sets the delay (in milliseconds) between repeated steps while the key is depressed. When

the “Run Mode” box is checked the servo positions reset to the positions stored in memory 1

(default all centered) every time a key is released.

4. Operation

1 2 3 4 5 6

1

2

3

4 Channels Microfluidic

Chip

Page 13: Computer-interfaced, Servo-actuated Microfluidic Control

13

Operation of the control system will now be described. The photos of the control system, as

well as the screen shot of the Servo Controller software found in Appendix A may be used as a

reference to the description of operation.

4.1 Setup

First the software and control board driver should be installed in the computer that will be

used for interfacing with the control system. This is done by running the Servo Controller

installer. The software is compatible only with Windows XP (or later), and may require a

download of the .NET Framework from Microsoft, if it is not already installed on the computer.

The installer will create a folder in the Start Menu with a link to the Pololu Controller Board

driver installer. This driver must be installed before the controller board will work correctly.

Once it is installed, the control system can be connected to the computer via its USB port.

Once the software is installed, correct operation of the servo is confirmed by: first,

connecting the control board to a proper power source, second, running the Servo Controller

software and setting the correct comm port (this can be found in the Device Manager), and third,

observing servo movement by pressing the number pad arrow keys on the computer.

The control system is placed as close to the chip and microscope as possible to minimize the

length of the connecting tubes. Also, it is placed at a height equal to or above that of the chip, on

a stable foundation that will minimize vibrations.

The reservoirs are filled to equal heights, and the tubes are filled by opening the valves and

draining fluid through them. This is done in a way as to eliminate any air bubbles in the line. The

chip should also be preloaded with fluid, and the connections between the chip and the tube

Page 14: Computer-interfaced, Servo-actuated Microfluidic Control

14

should be made without allowing air bubbles to enter. It is important to connect the proper

reservoir to each channel on the chip. In the typical setup the connections are made as described

in the previous section, and in Figure 4.

Once the connections are made, the valves are opened, and the system is calibrated to a

static fluid state in the chip. This can be achieved rapidly by simply observing the chip through

the microscope and pipetting small amounts of fluid into the reservoirs until no motion is

observed. At this point the system is ready for use.

The reservoirs are made to be removable from the system for easy cleanup. This is

accomplished simply by removing the locking pins and pulling out the braces (as can be seen in

the photographs of Appendix A.)

Further information on both the software and the control board can be found in their

respective documentation referenced in Appendix B.

4.2 Techniques

A few of the techniques developed in testing the system may be useful to help future users

of the control system.

As the system is limited by the servos range of motion, initial calibration must be done by

pipetting fluid into the reservoirs themselves. In most situations the ideal initial state (with all of

the servos in their center positions) is a static equilibrium in the channels. Of course, in certain

situations it may be more convenient to set the initial state to something other than static

equilibrium, such as continuous flow in one channel of an intersection.

Page 15: Computer-interfaced, Servo-actuated Microfluidic Control

15

The four memories that the software provides are used to save and recall certain states of

flow in the channels. For example, in a scenario where it is desired to sort cells, three memories

could be used. Memory one would store the state of static equilibrium that could be used to

effectively pause the process. Memory two would store the state of maximum flow from the cell

source on the right to the left in the horizontal channel, while maintaining a static state in the

upper and lower channels. Memory three would store the state of maximum flow from upper

channel to lower channel, while maintaining a static state in the left and right channels. In this

way, memories two and three could be recalled successively to find a desired cell coming from

the right, and capturing it by moving it into the lower channel.

The system requires recalibration periodically as fluid moves from one reservoir to another

with use. The necessity of frequent calibration is minimized by the relatively large volume of

fluid maintained in the reservoirs, but it is preferred in order to maintain accurate control.

“Run Mode” can be utilized to precisely and quickly control cell movement. With static

equilibrium set in memory one, the arrow keys on the number pad can be used to move a cell in

the desired direction. As described earlier, once the key is released, equilibrium will be restored.

Cells can be loaded into the chip in various ways. One simple technique that was effective in

testing was to simply close the valves, remove the tube connector from the channel into which

the cells are to be loaded, and directly pipette the cells into the chip.

5. Conclusion

The control system demonstrated an inexpensive, simple, and effective mechanism for

microfluidic control. Through the use of the system the user was able to easily capture individual

Page 16: Computer-interfaced, Servo-actuated Microfluidic Control

16

cells and precisely control their movement. Many of the design goals were met, and the system

will facilitate further development of a method of fast cell isolation and lysis.

Further development of the system could lead to many improvements. Actuators with more

liner movement and a better range of motion (stroke) would make the system more flexible and

easier to calibrate. Also, some form of feedback to the software concerning fluid flows in the

channels could make the system more powerful and further its application.

References

1. C. Fütterer, V. Bormuth, J.-H. Codarbox, J. Rossier, J.-L. Viovy, Injection and flow Control

in Microchannels, Lab Chip, 2004, 4, 351.

2. M. Hayes, N. Polson, Microfluidics. Controlling Fluids in Small Places., Analytical

Chemistry, 2001, 73, 312A.

3. www.pololu.com

4. www.seetron.com

Page 17: Computer-interfaced, Servo-actuated Microfluidic Control

17

Appendix A: Photos of the Actual Control System

Photo 1: Front view of control system apparatus

Photo 2: Rear view of control system.

Reservoir

Servo

Plastic Tube

Connector Elastic

Tubing

Controller

Board

Plunger

Page 18: Computer-interfaced, Servo-actuated Microfluidic Control

18

Photo 3: Top view of control system.

Photo 4: Control System connected to a 5.5V power supply.

Page 19: Computer-interfaced, Servo-actuated Microfluidic Control

19

Photo 5: Control board connected to the back of the control system.

Photo 6: Close up of the system design.

Locking

Pins

Removable

Braces

Page 20: Computer-interfaced, Servo-actuated Microfluidic Control

20

Photo 7: The locking pin mechanism.

Photo 8: A microfluidic chip with a two-channel intersection under a microscope. The tubes and

valves are connected to the reservoirs of the control system.

Page 21: Computer-interfaced, Servo-actuated Microfluidic Control

21

Photo 9: Servo controller program screen shot.

Appendix B: Material Sources

1. Pololu USB 16-servo controller, www.pololu.com. Driver can be found on the product page.

2. GWS Naro HP/BB servo, www.pololu.com.

3. 50ml Centrifuge tubes, www.corning.com.

4. Nalgene 8000-0006 3/32ID x 5/32OD x 1/32 Wall Tubing, www.nalgenelabware.com.

Page 22: Computer-interfaced, Servo-actuated Microfluidic Control

22

Appendix C: Servo Controller Visual Basic .NET Code

'Servo Controller for Mirofluidic Control System

'Developed for Single-cell Analysis System

'By Scott Cromar

'University of California, Irvine

'Li/Bachman Lab

'25 April 2006

Option Strict Off

Option Explicit On

Friend Class Form1

Inherits System.Windows.Forms.Form

'Makes use of the Ssc05.dll for serial communications

Private Declare Function SSC_OPEN Lib "Ssc05.dll" (ByVal commPort As Integer, ByVal baudRate As Integer) As

Integer

Private Declare Function SSC_CLOSE Lib "Ssc05.dll" () As Integer

Private Declare Function SSC_MOVE Lib "Ssc05.dll" (ByVal servo As Integer, ByVal pos As Integer) As Integer

'This vector contains the state of all keys

Dim Keys(255) As Boolean

'The step increment when you press the up or down key

Dim Speed As Short

'The repeat rate (how often the do loop repeats)

Dim DelaySpeed As Short

'Array to hold the memory values

Dim Position() As Short = New Short() {}

'Its used to stop the Do-Loop of the Form_Load

Dim StopLoop As Boolean

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Integer)

'Center all button

Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles

Command1.Click

ScrollBar1.Value = 127

ScrollBar2.Value = 127

ScrollBar3.Value = 127

Page 23: Computer-interfaced, Servo-actuated Microfluidic Control

23

ScrollBar4.Value = 127

ScrollBar5.Value = 127

ScrollBar6.Value = 127

Call SSC_MOVE(0, 127)

Call SSC_MOVE(1, 127)

Call SSC_MOVE(2, 127)

Call SSC_MOVE(3, 127)

Call SSC_MOVE(4, 127)

Call SSC_MOVE(5, 127)

End Sub

'Store 1

Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles

Command2.Click

Position(1) = ScrollBar1.Value

Position(2) = ScrollBar2.Value

Position(3) = ScrollBar3.Value

Position(4) = ScrollBar4.Value

Position(5) = ScrollBar5.Value

Position(6) = ScrollBar6.Value

End Sub

'Recall 1

Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles

Command3.Click

ScrollBar1.Value = Position(1)

ScrollBar2.Value = Position(2)

ScrollBar3.Value = Position(3)

ScrollBar4.Value = Position(4)

ScrollBar5.Value = Position(5)

ScrollBar6.Value = Position(6)

Call SSC_MOVE(0, Position(1))

Call SSC_MOVE(1, Position(2))

Call SSC_MOVE(2, Position(3))

Call SSC_MOVE(3, Position(4))

Call SSC_MOVE(4, Position(5))

Call SSC_MOVE(5, Position(6))

End Sub

'Store 2

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Position(7) = ScrollBar1.Value

Position(8) = ScrollBar2.Value

Page 24: Computer-interfaced, Servo-actuated Microfluidic Control

24

Position(9) = ScrollBar3.Value

Position(10) = ScrollBar4.Value

Position(11) = ScrollBar5.Value

Position(12) = ScrollBar6.Value

End Sub

'Recall 2

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

ScrollBar1.Value = Position(7)

ScrollBar2.Value = Position(8)

ScrollBar3.Value = Position(9)

ScrollBar4.Value = Position(10)

ScrollBar5.Value = Position(11)

ScrollBar6.Value = Position(12)

Call SSC_MOVE(0, Position(7))

Call SSC_MOVE(1, Position(8))

Call SSC_MOVE(2, Position(9))

Call SSC_MOVE(3, Position(10))

Call SSC_MOVE(4, Position(11))

Call SSC_MOVE(5, Position(12))

End Sub

'Store 3

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Position(13) = ScrollBar1.Value

Position(14) = ScrollBar2.Value

Position(15) = ScrollBar3.Value

Position(16) = ScrollBar4.Value

Position(17) = ScrollBar5.Value

Position(18) = ScrollBar6.Value

End Sub

'Recall 3

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

ScrollBar1.Value = Position(13)

ScrollBar2.Value = Position(14)

ScrollBar3.Value = Position(15)

ScrollBar4.Value = Position(16)

ScrollBar5.Value = Position(17)

ScrollBar6.Value = Position(18)

Call SSC_MOVE(0, Position(13))

Call SSC_MOVE(1, Position(14))

Call SSC_MOVE(2, Position(15))

Page 25: Computer-interfaced, Servo-actuated Microfluidic Control

25

Call SSC_MOVE(3, Position(16))

Call SSC_MOVE(4, Position(17))

Call SSC_MOVE(5, Position(18))

End Sub

'Store 4

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

Position(19) = ScrollBar1.Value

Position(20) = ScrollBar2.Value

Position(21) = ScrollBar3.Value

Position(22) = ScrollBar4.Value

Position(23) = ScrollBar5.Value

Position(24) = ScrollBar6.Value

End Sub

'Recall 4

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

ScrollBar1.Value = Position(19)

ScrollBar2.Value = Position(20)

ScrollBar3.Value = Position(21)

ScrollBar4.Value = Position(22)

ScrollBar5.Value = Position(23)

ScrollBar6.Value = Position(24)

Call SSC_MOVE(0, Position(19))

Call SSC_MOVE(1, Position(20))

Call SSC_MOVE(2, Position(21))

Call SSC_MOVE(3, Position(22))

Call SSC_MOVE(4, Position(23))

Call SSC_MOVE(5, Position(24))

End Sub

'Increment Speed Change

Private Sub Command4_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles

Command4.Click

Speed = CShort(Text1.Text)

End Sub

'Delay Speed Change

Private Sub Command5_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles

Command5.Click

DelaySpeed = CShort(Text2.Text)

End Sub

Page 26: Computer-interfaced, Servo-actuated Microfluidic Control

26

'Watches for keys being pressed, allows mutiple keys to be pressed at once

Private Sub Form1_KeyDown(ByVal eventSender As System.Object, ByVal eventArgs As

System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

Dim KeyCode As Short = eventArgs.KeyCode

Dim Shift As Short = eventArgs.KeyData \ &H10000

'The key KeyCode is pressed now...

Keys(KeyCode) = True

End Sub

Private Sub Form1_KeyUp(ByVal eventSender As System.Object, ByVal eventArgs As

System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp

Dim KeyCode As Short = eventArgs.KeyCode

Dim Shift As Short = eventArgs.KeyData \ &H10000

'Run Mode resets to store 1 when key is released

If CheckBox1.Checked = True Then

ScrollBar1.Value = Position(1)

ScrollBar2.Value = Position(2)

ScrollBar3.Value = Position(3)

ScrollBar4.Value = Position(4)

ScrollBar5.Value = Position(5)

ScrollBar6.Value = Position(6)

Call SSC_MOVE(0, Position(1))

Call SSC_MOVE(1, Position(2))

Call SSC_MOVE(2, Position(3))

Call SSC_MOVE(3, Position(4))

Call SSC_MOVE(4, Position(5))

Call SSC_MOVE(5, Position(6))

'The key KeyCode is NOT pressed now...

Keys(KeyCode) = False

Else

Keys(KeyCode) = False

End If

End Sub

'These update the scrollbar position displays

Private Sub ScrollBar1_Scroll(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs)

Handles ScrollBar1.ValueChanged

Label1.Text = ScrollBar1.Value

End Sub

Page 27: Computer-interfaced, Servo-actuated Microfluidic Control

27

Private Sub ScrollBar2_Scroll(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs)

Handles ScrollBar2.ValueChanged

Label2.Text = ScrollBar2.Value

End Sub

Private Sub ScrollBar3_Scroll(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs)

Handles ScrollBar3.ValueChanged

Label3.Text = ScrollBar3.Value

End Sub

Private Sub ScrollBar4_Scroll(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs)

Handles ScrollBar4.ValueChanged

Label4.Text = ScrollBar4.Value

End Sub

Private Sub ScrollBar5_Scroll(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs)

Handles ScrollBar5.ValueChanged

Label19.Text = ScrollBar5.Value

End Sub

Private Sub ScrollBar6_Scroll(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs)

Handles ScrollBar6.ValueChanged

Label20.Text = ScrollBar6.Value

End Sub

Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles

MyBase.Load

Speed = CShort(Text1.Text)

DelaySpeed = CShort(Text2.Text)

'Preset positions to center

ReDim Position(24)

Position(1) = 127

Position(2) = 127

Position(3) = 127

Position(4) = 127

Position(5) = 127

Position(6) = 127

Position(7) = 127

Position(8) = 127

Position(9) = 127

Position(10) = 127

Page 28: Computer-interfaced, Servo-actuated Microfluidic Control

28

Position(11) = 127

Position(12) = 127

Position(13) = 127

Position(14) = 127

Position(15) = 127

Position(16) = 127

Position(17) = 127

Position(18) = 127

Position(19) = 127

Position(20) = 127

Position(21) = 127

Position(22) = 127

Position(23) = 127

Position(24) = 127

'Shows the form

Me.Show()

'The form must handle the key events

Me.KeyPreview = True

'Opens comm port 3 as a preset

Call SSC_OPEN(3, 9600)

StopLoop = False

Do

'Just check for the keys to see

'if they are pressed. To check for more

'keys, just ask for the correct subindex

'in the "Keys" array

'The scrollbars are used to determine the servo position and its movement.

'Range of motion 0-254

'1

If Keys(System.Windows.Forms.Keys.A) And ScrollBar1.Value > ScrollBar1.Minimum + Speed Then

ScrollBar1.Value = ScrollBar1.Value - Speed

Call SSC_MOVE(0, ScrollBar1.Value)

ElseIf Keys(System.Windows.Forms.Keys.A) And ScrollBar1.Value > ScrollBar1.Minimum And Not

ScrollBar1.Value > ScrollBar1.Minimum + Speed Then

ScrollBar1.Value = 0

Call SSC_MOVE(0, ScrollBar1.Value)

End If

Page 29: Computer-interfaced, Servo-actuated Microfluidic Control

29

If Keys(System.Windows.Forms.Keys.Z) And ScrollBar1.Value < (ScrollBar1.Maximum -

ScrollBar1.LargeChange + 1) - Speed Then

ScrollBar1.Value = ScrollBar1.Value + Speed

Call SSC_MOVE(0, ScrollBar1.Value)

ElseIf Keys(System.Windows.Forms.Keys.Z) And ScrollBar1.Value < (ScrollBar1.Maximum -

ScrollBar1.LargeChange + 1) And Not ScrollBar1.Value < (ScrollBar1.Maximum - ScrollBar1.LargeChange + 1) - Speed

Then

ScrollBar1.Value = 254

Call SSC_MOVE(0, ScrollBar1.Value)

End If

'2

If Keys(System.Windows.Forms.Keys.S) And ScrollBar2.Value > ScrollBar2.Minimum + Speed Then

ScrollBar2.Value = ScrollBar2.Value - Speed

Call SSC_MOVE(1, ScrollBar2.Value)

ElseIf Keys(System.Windows.Forms.Keys.S) And ScrollBar2.Value > ScrollBar2.Minimum And Not

ScrollBar2.Value > ScrollBar2.Minimum + Speed Then

ScrollBar2.Value = 0

Call SSC_MOVE(1, ScrollBar2.Value)

End If

If Keys(System.Windows.Forms.Keys.X) And ScrollBar2.Value < (ScrollBar2.Maximum -

ScrollBar2.LargeChange + 1) - Speed Then

ScrollBar2.Value = ScrollBar2.Value + Speed

Call SSC_MOVE(1, ScrollBar2.Value)

ElseIf Keys(System.Windows.Forms.Keys.X) And ScrollBar2.Value < (ScrollBar2.Maximum -

ScrollBar2.LargeChange + 1) And Not ScrollBar2.Value < (ScrollBar2.Maximum - ScrollBar2.LargeChange + 1) - Speed

Then

ScrollBar2.Value = 254

Call SSC_MOVE(1, ScrollBar2.Value)

End If

'3

If Keys(System.Windows.Forms.Keys.D) And ScrollBar3.Value > ScrollBar3.Minimum + Speed Then

ScrollBar3.Value = ScrollBar3.Value - Speed

Call SSC_MOVE(2, ScrollBar3.Value)

ElseIf Keys(System.Windows.Forms.Keys.D) And ScrollBar3.Value > ScrollBar3.Minimum And Not

ScrollBar3.Value > ScrollBar3.Minimum + Speed Then

ScrollBar3.Value = 0

Call SSC_MOVE(2, ScrollBar3.Value)

End If

If Keys(System.Windows.Forms.Keys.C) And ScrollBar3.Value < (ScrollBar3.Maximum -

ScrollBar3.LargeChange + 1) - Speed Then

Page 30: Computer-interfaced, Servo-actuated Microfluidic Control

30

ScrollBar3.Value = ScrollBar3.Value + Speed

Call SSC_MOVE(2, ScrollBar3.Value)

ElseIf Keys(System.Windows.Forms.Keys.C) And ScrollBar3.Value < (ScrollBar3.Maximum -

ScrollBar3.LargeChange + 1) And Not ScrollBar3.Value < (ScrollBar3.Maximum - ScrollBar3.LargeChange + 1) - Speed

Then

ScrollBar3.Value = 254

Call SSC_MOVE(2, ScrollBar3.Value)

End If

'4

If Keys(System.Windows.Forms.Keys.F) And ScrollBar4.Value > ScrollBar4.Minimum + Speed Then

ScrollBar4.Value = ScrollBar4.Value - Speed

Call SSC_MOVE(3, ScrollBar4.Value)

ElseIf Keys(System.Windows.Forms.Keys.F) And ScrollBar4.Value > ScrollBar4.Minimum And Not

ScrollBar4.Value > ScrollBar4.Minimum + Speed Then

ScrollBar4.Value = 0

Call SSC_MOVE(3, ScrollBar4.Value)

End If

If Keys(System.Windows.Forms.Keys.V) And ScrollBar4.Value < (ScrollBar4.Maximum -

ScrollBar4.LargeChange + 1) - Speed Then

ScrollBar4.Value = ScrollBar4.Value + Speed

Call SSC_MOVE(3, ScrollBar4.Value)

ElseIf Keys(System.Windows.Forms.Keys.V) And ScrollBar4.Value < (ScrollBar4.Maximum -

ScrollBar4.LargeChange + 1) And Not ScrollBar4.Value < (ScrollBar4.Maximum - ScrollBar4.LargeChange + 1) - Speed

Then

ScrollBar4.Value = 254

Call SSC_MOVE(3, ScrollBar4.Value)

End If

'5

If Keys(System.Windows.Forms.Keys.G) And ScrollBar5.Value > ScrollBar5.Minimum + Speed Then

ScrollBar5.Value = ScrollBar5.Value - Speed

Call SSC_MOVE(4, ScrollBar5.Value)

ElseIf Keys(System.Windows.Forms.Keys.F) And ScrollBar5.Value > ScrollBar5.Minimum And Not

ScrollBar5.Value > ScrollBar5.Minimum + Speed Then

ScrollBar5.Value = 0

Call SSC_MOVE(4, ScrollBar5.Value)

End If

If Keys(System.Windows.Forms.Keys.B) And ScrollBar5.Value < (ScrollBar5.Maximum -

ScrollBar5.LargeChange + 1) - Speed Then

ScrollBar5.Value = ScrollBar5.Value + Speed

Call SSC_MOVE(4, ScrollBar5.Value)

Page 31: Computer-interfaced, Servo-actuated Microfluidic Control

31

ElseIf Keys(System.Windows.Forms.Keys.B) And ScrollBar5.Value < (ScrollBar5.Maximum -

ScrollBar5.LargeChange + 1) And Not ScrollBar5.Value < (ScrollBar5.Maximum - ScrollBar5.LargeChange + 1) - Speed

Then

ScrollBar5.Value = 254

Call SSC_MOVE(4, ScrollBar5.Value)

End If

'6

If Keys(System.Windows.Forms.Keys.H) And ScrollBar6.Value > ScrollBar6.Minimum + Speed Then

ScrollBar6.Value = ScrollBar6.Value - Speed

Call SSC_MOVE(5, ScrollBar6.Value)

ElseIf Keys(System.Windows.Forms.Keys.F) And ScrollBar6.Value > ScrollBar6.Minimum And Not

ScrollBar6.Value > ScrollBar6.Minimum + Speed Then

ScrollBar6.Value = 0

Call SSC_MOVE(5, ScrollBar6.Value)

End If

If Keys(System.Windows.Forms.Keys.N) And ScrollBar6.Value < (ScrollBar6.Maximum -

ScrollBar6.LargeChange + 1) - Speed Then

ScrollBar6.Value = ScrollBar6.Value + Speed

Call SSC_MOVE(5, ScrollBar6.Value)

ElseIf Keys(System.Windows.Forms.Keys.N) And ScrollBar6.Value < (ScrollBar6.Maximum -

ScrollBar6.LargeChange + 1) And Not ScrollBar6.Value < (ScrollBar6.Maximum - ScrollBar6.LargeChange + 1) - Speed

Then

ScrollBar6.Value = 254

Call SSC_MOVE(5, ScrollBar6.Value)

End If

'NumberPad Controls

'up: 8

'down: 5

'Left: 4

'Right: 6

'2nd Channel Left: 1

'2nd channel Right: 3

If Keys(System.Windows.Forms.Keys.NumPad8) And ScrollBar1.Value < (ScrollBar1.Maximum -

ScrollBar1.LargeChange + 1) - Speed And ScrollBar3.Value > ScrollBar3.Minimum + Speed Then

ScrollBar1.Value = ScrollBar1.Value + Speed

ScrollBar3.Value = ScrollBar3.Value - Speed

Call SSC_MOVE(0, ScrollBar1.Value)

Call SSC_MOVE(2, ScrollBar3.Value)

Page 32: Computer-interfaced, Servo-actuated Microfluidic Control

32

ElseIf Keys(System.Windows.Forms.Keys.NumPad8) And ScrollBar1.Value < (ScrollBar1.Maximum -

ScrollBar1.LargeChange + 1) And Not ScrollBar1.Value < (ScrollBar1.Maximum - ScrollBar1.LargeChange + 1) - Speed

And ScrollBar3.Value > ScrollBar3.Minimum And Not ScrollBar3.Value > ScrollBar3.Minimum + Speed Then

ScrollBar1.Value = 254

ScrollBar3.Value = 0

Call SSC_MOVE(0, ScrollBar1.Value)

Call SSC_MOVE(2, ScrollBar3.Value)

End If

If Keys(System.Windows.Forms.Keys.NumPad5) And ScrollBar1.Value > ScrollBar1.Minimum + Speed And

ScrollBar3.Value < (ScrollBar3.Maximum - ScrollBar3.LargeChange + 1) - Speed Then

ScrollBar1.Value = ScrollBar1.Value - Speed

ScrollBar3.Value = ScrollBar3.Value + Speed

Call SSC_MOVE(0, ScrollBar1.Value)

Call SSC_MOVE(2, ScrollBar3.Value)

ElseIf Keys(System.Windows.Forms.Keys.NumPad5) And ScrollBar1.Value > ScrollBar1.Minimum And Not

ScrollBar1.Value > ScrollBar1.Minimum + Speed And ScrollBar3.Value < (ScrollBar3.Maximum -

ScrollBar3.LargeChange + 1) And Not ScrollBar3.Value < (ScrollBar3.Maximum - ScrollBar3.LargeChange + 1) - Speed

Then

ScrollBar1.Value = 0

ScrollBar3.Value = 254

Call SSC_MOVE(0, ScrollBar1.Value)

Call SSC_MOVE(2, ScrollBar3.Value)

End If

If Keys(System.Windows.Forms.Keys.NumPad4) And ScrollBar2.Value > ScrollBar2.Minimum + Speed And

ScrollBar4.Value < (ScrollBar4.Maximum - ScrollBar4.LargeChange + 1) - Speed Then

ScrollBar2.Value = ScrollBar2.Value - Speed

ScrollBar4.Value = ScrollBar4.Value + Speed

Call SSC_MOVE(1, ScrollBar2.Value)

Call SSC_MOVE(3, ScrollBar4.Value)

ElseIf Keys(System.Windows.Forms.Keys.NumPad4) And ScrollBar2.Value > ScrollBar2.Minimum And Not

ScrollBar2.Value > ScrollBar2.Minimum + Speed And ScrollBar4.Value < (ScrollBar4.Maximum -

ScrollBar4.LargeChange + 1) And Not ScrollBar4.Value < (ScrollBar4.Maximum - ScrollBar4.LargeChange + 1) - Speed

Then

ScrollBar2.Value = 0

ScrollBar4.Value = 254

Call SSC_MOVE(1, ScrollBar2.Value)

Call SSC_MOVE(3, ScrollBar4.Value)

End If

If Keys(System.Windows.Forms.Keys.NumPad6) And ScrollBar2.Value < (ScrollBar2.Maximum -

ScrollBar2.LargeChange + 1) - Speed And ScrollBar4.Value > ScrollBar4.Minimum + Speed Then

Page 33: Computer-interfaced, Servo-actuated Microfluidic Control

33

ScrollBar2.Value = ScrollBar2.Value + Speed

ScrollBar4.Value = ScrollBar4.Value - Speed

Call SSC_MOVE(1, ScrollBar2.Value)

Call SSC_MOVE(3, ScrollBar4.Value)

ElseIf Keys(System.Windows.Forms.Keys.NumPad6) And ScrollBar2.Value < (ScrollBar2.Maximum -

ScrollBar2.LargeChange + 1) And Not ScrollBar2.Value < (ScrollBar2.Maximum - ScrollBar2.LargeChange + 1) - Speed

And ScrollBar4.Value > ScrollBar4.Minimum And Not ScrollBar4.Value > ScrollBar4.Minimum + Speed Then

ScrollBar2.Value = 254

ScrollBar4.Value = 0

Call SSC_MOVE(1, ScrollBar2.Value)

Call SSC_MOVE(3, ScrollBar4.Value)

End If

If Keys(System.Windows.Forms.Keys.NumPad1) And ScrollBar6.Value > ScrollBar6.Minimum + Speed And

ScrollBar5.Value < (ScrollBar5.Maximum - ScrollBar5.LargeChange + 1) - Speed Then

ScrollBar6.Value = ScrollBar6.Value - Speed

ScrollBar5.Value = ScrollBar5.Value + Speed

Call SSC_MOVE(5, ScrollBar6.Value)

Call SSC_MOVE(4, ScrollBar5.Value)

ElseIf Keys(System.Windows.Forms.Keys.NumPad1) And ScrollBar6.Value > ScrollBar6.Minimum And Not

ScrollBar6.Value > ScrollBar6.Minimum + Speed And ScrollBar5.Value < (ScrollBar5.Maximum -

ScrollBar5.LargeChange + 1) And Not ScrollBar5.Value < (ScrollBar5.Maximum - ScrollBar5.LargeChange + 1) - Speed

Then

ScrollBar6.Value = 0

ScrollBar5.Value = 254

Call SSC_MOVE(5, ScrollBar6.Value)

Call SSC_MOVE(4, ScrollBar5.Value)

End If

If Keys(System.Windows.Forms.Keys.NumPad3) And ScrollBar6.Value < (ScrollBar6.Maximum -

ScrollBar6.LargeChange + 1) - Speed And ScrollBar5.Value > ScrollBar5.Minimum + Speed Then

ScrollBar6.Value = ScrollBar6.Value + Speed

ScrollBar5.Value = ScrollBar5.Value - Speed

Call SSC_MOVE(5, ScrollBar6.Value)

Call SSC_MOVE(4, ScrollBar5.Value)

ElseIf Keys(System.Windows.Forms.Keys.NumPad3) And ScrollBar6.Value < (ScrollBar6.Maximum -

ScrollBar6.LargeChange + 1) And Not ScrollBar6.Value < (ScrollBar6.Maximum - ScrollBar6.LargeChange + 1) - Speed

And ScrollBar5.Value > ScrollBar5.Minimum And Not ScrollBar5.Value > ScrollBar5.Minimum + Speed Then

ScrollBar6.Value = 254

ScrollBar5.Value = 0

Call SSC_MOVE(5, ScrollBar6.Value)

Call SSC_MOVE(4, ScrollBar5.Value)

End If

Page 34: Computer-interfaced, Servo-actuated Microfluidic Control

34

'Allows for a repeat rate

Sleep((DelaySpeed))

System.Windows.Forms.Application.DoEvents()

Loop Until StopLoop

End Sub

Private Sub Form1_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As

System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

'When form unloads, close the SSC/comm port

Call SSC_CLOSE()

'Important!! To stop the loop, so the

'form can be unloaded

StopLoop = True

End Sub

'Change the Comm Port

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

'Close the open comm

Call SSC_CLOSE()

'open comm for SSC at 9600 baud.

Call SSC_OPEN(TextBox1.Text, 9600)

End Sub

End Class