Automated optimization of a flow reactor by using Bayesian algorithms and Inline NMR Monitoring

Introduction

Recent advances in laboratory automation and analytical instrumentation have opened new possibilities for accelerating reaction development, particularly in flow chemistry. Among these, the integration of real-time analytics with intelligent process control has enabled the emergence of self-optimizing reactor systems. These setups are capable of autonomously exploring reaction conditions to maximize the performance of the reactor. The core to implement self-optimization methods requires an optimization algorithm coupled to an analytical tool that monitors the reaction mixture in real time.

In this application note, we present a self-optimizing flow reactor system that integrates the Spinsolve Ultra benchtop NMR with the LabManager® and LabVision® automation tools from HiTec Zang and an Ehrfeld Micro Reaction System. Benchtop NMR spectroscopy has proven to be a powerful online analytical tool that can provide real-time insight into reaction progress. This system was used to continuously monitor and adjust the reaction conditions of a Knoevenagel-Condensation to identify optimal parameters with minimal human intervention. While the continuous microreactor setup used here offers enhanced control, faster reaction dynamics, and seamless integration of feedback for real-time optimization, it is worth mentioning that the automation system is suited as well for batch reactor setups. 

Laboratory automation system

Automation is a powerful tool in chemical research and development. Automatic and fast data acquisition provides more insight into the chemical process, experiments become far more reproducible and are easier to repeat. In addition, the data acquisition and recipe control can directly be used to document the experiments.

Since a laboratory setup can change quickly during development, the automation needs to be very flexible and quick to modify and configure. With the Labmanager® and LabVision® automation, HiTec Zang has developed a process control system specifically designed for research and development. The LabManager® is a modular system with a variety of interfaces for temperature, pressure, pH and other sensors and a wide variety of laboratory devices (pumps, thermostats, stirrers, balances, …) from a wide range of manufacturers. The modular design allows to add and change interface cards as needed. The LabVision® software is used to control and configure the Labmanager® from a PC. It provides a freely configurable user interface, data acquisition and plotting functions, recipe control and documentation tools.

Benchtop NMR

The Spinsolve 80 ULTRA from Magritek represents the latest generation of benchtop NMR technology, delivering high performance in a compact and lab-friendly format. Its exceptionally homogeneous magnetic field is central to this capability, enabling narrow signal linewidths and making it ideally suited for real-time monitoring of chemical reactions even in protonated solvents.

Specially designed for use in chemistry laboratories, the Spinsolve system combines portability and robustness. Its compact size and low weight allow installation directly inside a fume hood or next to a reaction setup, enabling seamless integration into experimental workflows. This facilitates continuous online monitoring of reaction kinetics with excellent spectral quality, sensitivity, and operational stability.

The high homogeneity of the magnetic field not only ensures superior resolution but also enables effective and straightforward solvent suppression. This is particularly advantageous when using protonated solvents, as it prevents solvent peaks from overlapping with analyte signals allowing the use of cost-effective solvents without compromising data quality. As a result, reaction intermediates, products, and by-products can be identified and quantified in real time.

Unlike traditional high-field NMR instruments, the Spinsolve does not require deuterated solvents for frequency locking, nor does it demand frequent shimming or locking procedures. This makes it especially efficient for time-sensitive applications, such as monitoring fast reactions, where rapid data acquisition is essential.

The optional Multi-X system further enhances flexibility by supporting multi-nuclear detection without the need for manual hardware adjustments when switching between nuclei. Combined with its user-friendly software and cryogen-free operation, the Spinsolve offers a low-maintenance, cost-effective, and accessible solution for high-quality NMR analysis in routine and advanced laboratory applications.

Self-optimized flow reactors

While online monitoring of reactions by benchtop NMR is becoming more and more popular, its combination with optimization algorithms has only been done by leading research groups. A commercial solution for automated reaction optimization based on benchtop NMR would allow the chemist to find the optimum reaction conditions without human intervention. As mentioned in the introduction, such a system can greatly reduce the time needed for process optimization and is the logical next step in reaction development. Therefore, Magritek and HiTec Zang are working together to support customers in setting up and developing such systems.

Experimental Setup

To demonstrate the potential of fully automated reaction optimization, a Knoevenagel reaction between salicylic aldehyde and ethyl acetoacetate was selected to produce 3-acetyl coumarin, as shown in Figure 1.

Figure 1. Knoevenagel Condensation of Salicylic aldehyde and Ethyl acetoacetate to get 3-Acetyl coumarin.

This condensation reaction is an example of the well-known organic synthesis described in 1890 by Emil Knoevenagel. It is a modified aldol condensation reaction between an aldehyde and a ketone to form a C-C bond. The basic catalyst in this reaction deprotonates the active hydrogen compound. In most cases, spontaneous dehydration results in an unsaturated product. In our case, there is an additional cyclisation to form a heterocyclic compound, the so-called coumarin.

Figure 2. Flow chart of the different components in the flow reactor on the Ehrfeld plate.

A scheme of the flow reactor setup is illustrated in Figure 2. A modular Ehrfeld microreactor system (MMRS) is used to run the reaction. Two feed lines of the reactants (dissolved in ethyl acetate) are combined in a micromixer and transferred into a capillary reactor at a constant temperature, where the reaction takes place. Afterwards, the mixture is diluted with acetone in a second mixer to prevent the precipitation of the product and it is transferred into the flow cell of the Spinsolve to analyze the conversion and the yield at the set reaction conditions. The yield measured by NMR is fed back to the automation software to calculate and set the next process condition. Then the feedback loop starts again.

