Miau, a microbalance autosampler

Graphical abstract

More specifically, like a previously presented autosampler [25], miau is a pick and place (pnp) machine. Its gripper has dual function: 1) to actuate forceps that handle tin capsules; 2) to grab a powder container (Fig. 1). Miau also includes a base, where two trays, one for the tin capsules, and another for the sample deposits and powder container, are fixed (Fig. 1). Finally, there is the powder container itself, which is specifically designed to deliver powder in the desired range (Fig. 1).
Linear motion is obtained by the use of linear actuators consisting in leadscrews actuated by stepper motors. The motors are controlled using a computer via a control board operating on the Marlin firmware which enables the use of G-code for motor control [8,9,11,22,10]. All movements are synchronized to a computer controlled balance (in this case, a microbalance) using the AutoIt scripting language [26]. Although home-made actuators can potentially be built [27,11], which could reduce the cost of the machine, commercially available actuators were purchased because they cost relatively little, have reliable performance, and are easier to assemble than home-made ones.
Miau performs two tasks: 1) tin capsule manipulation; 2) powder transfer. The first task, tin capsule manipulation, is done without severely deforming the capsule. This is achieved by careful and very precise (error of 0.1 mm) movement. The end effector used for this task are forceps designed for this task being done manually (Fig. 1).
The second task, powder delivery, must achieve powder transfer from the container to the tin capsule inside an acceptable range. The powder container used here has a single hole which, when the container is at rest, does not allow the passage of powder. However, when the container vibrates, powder trickles down the hole. As a general rule, the more the container vibrates, the larger the amount of powder that trickles. The container also has ''feet" which allow it to rest stable on its tray ( Fig. 1), which by its turn is also designed with grooves to allow easy vertical movement in and out of it. In the weighing procedure, vibration of the powder container is achieved by dropping it from a few mm above the tin capsule to receive the powder. Thus, this powder delivery mechanism can be classified as of ''type 1", that is, mechanically controlled powder flow (see introduction).
The tray for tin capsules was also designed in a way to facilitate manual positioning of the capsules, and reliable automated manipulation using the forceps. It is a very shallow tray, which allows for easy manipulation with the forceps (Fig. 1). Also, the upper part of each cell is in the shape of an inverted truncated cone, which facilitates the return of the tin capsule to its position when delivered by miau (Fig. 1). The tray was designed for 5 Â 9 mm tin capsules provided by Sercon (part number SC1276). Different capsules may require a different tray. Only capsules with reasonably flat bottoms can be used, and ''shallow" capsules are easier to operate than ''deep" ones (due to more favorable center of gravity). If a capsule is placed manually on a flat surface and does not stand by itself, it cannot be used for the procedure. Also, the forceps may fail to catch deformed capsules, and thus it is recommended that capsules as ''normal" as possible be used for the procedure.
A video showing miau working is presented in Supplementary Information 1.

Design files summary
Here are included all parts that need to be 3D printed. Some items need heavy infill because they are used in a linear mechanism. The others can be printed with less infill as they do not undergo heavy stress.

Making the base
Connect the drilled 20 Â 40 mm, 500 mm extrusion profiles to the 700 mm linear actuator using 20 mm M4 screws through the holes drilled in the previous section (Fig. 4). Do not fully tight the screws at this point, do it just enough for the profiles become united to the actuator.
Tighten all screws, including those connected to the 700 mm actuator, and make sure the base is level by placing it on a flat surface and adjusting any screws if necessary.

Connecting the Y and Z axes
Place the Y axis on top of the X axis (700 mm linear actuator) carrier, and attach it using M4, 8 mm screws (Fig. 6). Attach a long bracket to the remaining 200 mm linear actuator (Z axis) using 8 mm M4 screws (Fig. 7). Connect the Z axis to the Y axis carrier using 10 mm M5 screws (Fig. 8).

