# Chapter 7. Hacking Lab Equipment

A typical biology lab is filled with dozens of machines that each function independently. Our goal is to find ways for the machines to interoperate. In this article, we will demonstrate how to create simple electronic interfaces for different kinds of devices so that they can be controlled and coordinated by a computer.

Hacking traditional lab equipment provides a way to incrementally introduce automation into your workflow. You do not need to clear out space for a large, expensive robot that might be more cumbersome than useful. You can gradually add more automation in a way that coexists with manual processes.

Automation has the potential to improve reproducibility by increasing procedural precision and providing new experimental capacity that can be allocated to validating previous results. However, the form of automation is important: an experiment designed around a $200,000 robot may not be easy for an outsider to reproduce. Instead we propose to create experiments designed around the automation of commodity hardware. For this approach to improve reproducibility, we will need good documentation. We should support equipment manufacturers that provide easy-to-use, easy-to-hack electrical and software interfaces suitable for automation. Open equipment documentation will become an important component of open science. ## Our Approach We will take a do-it-yourself, but not do-everything-yourself approach. If we spend all our time building equipment, we won’t have time to use the equipment, so rather than building devices from scratch, we’ll modify standard lab equipment. (If you’d like to build your own lab equipment from scratch, check out Tekla Labs.) We won’t yet address a big part of lab automation: liquid handling. A computer-controlled centrifuge isn’t going to do much good unless you load something into it. An automatic pipettor isn’t very useful if it is stationary. We’ll cover liquid handling in another article. Even without liquid movement, hacking these devices can be useful. You can have your computer keep a log of the parameters for every centrifuge run. You can make a semiautomated system that alternates between machine actions and human actions. You can create a computerized lab partner that guides you through a complex procedure so that the results are more consistent. Even focusing on hacking traditional lab equipment, we can consider several approaches: 1. Using servos or other actuators to turn knobs and push buttons (this is safer than other approaches because we don’t need to modify equipment internals, but engineering reliable mechanical connections is difficult) 2. Replacing the buttons and knobs with electrically controlled devices (relays, digital potentiometers) 3. Replacing the entire control system with a new control system, only keeping the mechanical components We choose option 2, since it requires the least engineering work. With sufficient care, it can be reliable and reversible. ## Safety These projects will probably void your warranties and could quite possibly destroy your equipment. You could electrocute yourself or burn down your lab building. Make sure the equipment is unplugged before you open it. Even then, proceed with caution; unplugged electronics may still hold a dangerous charge. If you buy used equipment, you should consider the possibility that it is biologically or chemically contaminated. These machines are generally not autoclavable, though some may have autoclavable components. ## Getting Started We assume that you have a soldering iron, a multimeter, and a microcontroller such as the Arduino. You can find many tutorials for these tools online. The Grove system by Seeed Studio includes various sensors and other components that can be easily attached to an Arduino. Grove devices connect with a four-conductor cable that provides power (typically 5V), ground, and two data lines. For expediency, we’ll use a combination of the Grove system and breadboarding, but the Grove system is not required; all of these circuits can be built using only wires and bare components. Additional instructions and photos for these projects are online at http://www.modularscience.com/doc. ## Hacking a Centrifuge The Revolutionary Science RS-102 is a simple, inexpensive centrifuge. A rotary switch selects between four modes: off, pulse, 6,000 RPM, and 10,000 RPM. The pulse mode will run at 10,000 RPM as long as the switch is held in that position. Inside the machine, you’ll find a large motor and a circuit board attached to the rotary switch. Use a screwdriver to pry off the switch cover. Remove the screws behind the cover to free the circuit board. Number the switch terminals 1 to 4 in clockwise order when looking at the front of the switch (Figure 7-1). Terminal 2 receives a rectified 120V AC input voltage. Terminal 3 is connected to the input when 6,000 RPM is selected. Terminals 1 and 4 are connected to the input when 10,000 RPM is selected. Solder wires to the terminals and connect them to a pair for relays. We’ll use standard Grove relays; they are rated to 15A at 120V. Make sure that your wire is also rated for this current and voltage and that the high-voltage connections to the relays are well insulated. Use digital outputs from your microcontroller to activate the relays. One output will operate the centrifuge at 6,000 RPM and the other will operate it at 10,000 RPM. Activating both relays at once is not a problem; this will simply bypass the resistors used for the slower speed, resulting in 10,000 RPM operation. When both relays are off, the manual controls will operate normally. ## Hacking a Stir Plate The Corning PC-420D is one of the most common stirring hot plates. It has two knobs on the front: one to control temperature and one to control stirring speed. Each knob also acts as an on/off switch. Inside you’ll find a few circuit boards and a motor. A metal plate on the motor functions both as a cooling fan and as part of an optical encoder that measures the speed of the motor. Our task is fairly simple: we want to have a computer turn the knobs. Fortunately, the knob connections are easily accessible on one of the internal circuit boards. Each knob has five terminals: two operating as a switch and the other three as a standard potentiometer. We will replace each switch mechanism with a relay and each potentiometer with a digital potentiometer. Viewing the board as shown in Figure 7-2, the left side of the potentiometer is low (ground) and the right side is high (about 3V). Remove the board and clip the middle lead on each potentiometer. (This can be reversed later by soldering.) Solder wires onto the back of the circuit board as shown. We will use a DS1803 dual digital potentiometer with a 10k ohm range. (The original potentiometers have a 1.3k ohm range, but we do not need a perfect match since they are acting as voltage dividers; in fact, we could probably use a digital-to-analog converter for this application.) Connect the physical potentiometer’s low, high, and wiper (middle) leads to the DS1803’s low, high, and wiper pins. Connect the GND, VCC, SDA, and SDL pins to the microcontroller (for example, using a Grove cable plugged into an${ I }^{ 2 }C$port on a Grove shield). You will also need to tie the microcontroller ground to the low end of the potentiometers. Once fully connected, the microcontroller can send${ I }^{ 2 }C\$ commands to the DS1803 to digitally turn the knobs. The original potentiometers are no longer functional.

