Closed‐Loop Optimization of Soft Sensor Morphology Using 3D Printing of Electrically Conductive Hydrogel

Soft sensing technologies provide a novel alternative for state estimation in wearables and robotic systems. They allow one to capture intrinsic state parameters in a highly conformable manner. However, due to the nonlinearities in the materials that make up a soft sensor, it is difficult to develop accurate models of these systems. Consequently, design of these soft sensors is largely user defined or based on trial and error. Since these sensors conform and take the shape of the sensing body, these issues are further exacerbated when they are installed. Herein, a framework for the automated design optimization of soft sensors using closed‐loop 3D printing of a recyclable hydrogel‐based sensing material is presented. The framework allows direct printing of the sensor on the sensing body using visual feedback, evaluates the sensor performance, and iteratively improves the sensor design. Following preliminary investigations into the material and morphology parameters, this is demonstrated through the optimization of a sensorized glove which can be matched to specific tasks and individual hand shapes. The glove's sensors are tuned to respond only to particular hand poses, including distinguishing between two similar tennis racket grip techniques.


Introduction
[3][4] They provide a route to sensorize arbitrarily shaped bodies conformably without affecting their natural dynamics.Numerous technologies and novel smart materials are used to design these soft sensors, including channels of conductive liquids, [5] elastomeric composites with conductive fillers, [6,7] conductive yarn, [8] embedded air channels, [9] capacitive technologies, [10,11] and optical sensing. [12,13]However, almost all these soft sensing technologies suffer from complex nonlinear properties, making them difficult to model.Additionally, as these sensors conform to the body of the user or the robot, their behavior is further dictated by the motions of the body itself.Hence, developing soft sensor designs optimized for specific tasks is still challenging.[16][17][18] However, the blackbox nature of these models makes them ineffective for any design purposes.[21][22] Culha et al. and Tapia et al. used finite-element models to develop deformation models of the sensing body and planned optimal sensor placement for proprioceptive tasks. [19,21]owever, the sensor models were simplistic, without consideration of the nonlinear material properties and the sensor-sensing body interaction.Yang et al. used learning-based approaches to develop design models of soft sensing materials to develop optimized strain sensors. [23]However, in this case, the deformations of the sensing body were ignored.
Developing multiple complex models of the sensor, the sensing body and their interactions is a challenging task.[26][27][28] For direct optimization of soft sensing technologies, several interconnected components are required: a process for automated sensor fabrication and placement; smart materials that enable this fabrication process; and algorithms to test and optimize the designed sensors.In this work, we use 3D printing for sensor fabrication and closed-loop sensor placement, as shown in Figure 1.A gelatin-based soft sensor is used for printing the soft sensors on to the sensing body. [29]Gelatin-based hydrogels have recently been gaining interest in the field of soft robotic sensors because of their low cost, ease of fabrication, biodegradability, and printability. [30,31]Based on a previous work, we adapted a self-healing ionic gelatin-based hydrogel for better printability while maintaining its electrical properties. [32]The material is biodegradable and recyclable, making it a sustainable technology for large-scale physical experimentation. [33]The sensors are directly printed and optimized on a wearable glove for human motion tracking.[39][40] As the sensor properties depend on the morphology of the user and the relative morphology of the sensor, optimal sensor configurations are user specific.In such cases, a sensor development framework that allows fabrication of the sensor on the sensing body with feedback and a process for evaluating and improving the sensor design is vital.
The contributions of the article are as follows.1) A repeatable and quick sensor fabrication setup was developed with a combination of 3D printing and a color and depth (RGB-D) feedback.
2) A recyclable hydrogel-based mixture is presented for highquality printing, and its electric and mechanical properties were investigated.3) A closed-loop optimization protocol is proposed for real-world optimization of the sensor morphology, incorporating uncertainties in real-world sensor data.
Material selection and characterization is presented in Section 2.1 and 2.2, respectively.The basic morphology of the sensor is investigated to confirm the repeatability of the sensor and determine the input parameters of the optimization in Section 2.3.The optimization results and discussion are described in Section 2.4.Further, we discuss the limitations and future direction in Section 3. Finally, detailed experimental setups are explained in Section 4.