Making the E axis
Connect the drilled 20 Â 20 mm, 250 mm profile to the Z axis carrier using 30 mm M5 screws (Fig. 9). Washers may be necessary to ensure proper attachment of the screws.
Attach a long bracket to the bottom of the 250 mm 20 Â 20 mm profile using two M4 8 mm screws and hammer nuts (Fig. 10).
Attach the forceps to the forceps holder using cable ties (Fig. 11). Attach the forceps holder to the 50 mm 20 Â 20 mm profile using M5 screws and hammer nuts (Fig. 12). This profile was cut from a 100 mm profile, as 50 mm profiles are not often found for sale.
Attach the half gripper for powder container (already with its foam) at a position 135 mm from the profile extremity using M5 screws and nuts (Fig. 13). Attach at the 134 mm position on the opposite side the 50 mm profile with the forceps.
Attach the shaft connector to the stepper motor (Fig. 14). Attach the stepper motor to its mount using M3 screws (Fig. 15).
Connect the 100 mm leadscrew to the shaft connector ( Fig. 16): Attach a foam and a M6 20 mm screw to the linear carriage / gripper (Fig. 17). Place the linear carriage / gripper around the 10 cm leadscrew (Fig. 18). If it is stiff, make it slide around the screw a few times, and lubricate using grease.
Attach the mount to the 20 Â 20 mm, 200 mm profile using 10 mm M5 screws and hammer nuts (Fig. 19). Make sure the face of the motor is 35 mm distant from the extremity of the aluminum profile. Slide the linear carriage / gripper in the grooves of the profile. Apply grease if stiff.
Connect the E axis to the 250 mm 20 Â 20 mm profile using the long bracket (Fig. 20).

Attaching the trays to the base
The trays are attached using M5 screws (for the tin tray) and M4 screws (deposit and powder tray) and hammer nuts for both cases (Fig. 21).
The tin tray is placed on a 20 Â 40 mm, 200 mm profile, and on a 20 Â 20 mm, 250 mm profile. The deposit and powder tray is placed on a 20 Â 40 mm, 250 mm extrusion profile. The position of the deposit tray on the Y axis is related to the position of the gripper on the Z axis. When operating miau (section 6), test if when holding the powder deposit on the tray the Y position is Z for the gripper. If not, adjust the gripper position in Fig. 20 (the connection between Z and E axes).

Preparing the control board
Now miau is mostly built, and only the electronic parts need to be prepared. The first step is to prepare the control board. Here, I use MKSgen-L, a board developed for 3D printers. It comes without a firmware, which needs to be uploaded to the board.
The first step is to install the driver for the board. As I use the Windows operating system, the driver is CH340, which can be downloaded from https://sparks.gogo.co.nz/assets/_site_/downloads/CH34x_Install_Windows_v3_4.zip. Install the driver on the computer, and then connect the board to it. The computer should recognize the board.    Once the board is recognized by the computer, the firmware can be uploaded to it. The procedure consists of 3 steps: 1) download and install Arduino, available at https://www.arduino.cc/en/software; 2) download the modified Marlin package available at https://osf.io/y2hu8/ or https://doi.org/10.17605/OSF.IO/Y2HU8; 3) open the package using Arduino, select the board (find the COM port number using Device manager, for example), and upload the package to the board. The Marlin package used here is similar to the ones used in previous devices [8][9][10]22], the modifications being in the federate (maximum and default set as 2000) and acceleration (maximum and default set as 50).
Once the firmware is installed, the board can be used to control the stepper motors. Stepper motor drivers need to be attached to the board. Pay attention to the correct orientation when doing that (Fig. 22). The drivers used here are all A4988.
Place the board on top of the Z axis and fix it there using a M4 screw (Fig. 22). Connect the cables from the motors to the control board, each to its respective axis. It may be necessary to employ cable extensions from the motors to the board. Covering the cables with cable protectors can also be helpful. Connect the power supply and USB cables to the control board.  Arranging miau and the balance Arrange the miau and the balance in such a way that it is possible for the forceps to reach inside the balance chamber (Fig. 23). Remember to adjust the balance inclination after moving it (in most balances, this is done using a bubble) to obtain accurate masses.