In this setup, we use the external control mode of the Spinsolve to trigger the measurements. Enabling this mode allows an external software to control the Spinsolve via the Lab manager automation system. The Labmanager in this case triggers the start of a qNMR template, which is set up in advance in the Spinsolve software. By using the qNMR module, it is also possible to automatically analyze the reaction mixture without the supervision of an operator. The results are automatically passed to the Labvision® software for the detemination of the next reaction parameters, which are then programmed by Labmanager®.

Feed 1 consists of 104.5 mL (1 mol) of Salicylaldehyde and 9.88 mL (10 mol%) of Piperidine as catalyst in 1 L of Ethyl acetate. Feed 2 consists of 126.5 mL (1 mol) of Ethyl acetoacetate in 1 L of Ethyl acetate. Both starting materials are pumped via SyrDosTM syringe pumps. The flow rates of both starting materials are varied by the algorithm within the range of 0 to 1 ml/min, which changes both the ratio of the two feeds as well as the residence time. After the reactor, the mixture is diluted with a third SyrDosTM pump, using 8.0 mL (125 mmol) of Dichloromethane mixed in 1 L of Acetone. The flow rate of the third pump is set to twice the total flow rate of feeds 1 and 2. The qNMR method uses a 1D EXTENDED+ Protocol with 4 scans, 6.55 s acquisition time, 15 s repetition time and a 90-degree pulse.

Results

Figure 3. Combination of a Magritek Spinsolve® 80 Ultra with an Ehrfeld MMRS flow reactor controlled by LabManager® from HiTec Zang to follow a Knoevenagel Condensation. The setup analyses the NMR results and optimizes the reaction conditions accordingly via Bayesian optimization.

Figure 3 presents a photo of the setup, installed in a standard chemical lab with the Spinsolve, the flow reactor inside the fume hood and the Labmanager® located outside the hood. The Labmanager® controls and monitors the variable reaction conditions of the flow reactor, like pressure, temperature, and flow rate in the different areas of the flow reactor. Furthermore, it automatically triggers NMR measurements to monitor the reaction progress. For each optimization step, consecutive measurements are conducted one after the other until three consecutive measurements show no significant change in conversion and yield. At this point the system is considered to have reached a steady state. The yield data obtained is recorded and passed to the optimization algorithm, which calculates the reaction parameters to be set for the subsequent step. The new parameters are then automatically set in the reactor, enabling seamless and efficient process optimization.

Figure 4. spectra acquired for four different reaction conditions during the optimization experiment.

Figure 4 shows representative spectra acquired for four different reaction conditions during the optimization experiment. The signals of interest, which were used for the calculation of the conversion and yield are marked in their respective colours. The integral of the aromatic region from 6.6 ppm to 8.10 ppm marked in green, encompasses signals of both the starting material and the product, and is used as a reference R since the number of protons in the aromatic ring (n=4) stays unaltered during the reaction. The integral containing the aldehyde proton from the starting material salicylaldehyde (S1, blue), was set from 9.90 ppm to 10.20 ppm. The integral for the product acetylcoumarine (S2, red), the proton signal of the double bond, is set from 8.46 ppm to 8.71 ppm.

The Conversion was calculated via equation 1: 

The Yield was calculated via equation 2:

As an example, you see below the calculation of the yield for the first spectrum:

Figure 5a. Yield obtained as a function of the iteration/experiment. The trade-off between exploration and exploitation of the optimization algorithm is well shown. Figure 5b: Plot of the best achieved yield so far after each iteration done by the optimization algorithm.

Figure 5a shows a plot of the number of executed experiments (iterations) with the corresponding yield achieved in each iteration, reflecting the evaluation of successive suggestions made by the Bayesian optimization algorithm. The graph illustrates the changes in yield across iterations, with larger variations observed at the beginning and toward the end of the optimization process. Overall, the data show an upward trend in yield as more experiments are conducted. A total of 30 iterations were performed, with the highest yield reaching 59.9%.

The fluctuations in yield between iterations illustrate the inherent trade-off in the algorithm’s strategy: smaller yield changes suggest “exploitation”—refining conditions within a promising local region—while larger changes point to “exploration” of new, untested areas in search of a global optimum. Initially, the algorithm focuses on gathering information to evaluate the experimental domain. Once a promising region is identified, it intensifies its search locally through exploitation. As the optimization progresses and the overall yield improves, the algorithm shifts toward exploration to avoid becoming trapped in a local optimum. This behavior is particularly evident in Figure 5 between iterations 20 and 30, where the algorithm explores previously untested regions while approaching its maximum number of iterations and converging to a global optimum. 

Figure 5b plots the best achieved yield so far after each iteration done by the optimization algorithm. The initial experiment (iteration 1) contains a yield of around 22 %. The next iteration already improved the yield analyzed to approximately 35%. The trend of the plot shows that the yield increases with the number of iterations and asymptotically converges the global optimum yield after 25 iterations. 

Conclusion

In this work, a flow reactor from Ehrfeld, a HiTec Zang automation system, and a Magritek benchtop NMR spectrometer were successfully integrated and combined with an optimization algorithm to achieve  autonomous optimization of a Knoevenagel Condensation. The prerequisite for this setup was the implementation of continuous communication between the NMR and the automation system. The setup was able to iteratively find a high yield of 59.9% without any human intervention. 
This Application Note demonstrates the capabilities of a fully automated chemical reactor system and the benefit of combining it with online NMR. Once it is set up, the system runs without human interaction and is able to optimize the target parameter minimizing time and material. 

To Download the Full App Note CLICK HERE