Material Selection: Printability
To reliably and repeatably print customized sensor shapes using Figure 1's setup, we must first tune the hydrogel's material properties to match its application; [41,42] If the viscosity is too high, the material cannot be extruded from the nozzle, while low-viscosity materials do not maintain their shape after printing.
The hydrogel described by Hardman et al. [32] with no extra additives achieves a printable viscosity around 40 ∘ C.However, the viscosity quickly decreases with temperature, as indicated around Figure 2a's qualitative point "A."At lower temperatures, the viscosity increases due to gelation: by point "B," the material does not extrude reliably, leading to noncontinuous print lines.The dotted lines indicate that the material is mostly a gel and is difficult to print.In addition, the addition of salt for conductivity enhancement lowers the gelation temperature and causes these effects to occur at or near body temperature (light blue line), which is undesirable for our applications.The amount of salt is represented as a mass ratio to the gelatin (gelatin:NaCl = 1:x), the effect of which is further explored in Section 2.2.
To counter this effect and increase the viscosity of the sensorized hydrogel, cornflour, a corn kernel-based starch, was added to the x = 0.2 composition. [43]The amount of cornflour is also expressed as a mass ratio (gelatin:cornflour = 1:y).With y = 0.5, the composition had appropriate printability around 38 ∘ C, but demonstrated a low range of printable temperatures (dark green line, quickly reaching point "C" if temperatures were not carefully controlled).Increasing the ratio to 1.0 shifted the viscosity to the fine print zone over a much larger temperature range (light green, point "D").This composition appears to be a suitable compromise: we ensure that cornflour's addition is not detrimental to the material properties in Section 2.2.Additionally, extruding such low-concentration starch mixtures has a shear-thinning effect at low shear rates, [44] which is beneficial for nozzle-based 3D printing resolutions. [45,46]he fact that the hydrogel sensor is remoldable provides several advantages to our 3D printing system.It allows us to precisely control the gelation process by varying the temperate.A fast-curing silicone-based sensor would need additional mechanisms (like UV curing) or precise timing control to do the same thing.We do not encounter nozzle blockage as the gelation is reversible.Additionally, the sensor properties are highly desirable when compared to silicone-based sensors, providing high conductivity and linear response.

Material Selection: Characterization
Having identified the benefits of salt and cornflour in Section 2.1, we next investigate their effects on the hydrogel's baseline resistance and mechanical properties.In particular, the thin sensor morphologies required in this application must not result in too high a baseline resistance, since this would increase the effect Our system uses closed-loop visual feedback to drive the 3D printer trajectory and a closed-loop optimization routine to iteratively improve the sensor shape.A modified 3D printer deposits a sensorized hydrogel onto the surface of a gloved hand, the location of which is identified with an RGB-D camera.The morphology of the sensor is tuned using Bayesian optimization.
of noise on our data acquisition system.All soft sensors will exhibit viscoelastic behavior and hence would have some delay in physical response to the applied stimuli.The conductive mechanism is purely Ohmic and would not get affected by the viscoelastic behavior of the material, but will get affected by the geometric changes in the material.In this study, we are ignoring the response time of the sensors.
Figure 2b shows how the baseline resistance of otherwise identical samples varies with salt content: this reduced 10Â with 0.1 salt, stabilizing at %0.3.This is highly beneficial for our sensorized applications, but must be balanced with other material properties: above 0.25, the gelation temperature (45-50 °C) is sufficiently lowered so as not to set at room temperature.As such, x = 0.2 was selected as a compromise for further investigations.Figure 2b also shows the effect of time: the resistance increased gradually over a number of days: we later see that this does not affect the sensor's relative response.
Figure 2c shows the effect of cornflour on the x = 0.2 hydrogel baseline resistance.Though the resistance can be seen to tend marginally upward within our selected range, this was dwarfed by the effect of time and salt, and thus the composition with the best printability (Section 2.1) is selected.This results in a hydrogel with mass ratio 1:1.5:2.5:0.2:0.2:1.0 of gelatin, glycerol, water, citric acid, salt, and cornflour, respectively.Given this selection, Figure 2d shows the relationship between the strain and relative resistance change.Two ages of sample (after 1 and 10 days) were strained until fracture.The 10 days samples could withstand up to 310% strain, while those of 1 day achieved 166%.The resistance values increased almost linearly with strain, with very similar gradients between the two sample types.Indeed, since the expected strains for printed glove applications do not exceed 100%, all samples operate within their closely matching and nondamaged states.
To demonstrate the sensor performances within this range, Figure 2e plots the response of a "1 day" hydrogel to applied strain trapezoids of 30% and 100%.Both demonstrate minimal drift and high repeatability: the 30% values vary by 7.4% of the baseline resistance over 10 cycles, while the 100% values change by just 2.7% over six cycles.Some small relaxation effects are visible upon release of the 100% strains, though these last only a few seconds before returning to the baseline resistance.
Using data from Figure 2, Table 1 compares the selected composition with a variety of hydrogel and nonhydrogel alternative sensorized materials for wearable applications.It can be seen that the printable material has a relatively high gauge factor compared to materials capable of similar strains, while remaining low cost and minimally toxic.