Powder container
The powder container needs to be drilled with a fine drill to make a hole of about 0.5 mm. Drills for routers (for example, Fig. 24) have fine tips and do not brake easily. The actual hole size depends on the powder being delivered. This hole size worked for powders with particles sieved using a 0.5 mm mesh.

Motor and balance control
Motor control is done using G-code [28] via the program Hype!terminal (available from https://osf.io/y2hu8/ or https://doi.org/10.17605/OSF.IO/Y2HU8). The serial connection settings are: 115,200 for Baud rate, 8 data bits, none for parity, 1 stop bit, and none for flow control. The G-code dialect used is that for Marlin, thus including M commands [8]. The    stepper motors are controlled using the G1 command: G1 < axis><distance><speed><movement speed>. For example, the command G1X10F500 means that the motor controlling the X axis will move 10 steps at 500 steps per minute. Important: before starting sending G commands, it is necessary that the command M121 is sent (once every time connection between board and computer is stablished), so that the full range of step values (including negative ones) can be reached. The balance used here allows control using a computer. For this, a serial cable must be connected between the balance and the computer. Commands to operate the balance are available in its manual. Commands were sent to the balance using AutoIt. The library Commg.au3 and the file Commg.dll were used, and are available at https://osf.io/y2hu8/ or https://doi. org/10.17605/OSF.IO/Y2HU8.   Weighing algorithm The weighing procedure consists in a series of synchronized actions between miau and the balance (Figs. 25 and 26). This ensures that the procedure is done in a closed loop, that is, actions are not performed blindly [29]. The feedback is provided by the balance by checking the present mass at key steps.
The software controlling miau and the balance attributes the value of 1 to two variables in the code, ''deposit" and ''sample" (Fig. 26, just after start). This means that the positions to be reached at the deposit and sample trays are positions 1. For    Fig. 25). The balance checks the mass. If the value is less than an empty balance (this limit is set in the program code), then miau returns to the tray and repeats step 1 again (Fig. 26). Miau will try 5 times, with small differences in the positioning every 2 times (this level of detail is not shown in Fig. 25 or 26). If miau fails all the times, it goes to the next sample (Fig. 26). If it succeeds, it means that the sample is now on the balance dish.
At step 2 (Fig. 25), the balance checks the mass again (Fig. 26): if it is larger than that expected for an empty balance, it repeats the procedure, as this means that the tin capsule is still on the balance dish. As for step one, it tries 6 times. If it fails the 6 times, it will try to remove the tin capsule from the balance dish (clean balance in Fig. 26), and move on to the next sample. If it succeeds, it means that the tin capsule is now at the deposit.
Before step 3, the program attributes the value 0 to the variable mass in the program (Fig. 26). Then there is a check: if mass is larger than a set value, miau will perform the final steps of the procedure. As mass now is zero, and the set value must be higher than that (this is the minimum value for a useful sample; in our laboratory, 0.3 mg), the procedure follows the yes route (Fig. 26, beneath ''mass < minimum?" field). Thus, the next step will be to transfer powder to the tin capsule in the deposit (step 3, Fig. 25). Notice that this is a back and forth movement, as the deposit returns to its original position when       finished. Now it is time for step 4, that is, the transfer of the tin capsule from the deposit to the balance (Fig. 25). Again, there is a check (Fig. 26). If the balance is empty, meaning that the tin is still at the deposit, miau will try again, 5 times in total. If it fails all times, the variable deposit will be incremented by 1, and miau will move on to the next sample. From now on, all next samples will be transferred to position 2 in the deposit tray. If the same problem happens repeatedly, to the point that after position 10 in the tray is reached it happens again, the sequence is cancelled (all these actions are shown in Fig. 26). If it succeeds, it means that the tin is now on the balance dish. There is another check, then: if the current reading minus that of the empty tin (obtained in step 1) is less than the set value, the entire procedure listed in this paragraph is repeated. This is a potentially infinite loop, and as many trials can be attempted as needed until the minimum mass is achieved. This can literally take forever, so a limit is also stablished, and only five trials are allowed (Fig. 26). Once a tin capsule holding at least the minimum amount of sample is on the balance dish, miau performs step 5 (Fig. 25), which is simply returning the tin to the sample tray. As for all previous steps, there is a check here (Fig. 26), and if the balance is not empty, miau will try 5 times. If it fails, it will clean the balance and move to the next sample (this is not shown in Fig. 25, only in Fig. 26). If it succeeds, it means that the tin capsule is back at the tray (or at least not in the balance anymore) and miau moves on to the next sample.
Some movement details are not described in the general algorithm, and will be briefly mentioned only: 1) While it is possible to perform horizontal movements on the two axes (X and Y) simultaneously, it is not advisable to perform simultaneous vertical and horizontal movements. This is important to avoid collisions. Other movements are also designed to avoid collisions due to several factors. 2) Manipulation of tin capsules often results in their deformation. The main consequence is that movements must be carefully designed to avoid or adapt to these deformations. For example, tin capsules are taken from the tray at a certain vertical position, but are displaced back at a higher position. This is difference avoids the tin capsule to become squashed when being put back.

