Lab Manager | Run Your Lab Like a Business

A Scripting Approach to Automation

Laboratory automation enhances productivity and safety, while minimizing costs and errors.

by Matheus C. Carvalho
Register for free to listen to this article
Listen with Speechify
0:00
5:00

a scripting approach to lab automation

It is common knowledge that automation technology has advanced extraordinarily fast, with entire industry segments being completely automated decades ago. Some laboratories make full use of automation, which enables them to achieve extreme productivity. However, many laboratories still have not adopted automation, mostly due to the high cost of standard automated laboratory instruments. The situation is aggravated by the lack of compatibility between instruments made by different manufacturers, which reduces opportunities for price reduction fueled by competition.

The problem of lack of compatibility between laboratory instruments has been recognized since the 1990s. It has prompted some groups of laboratory professionals (see, for example, the Standardization in Lab Automation and Clinical and Laboratory Standards Institute initiatives) to propose the standardization of laboratory instruments. The reason is that standardized instruments would be compatible with each other. However, standardization involves considerable costs for instrument manufacturers and end-users, and thus standardization has achieved only limited success to improve instrument compatibility, a situation that will probably not change in the next few years.

Related Webinar: Automation for Improved Results and Reproducibility

Fortunately, it is not necessary to wait for standardization in order to cope with the lack of compatibility between instruments. It is possible, today, to buy an instrument from company A and combine it with another from company B. And you do not need to be a technical wiz to do it—all you need is to learn about scripting.

The scripting approach to instrument integration

The technology that enables unrestricted compatibility between laboratory instruments is scripting, a variation of computer programming. Among scripting languages, AutoIt stands out as probably the most useful for integrating laboratory instruments because it enables automation of mouse clicks and keyboard entries. AutoIt has been developed and perfected since 1999, and it is entirely free.

Figure 1: The usual approach to instrument integration in the laboratory. Adapted from: Carvalho, 2016. Practical Laboratory Automation: Made Easy with AutoIt. Wiley VCH.
Figure 2: The scripting approach to instrument integration in the laboratory. Adapted from: Carvalho, 2016. Practical Laboratory Automation: Made Easy with AutoIt. Wiley VCH.

The main difference between the traditional approach for instrument integration and the one based on scripting is the way information is exchanged between instruments. In the traditional way, instruments send signals to each other (Figure 1). With scripting, instruments do not send signals to each other at all; instead, a computer (or more than one computer in a network) controls all instruments (Figure 2), and sends commands to them in an orderly fashion. Therefore, it is not necessary that the manufacturer of a certain instrument design this instrument with capabilities to communicate with other instruments: the only thing that is necessary is that the instrument can be controlled by a computer, which is a default capability in almost all instruments nowadays. Therefore, nothing extra is needed from the manufacturer’s side (compare this to standardization, which could demand a complete overhaul of the production process).

Also, scripting is very accessible for the user. No knowledge of electronics or low-level computing is necessary. In fact, scripting is probably the easiest kind of programming that exists. Controlling different instruments using the AutoIt scripting language can be very simple; for example, the instruction “MouseClick,” which, as the name implies, executes a mouse click. Another instruction, “Send,” sends keyboard entries. These instructions can be called at spaced intervals (determined by the instruction “Sleep”) and at different coordinates on the computer screen. Therefore, the synchronization of two or more graphical interfaces, each controlling a different instrument, can be easily and intuitively enabled. This means that laboratory technicians and scientists can develop solutions for their instrument compatibility problems without the need for advanced technical support.

Related Article: What You Need to Know When Buying an Automated Liquid Handling System

More sophisticated control is also possible with AutoIt. For example, signals on the screen, like a popup window displaying “Waiting” or a button that is normally green but becomes red if a certain condition arises, can be incorporated into the coding, thus enabling interactive scripting. In addition to that, control of interfaces without direct use of the mouse and/or keyboard is also possible, thereby freeing the computer for multitasking. Finally, even remote synchronization is possible through the Internet. These and other more advanced solutions can be implemented after a deeper study of AutoIt.

Examples of applications

Scripting is part of the daily routine in the laboratory where I work, and has enabled the staff to save time and the laboratory money. Below are some examples, which hopefully will make it clearer how scripting can be useful.

Low-cost autosamplers for liquids