Sensor Morphology
Having selected a suitable composition of hydrogel in Section 2.2, a number of preliminary printing tests are conducted to explore the morphological parameters which best control the resistive response of a printed glove sensor.The basic test is illustrated in Figure 3a: a "u-shaped" sensor is printed onto the ring finger of a gloved hand, and the resistive response is visibly changed as the hand is moved between the "base," "middle," and "full" poses.
Whilst the base resistance of the sensors is dependent on the thickness, Figure 3b shows how the u-shape's thickness has little effect on the relative sensitivity, which we define as the relative change in resistance (RCR) between the "base" pose (p1) and "full" pose (p2).
Since the thickness of the sensor can be slightly different in each print, this feature helps maintain sensor repeatability.In contrast, Figure 3c shows the effect of 7 sensor morphologies on the RCR, which varies from 1.13 (wide u-shape) to 1.23 (thin u-shape).This stems from the 3D shape of the fingers: thin sensors which lie along the back of the finger are stretched more than wider sensors which are positioned along the side of the finger.Indeed, the same effect is seen in the purple bars, which show the RCR between the "middle" and "base" poses as p2 & p1.
Serpentine patterns are commonly used in strain sensors.However, in this experiment, these "W" shapes gave lower RCR values than the thinnest U-shape, since the outermost lines lay along the side of the finger.Similarly, the sinusoidal pattern could not outperform the U-shape.Thinner patterns would interfere with the printability thresholds set in Figure 2a, and thus U-shapes are chosen as the optimization loop's basis.By applying these shapes to the thumb, which has a wider range of movement, and allowing a number of parameters to vary (Section 2.4), we look to optimize for sensitivity to specific motions while minimizing sensitivity to others.Since the sensitivities vary with their relative printed position on the hand's 3D shape, we expect the optimum solution to vary with the user and hence provide a method for quickly optimizing a custom sensor morphology to the user's hand.

Closed-Loop Optimization
The closed-loop Bayesian optimization which we employ is composed of a computation phase and real-world phase (Figure 4a).This optimization process starts with setting the target motions of the finger, that is., which motions the final sensor should or should not be sensitive to.Given these motions, the computation Table 1.A comparison of the selected composition with other soft piezoresistive materials suitable for wearable applications.Partially based on data from another study. [50]nsor type Gauge factor Maximum strain 3D printability Material toxicity K-carrageenan/PAAm [51] 0.63 1400% Bioprinting High DMA/SDS/NaCl (NaCl nanoparticles) [52] 1 200%