Autosampler operation
Before using the script and operating miau with the balance, it is necessary that miau has all axes at start positions, that is, zero positions in the axis coordinates (Fig. 27).
All actions described in the previous section are performed by miau (tin capsule and powder container manipulation) and the balance (weighing). Both instruments are controlled using the computer, and synchronized using AutoIt (the full script is explained in detail in Supplementary information 2). Both miau and balance must be connected to the computer using the appropriate cables. Hype!terminal must be connected to miau control board, and the COM port number for the balance must be known and listed in the AutoIt script. All positions in the script must be verified before first use; the numbers provided here (supplementary information 2) are strictly for the machine built in our lab. It is likely the values will be different for different machines. Once these positions are adjusted (by manual trial runs), the script can be run. With the design provided here, up to 100 samples can be processed in a single unattended run.  Validation and characterization

Powder selection
I have not performed a comprehensive evaluation of the powders suitable to be delivered using the powder container presented here. So far, I have observed that the mechanism works well for powders with grain size less than 0.5 mm in diameter (which can easily be achieved by means of sieving). Also, it works best with powders that do not tend make ''lumps" of smaller grains. Because of that, it is important to use only fresh, dry powder that has been stored in sealed containers, as opposed to powders that have been sitting in a humid room for example.
As a recommendation, substances provided by popular chemical suppliers, which are often used as working standards for isotope and elemental measurements, work well after sieving. I have tested glycine (G7126, Sigma Aldrich), glucose (G8270, Sigma Aldrich) and rhamnose (W373011, Sigma Aldrich). After sieving, they all work well.