One remaining task is determining the relationship between potentiometer values and the RPM and temperature settings. Our approach is to manually test a set of key values and perform the corresponding mapping in software. Alternatively, you could decode values from the seven-segment displays or from the control circuitry.

## Hacking an Electronic Pipette

The Eppendorf Xplorer is a standard electronic pipette. It contains a small linear actuator that drives the pipette’s aspiration and dispensing. An LCD shows a menu system for changing the pipette volume and other parameters.

To automate this device, we will have our microcontroller perform button presses. For simplicity, we use Grove relays to activate each button. Solid-state relays or transistors are reasonable alternatives. Unfortunately, the tip ejector is manual; it can be controlled electronically by adding an external linear actuator (for example, from Servo City).

To open the pipettor, first remove the tip ejection button, then carefully squeeze the sides to remove the front cover. Inside you will find two small push buttons corresponding to the up and down directions and two smaller buttons for the left and right options. Solder wires onto the up and down buttons as shown in Figure 7-3. Be careful that you don’t apply too much heat to the circuit board. Connect the wires to a pair of relays, each attached to a digital output from your microcontroller.

The up and down buttons are sufficient for triggering the aspiration and dispensing actions. If you’d also like to set the capacity electronically, add relays for the left and right buttons. This will require that the microcontroller blindly navigate the menus.

Ideally, we would obtain feedback about the current settings rather than navigating blindly. One crazy option is using computer vision software and a camera pointed at the display. A better alternative would be direct control via the pipette’s USB port, a subject for future hacking.

## Conclusion

We have described approaches that can be used to automate a variety of basic lab machines. Almost anything that is controlled by buttons and potentiometers (as opposed to mechanical levers or a computer) can be automated using these building blocks.

To apply this approach to other equipment, you’ll need to carefully determine the voltage and current levels for the original electronic controls and choose replacement electronics accordingly. Make sure that you understand the circuits before modifying them. Use a multimeter and visually follow circuit board traces. Always be especially cautious with high voltages.

Controlling lab devices is only one part of lab automation. You will likely want to add movement: loading plates, moving vials, and multi-location pipetting. You will also need software to control all of this. We’ll cover these topics in upcoming articles.