Ink Extrusion Medium
Gelatin and tannic acid [53] <1 1500% No Low PAA/nano barium ferrite [54] 1-3 100% No Some CNT/Borax/PVA [55] 1.51 1000% No Medium Stick on sensors [56] 2-3 400% No Low Cellulose ionic hydrogels [57] 0.3 126% No Organic Carbon-filled gelatin hydrogels [50] 2.5 320% Extrusion Low EGaIn skin [5] 3.93 250% No Low ZnONWs-PDMS [3,58] 114 50 No Medium Natural rubber þ acetylene black [59] %0.phase suggests an initial sensor shape, which is printed onto the user's hand in the real-world phase.The performance of the physical sensor is evaluated and assigned a score (Section 4.3), which is returned to the optimization algorithm to propose a new shape.The process is repeated until convergence; the use of Bayesian Optimization enables us to obtain reasonable solutions within %20 iterations with uncertainty measures.
By coupling this process with the selected hydrogel composition and printing process, the printed sensor can be tested almost immediately after fabrication.The sensor is adhesive enough to stick to the rubber glove, but can also be manually peeled off within 30 s (see attached Supporting Information video).If needed, higher adhesive forces can be generated using textured gloves.Coupled with the hydrogel's thermoreversibility, this facilitates straightforward recyclability.
The optimization's input parameters were selected based on the results of Section 2.3 to ensure the widest variability, illustrated in Figure 4b: offset, width, angle, start point, and end point.The width and offset are associated with the relative position of the sensor, while the start point, end point, and angle determine whether the sensor covers the joints of the finger.These five inputs are scaled to be continuous values ranging from 0 to 1, defined in Section 4.3.In this process, only the thumb was the object of sensing.Due to the complexity of the thumb mechanism, it is not intuitive to predict the appropriate morphology of the sensor for sensing the thumb.For the other fingers, on the other hand, the appropriate sensor morphology can be easily estimated based on Figure 3c.
To define the output evaluations, two target applications are proposed, using the poses shown in Figure 4c.In the first, we look to maximize one sensitivity while minimizing another: namely, finding a point on the Pareto curve which responds maximally between poses 3!1 and minimally between 2!1.The second focuses on differentiating between different styles of tennis grip, aiming to maximize the resistance ratio between Western and Eastern grips (poses 4 and 5, respectively).
This closed-loop optimization can converge to one specific hand, but its offset sensitivity suggests that the results would not necessarily transfer to a differently sized hand, requiring the process to be matched to not only the task but also the individual.To demonstrate this, Figure 4d compares the differences in output between two experimenters, for the hand poses associated with experiment 1. Glove A is the optimal shape for the first user and glove B is the optimal design for the second user, while glove C is one of the suboptimal shapes.We see that the sensor patterns do not transfer: while glove A is the best for experimenter 1, glove B is the best for experimenter 2 and glove C is the worst for both experimenters.Hence, the optimization process is personalization to each user rather than a global optimal solution.
To begin, the optimization was performed for a single person, so that the hand shape stayed the same throughout.The results of the first target application (maximizing pose 3's sensitivity while minimizing pose 2's) are displayed in Figure 5.
The first ten iterations in Figure 5a's optimization parameters were randomized.Until iteration 15, some input parameters searched the next point in a limited range.Beyond this, the parameters quickly converged and Figure 5b's output metric sharply increased, reaching %3Â its starting value after 20 iterations.Simultaneously, the uncertainty decreased steadily after iteration 15.We see from Figure 5c's scatter plots that this corresponded to the identification of high scoring clusters within the parameter space.Though significant areas are unexplored, this local maximum was found quickly and successfully within the physical iteration space; it is infeasible for a user of the glove to wait until a global maximum is identified.Longer optimization routines can however be performed for robotic systems.
The maximum output was 1.61 in iteration 20. Figure 5d shows the optimization's success via the raw sensor signals: the gap between R p1 and R p2 is much smaller than that between R p1 and R p3 .In contrast, the glove of iteration 1 had the lowest output, and the gap between R p1 and R p2 is greater.The shape of the sensors provides an insight into the key aspects of such sensitivity: iteration 20's sensor curves to extend into the interdigital space between the thumb and index finger, which the first iteration's sensor avoids altogether.This area undergoes significant deformations when the thumb moves and thus plays an important role in the proprioceptive sensing.
Figure 6 shows the results of the second optimization task: distinguishing between the two racket grips.The parameters quickly converge after an n = 10 random process, while the uncertainty peaks at 0.62 during exploration before decreasing during convergence.Simultaneously, the measured outputs trended upward.Compared with experiment 1, the ranges of exploration were not wider, as shown in Figure 6c.The maximum output was found to be 0.105 in iteration 18, while the minimum value was 0.013 in random input 5.The significant difference in the gaps can be seen in Figure 6d.Since the optimized sensor covered the interdigital space between the thumb and index finger, the area's importance is identified.