Figure 3: A low-cost robotic arm used as an autosampler for liquid samples.Nowadays, there is a wide availability of precise and low-cost (costing less than $1,000) automated devices. These can easily replace autosamplers, which often make up a significant portion of the total cost of an analytical setup. For example, in our lab we demonstrated that a low-cost robotic arm kit (Figure 3) can be successfully employed for a variety of water analyses, including titration, elemental, and isotopic measurements. No disadvantage was observed when compared to the standard, and much more expensive, alternatives.

The main obstacle to using a robotic arm as an autosampler is that programming it can be difficult, because the movements of the arm are circular. This demands advanced geometric treatment or, alternatively, empirical, trial-and-error-based movement creation. However, the increase in availability of low-cost, easy-to-program robotic arms has been very fast, and alternatives exist that can potentially overcome these difficulties.

Related Article: Automated Cell-Based Assay Workflows

Figure 4: A low-cost CNC router used as an autosampler for liquid samples.Alternatively, devices that employ G-code (a machine control language developed for industrial automation in the 1950s), such as 3-D printers and computer numeric control (CNC) routers, are much easier to program because their movements are linear. In our laboratory, we could use a CNC router to replace the autosampler of a water analyzer (Figure 4). The autosampler was going to take several days to be fixed, and by using the CNC router we could finish the measurements in a timely fashion.

Extending the life of older equipment

It is common in many laboratories for older equipment to be abandoned as newer instruments are bought. However, not all older equipment is necessarily useless. It can happen, for example, that older analytical setups have their analytical components damaged beyond economically justifiable repair, but their sampling apparatuses still work perfectly. In such cases, it can be possible to adapt the sampling mechanism of a device to a different one.

Our laboratory has a water analyzer that was designed for manual-only operation. However, there were many samples to be processed for sampling-intensive studies. Another water analyzer made by a different manufacturer, which was broken, had an autosampler that was functioning. We connected the sampling line of the working water analyzer to the autosampler of the older analyzer and made them work together using AutoIt. This way, we could measure hundreds of samples automatically. By enabling automation at essentially zero cost, this setup maximized the return on the investment on the older machine, besides obviously freeing up time of technicians and students for more productive tasks.

Simplifying integration

Some instruments are built with integration in mind, but demand that the user learns advanced features regarding the operation of the devices. AutoIt can be employed to substitute these features, without any change in functionality. The advantage is that the user does not need to learn a new set of commands, and sometimes a new scripting language, that works only for that specific piece of equipment. Instead, using AutoIt, the user can employ familiar instructions that are useful for any kind of equipment. In our laboratory, we used AutoIt to integrate some chromatographic accessories to our main analyzers. We could have employed the standard scripting language of the software controlling the analyzers, but this would demand that someone studied this language. Since we were already familiar with AutoIt, we solved the problem without needing to devote much time to the task.

Enabling automation for nonautomated devices

AutoIt can also be used without integration in mind. Not all instruments are designed with automation in mind, and AutoIt is perfect to implement automation in these cases. For example, we automated the software interface of a dissolved inorganic carbon analyzer in water so that every 15 minutes water was sampled from a reservoir, thus enabling continuous and unattended monitoring. This way, the changes in carbon chemistry due to algal activity during a bloom could clearly be observed without the need for manual sampling. Again, using a trivially easy procedure, and at zero cost, we conducted an experiment that previously would demand a “happy” student working overnight.

Scripting is good for manufacturers too

So far I have outlined some benefits of scripting for users. However, manufacturers can also benefit from scripting. First, with scripting, manufacturers do not need to worry about developing integration solutions for their instruments. This way, they can focus on what they do best. Second, smaller players start to have a real chance to compete with the bigger players. When offering a product to a customer, a seller can explain that there are no real compatibility issues between the instruments and that they can easily work together. Sellers can also explain that their instrument was originally designed to be used manually, but that automation can easily be enabled by means of scripting and a low-cost automated device, for example. Savvy instrument suppliers can benefit from many new opportunities that can arise with the use of scripting in laboratories.

Democratization of science

Scripting is useful by itself, but it can also be framed in the broader context of the democratization of science, because it helps tear down walls that hamper scientific progress. Together with crowdfunding and open source hardware, nothing short of a revolution of how science is currently practiced can be expected.

Crowdfunding helps anyone with a good idea try to make it real. Open source hardware lowers the cost of devices by more than 90 percent of the cost just a few years ago. Scripting makes any devices work together, regardless of their brands. This all means that even the most modest laboratories, be them in a garage or in a poor university in a third-world country, have easier access to advanced technology that enables scientific discovery.

These are exciting times for scientists. These are times of the democratization of science.