Weighing precision and accuracy
The main criteria to determine whether miau performs a useful job are weighing precision and accuracy. The concern is that the automated procedure could add uncertainty to the weighing procedure. This could happen for a number of reasons, including: 1) loss of powder when placing the tin capsule on the balance dish; 2) loss of powder when transferring the tin from the balance dish to the tray; 3) intrusion of different powders when the tin capsule is left sitting on the tray; 4) damage of tin capsule resulting in change of its mass.
Visual inspection did not show evidence for any of such problems, but a verification was made by comparing performing the weighing of glycine powder both manually and automatically using miau. A total of 40 tin capsules were placed on the sample tray of miau, and it was put to work. The powder was glycine (G7126, Sigma Aldrich, previously sieved at 500 mm). In the end, 38 full capsules were obtained (a loss of 5%, common in the usage of miau), with masses between 0.3 and 1.1 mg. Another 40 samples in a similar mass range were prepared, but manually. All samples were measured for N content and isotope composition using an elemental analyzer (Flash EA, Thermo Fisher), equipped with an autosampler [10] and coupled to an isotope ratio mass spectrometer (Delta V plus, Thermo Fisher). Automated and manual samples were run at alternate batches of 10 each to avoid possible drift in the measurements.
There was error in the measurements, as evidenced by points deviating from the main regression line (Fig. 28A). These were almost certainly caused by errors when wrapping the samples after weighing, and were more common for manual than for automated samples. To determine if automated and manual weighing performed equally, the ratio between N content in glycine and the obtained peak area was compared for the two data sets. When doing this comparison, it was found that there were 3 outliers for automated samples, and 5 for manual samples (Turkey Fence method, k = 1.5). Removing these outliers, the regression lines became almost undistinguishable (Fig. 28B), indicating that both procedures performed similarly. Finally, a Student t test showed that the ratio between peak areas and N content for the samples (without the outliers) were not significantly different for the two treatments regarding the means (automated: 1.624 ± 0.032, n = 35; manual: 1.617 ± 0. 010, n = 35; p = 0.199). This shows that the procedure was accurate. It also shows it was precise, as the error in the measurements was similar for both automated and manual procedures.
Isotope measurements were also undistinguishable between the two data sets (automated: 2.0 ± 0.10, n = 38; manual: 2.0 ± 0.07, n = 40; p = 0.143; Student t test for means). These results are in accordance with the precision expected for this measurement [4]. Therefore, the test demonstrates that the automated procedure is as good as the manual one for this kind of analysis.

Efficiency and usefulness
The setup of miau for initial use is simple: the balance needs to be repositioned from its position for manual weighing, and miau placed on the sampling table. The computer setup is very simple and straightforward using the script provided here (available at https://osf.io/y2hu8/ or https://doi.org/10.17605/OSF.IO/Y2HU8; explained in Supplementary Information 2). Therefore, the balance can be easily used automatically or manually in accordance with the purpose. The fact that AutoIt is used to integrate miau to the balance means that any other balance controlled by a computer can be used with miau. This makes miau readily available to a large number of laboratories equipped with microbalances and performing stable isotope analyses. Miau is not particularly fast in its operation, typically taking about 5 min to weigh one sample. This performance is comparable to that by machines in the order of tens or hundreds of thousands of dollars (3 to 5 min per sample [1]). Manual weighing can be faster (typically 1 to 2 min for a well-trained person; it largely depends on the time the balance takes stabilizing the mass reading). However, using miau, the time a person takes dealing with the balance is only 5 s, which are used to place the tin capsule in the tray (wrapping the sample afterwards still needs to be done, but this needs to be done manually as well). Therefore, the automated procedure results in the reduction of more than 90% in the time dealing with these samples.
When measuring stable isotopes in solid samples, it is good practice to intercalate samples with standards for quality control monitoring [4,5]. Typically, 1 to 3 standards are placed every 10 to 20 samples in a sequence to monitor for drifts. Thus, in a typical run between 10 and 30% of the measurements are for standards. Since miau is best suited for standard preparation, it can be argued that using it can alleviate~20% of the sample preparation work for stable isotope measurements.
Finally, people measuring stable isotopes in solid samples are probably questioning why not employ miau to automate sample weighing, in addition to standard weighing, as proposed here. The answer is that difficulties arise when dealing with more than one substance with miau. There is the obvious possibility of cross contamination between samples. However, the largest obstacles are 1) dealing with a multitude of different materials, which will each demand a different container hole size / dropping cycle / delivery mass (some substances need around 1 mg for analysis, others around 5 mg, others 50 mg, etc.); and 2) using hundreds of containers, one for a different sample. When dealing with a single substance many times, there is only one container, while when dealing with multiple samples there is need of a container for each sample. Even if the containers could be purchased by a supplier (currently they need to be 3D printed), the work involved in storing the samples in the containers, testing them to determine the right pore size, etc, would most likely consume equivalent or even more time than simply weighing the sample directly in the balance. Thus, I cannot recommend miau for the task of weighing many different samples in a single run. Of course, it is possible that a different approach based on different powder transfer be more suitable for this task [3].

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.