Conclusion
In this work, we present a framework for the closed-loop design optimization of soft sensors via 3D printing.A sensorized recyclable hydrogel is printed onto customizable gloves which can be tuned to match both specific tasks and hand sizes, using realworld measurements coupled with Bayesian optimization.We investigate material compositions, conditions, and 3D tracking techniques to maximize the sensorized hydrogel's repeatability, printability, and response characteristics.By optimizing through a few real-world iterations, we avoid the reality gap faced by modeling difficulties and provide a feasible method of tuning sensors to personalized applications over 20 tests.This feasibility is demonstrated through two real-world optimizations, for selective sensitivities and sport grip detection.Our results show that the proposed framework allows for individualized sensor designs for bespoke applications while taking into account uncertainties introduced by real-world data.In addition, since the hydrogel can be peeled off from the glove and remelted, the entire process can be performed with no waste and is completely recyclable.Future work will aim to increase the speed of each iteration to further streamline the process, utilizing automated testing, tuning of starting parameters, and fine-scale temperature control.
Currently, we still rely on manual processes for wiring the sensors and removing the sensors from the gloves.This is why we employ low-data intensive optimization algorithms.We expect automation of this process to be our next challenge and could significantly improve our design pipeline.Another direction to investigate is the use of alternate electrolytes like ammonium nitrate (NH 4 NO 3 ), sodium bicarbonate (NaHCO 3 ), or potassium iodide (KI) for improved printing performances.With these adjustments, the framework can be applied to numerous real-world soft sensors and grippers, enabling straightforward task customization in future sensor designs.

Experimental Section
Printing Framework: The automatic 3D printing framework enables repeatable and quick prints and was built on a modified Creality CR-20.The hotend was replaced with a Wiiboox LuckyBot 3D Printer Food Extruder, which held the hydrogel at 38°C during printing.A cylinder, whose diameter was 30 mm, was attached to the nozzle, and the material was extruded via a stepper motor.To provide an initial datum for the Z (vertical) offset, the printer's leveling sensor (BLTouch) was repositioned at the same height as the modified nozzle.To provide further z data of the 3D surfaces, an Intel RealSense RGB-stereo camera was fastened to the top of the printer.This camera is used for two purposes: hand detection and height measurement.Hand detection is done to identify the position of the user's glove on the print plate, using the open-source Mediapipe library. [47]Based on the identified finger joints, a Python script generates G-code files which are sent to the printer via Pronterface.These files incorporate depth information from the camera, such that the nozzle's distance from the hand remains fixed throughout the print.This function highly contributes to the enhancement of print quality: with this combination of control, material selection, and line thickness.The minimum distance between two lines was limited to 7 mm to avoid contacts between the lines.
There were some steps involved in the automatic generation of the G-code files.In the first step, the sensor's morphological parameters were defined manually or proposed by the optimization (Section 4.3).With these defined, the system scanned the position of the gloved hand, returning the measured locations of the finger joints.Based on these landmarks, the computer calculated the X-Y coordinates of the sensor and the corresponding nozzle trajectory.The measured depth information was also incorporated: the local height of the gloved hand was calculated by subtracting the depth value from the known distance between the camera and the print plate.Before output, the coordinates were transformed from the camera's pixels to printer's buildspace, and extrusion speeds/ rates were defined.Finally, the print started following the G-code, printing the desired morphology onto the user's hand.Finally, conductive threads were manually put on two ends of the printed sensor and were covered with the hydrogel.Fabrication & Characterization: The sensorized hydrogel printed in this work was based on that proposed by Hardman et al., [32] with adjusted ratios and including cornflour as a thixotropic thickening additive.As described in Section 2.1, the mass ratio of gelatin, glycerol, water, citric acid, salt, and cornflour was selected as 1:1.5:2.5:0.2:0.2:1.0 to maximize the sensitivity and printability.Fabrication follows the steps in ref. [32], with cornflour first dissolved into the water: this was mixed with the gelatin powder and bloomed for 5 min before the other components were added, and the mixture was heated in a water bath at 60 °C for 4 h.Long-term experiments were demonstrated in a previous work and showed the robustness of the material over long durations. [32]The hydrogel material was however still affected by environmental factors and reached an equilibrium with the ambient humidity and temperature.This could be modeled and compensated using data-driven methods using redundant sensor configurations. [48]To investigate the print qualities in Figure 2a, the different compositions were printed on a glove at 5°C intervals from 30 to 45°C.The print speed were held constant (5 mm s À1 ).The qualitative printability evaluation was based on the amount extruded, "spread" after printing, and cleanness of the lines.
Figure 2b,c's baseline resistance testing was compared using samples produced by casting into dog-bone molds 70 mm long and 5 mm high.Values were measured using a Keysight E4980AL LCR meter at 1.0 kHz.
Figure 2d,e's mechanical test samples were cast into 100 mm dog-bone samples and tested using a Universal Robots UR5 robotic arm.One end of the sample was secured to the table using a clamp, and the other end was pulled at a constant velocity of 2 mm s À1 by the UR5.The resistance was measured using the LCR meter at 1.0 kHz, as were all subsequent tests performed on the sensorized gloves.
Optimization Process: This section provides further details of the closed-loop optimization process presented in Figure 1 and 4a.Bayesian optimization is implemented using Python's GPyOpt.methodspackage.When presented with the output of the previous iteration, new morphological parameters (Section 2.3) were proposed and printer G-code automatically generated.The only manual steps in the closed loop were the hand pose measurements.In measurement, the LCR meter's probes were joined to conductive threads, which were adhered to the ends of the printed sensor.Each sensor was left at room temperature for 10 min after printing before testing occurs.
Each parameter was scaled to range between 0 and 1, as described in Table 2.The point at which the angle of the line changes was set on the MP joint.
The acquisition function is a key component of Bayesian optimization.We selected expected improvement (EI) as the basis of our function due to its widespread use and balance of exploitation and exploration. [49]uring Section 2.4's first optimization, the function must reflect relative insensitivity between pose 1 and pose 2, and sensitivity between pose 1 and pose 3, that is, the output parameter should be small when the gap between pose 1 and pose 2's responses is significant, and should be large when the gap between pose 1 and pose 3 is significant.We implemented where RCR p1Àp2 and RCR p1Àp3 was the resistance change ratio between pose 1 & 2 and 1 & 3, respectively The square root prevents the denominator from dominating the response.
For the second optimization task of Section 2.4, the same experimenter wore each printed glove while switching between Eastern and Western grips of a tennis racket.To detect the difference, an acquisition function was chosen to reflect significant differences in baseline response between the two poses where R p4 and R p5 are the resistance in Figure 4's poses 4 & 5.
Appropriate ethics and consent procedures were followed for all experiments involving human participants.

Figure 1 .
Figure1.Closed-loop physical optimization process of the printed sensor.Our system uses closed-loop visual feedback to drive the 3D printer trajectory and a closed-loop optimization routine to iteratively improve the sensor shape.A modified 3D printer deposits a sensorized hydrogel onto the surface of a gloved hand, the location of which is identified with an RGB-D camera.The morphology of the sensor is tuned using Bayesian optimization.

Figure 2 .
Figure 2. Characterization of the hydrogel.a) Printability of the compositions: to print with a reasonable quality, the material must maintain a specific viscosity range.b) Change in measured resistance with salt and time.c) With 0.2 salt, change in measured resistance with cornflour and time.d) Relative change in resistance with strain of the selected composition, after 1 & 10 days.e) Response repeatability: relative change in resistance of the selected composition under 30% & 100% applied trapezoidal strains.

Figure 3 .
Figure 3. Repeatability of the sensor.a) A U-shaped sensor printed on one finger responds to three hand positions.b) Minimal effect of a U-shaped sensor's thickness on its resistive response.Thickness is represented as ratio to the thickest sensor.c) Effect of sensor morphology on relative resistive response of the three hand positions.

Figure 4 .
Figure 4. Physical optimization process.a) The closed-loop Bayesian optimization process, which occurs both physically and computationally.b) Input parameters.c) Target poses, used to evaluate each physical sensor's output value.d) Comparison of three gloves (A, B, and C) tested on two different people.The sensor lines are highlighted because the sensors are transparent.

Figure 5 .
Figure 5. Optimization results of experiment 1. a) Input parameters.b) Output and uncertainty.c) Distribution of the input parameters and output values.d) Time series responses for the sensors from iteration 1 and iteration 20.

Figure 6 .
Figure 6.Optimization results of experiment 2. a) Input parameters.b) Output and uncertainty.c) Distribution of the input parameters and output values.d) Time series responses for the sensors from iteration 5 and iteration 18.

Table 2 .
Range of the five input parameters presented in Figure4b.