1 Introduction

The textile industry has to stay up-to-date constantly in order to meet the demand expected from it with its wide range of products. Textile products are not only used in daily use but also in technical activities. Therefore, in recent years, there has been an increase in the number of studies conducted in collaboration with different disciplines. Especially the developments in electronic technologies have led technical textiles to turn to that field. For this reason, it becomes necessary to work in integration with electronic devices day by day. Conducting polymers are used in biomedical applications, sensors, photovoltaic cells, diodes, and transistors [1] due to their optical, chemical, physical, and mechanical properties as well as their electrical conductivity [2, 3]. These commonly used materials are advantageous for their rapid synthesis, easy incorporation into various materials like different acids and dyestuffs [4], and stretchable properties, making them beneficial for use in textile products. Electronic materials, which are generally rigid, brittle, and hard, must be flexible and durable in order to be applied to textile surfaces. Additionally, it should provide ease of use without negatively impacting the comfort of clothing. In this regard, conductive polymers with signal, alert, detection, and responsive capabilities can be applied to flexible surfaces through various chemical processes. PANI is a conductive polymer frequently used as a sensing material in gas sensors. It is one of the most used materials among conductive polymers [5]. It is known for its high sensitivity to some gases such as ammonia and its stability in different mediums. It is seen that it is used in the detection of ammonia [6,7,8], hydrogen [9], acetic acid vapor [10], hydrogen sulfide [11], and hydrogen peroxide gases [12]. It is also used in dopamine, glucose [13], pH [14, 15], humidity [16], and pressure sensors [17]. Glass, cotton fabric [18], cellulose paper [19], platinum wire [20], stainless steel [21], silicon, polyethylene terephthalate [22] are used as substrate materials, TiO\(_2\), ZnO [23], CuO, Pd [24], Ag [25] are used as additive materials. It has been determined that different methods such as dip coating [26], spin coating [27], and electrochemical deposition [28] are generally used as coating methods. Many harmful gases vital to human safety are often located beyond the threshold of human perception. Hence, there is a need for gas sensing and stimulating gas sensor systems for these gases. Conductor or semiconductor-based gas sensors form an indispensable part of these systems. In places exposed to harmful gases, sensors can be fixed in a specific location or integrated onto individuals. Sensors placed on people need to be lightweight, durable, and not interfere with the work being done. For this reason, the number of studies on flexible surfaces has increased considerably in recent years. Instead of placing an extra piece on the person, integrating a gas sensor system on the already used clothing provides great convenience. Constructing sensors through the thin film deposition method using materials that can detect harmful gases and elicit a response also presents significant advantages. Here, both the properties of the substrate, such as flexibility and the gas sensing capabilities of the deposited thin film are benefited. However, if the sensors were to be created solely with semiconductor material, not only would the cost be higher, but also the substrate properties could not be utilized. There are studies in which PANI applications deposited on flexible surfaces are used as gas sensors in literature. Textile-based flexible gas sensors using single yarns as substrates stand out in particular [29]. It has been seen in some studies that pure and doped PANI components are deposited on cotton yarns and used in the detection of various gases [30,31,32,33]. There are also applications where fabrics are used as a substrate [34, 35]. Deposition on yarn has some advantages over fabrics. When deposition is desired on fabric surfaces obtained from yarns by knitting and weaving, it was considered that deposition methods would not coat as homogeneously and effectively as a single yarn. In addition, other advantages of yarns are that they can form a fabric surface, can be used in sewing, and are light. Apart from natural cotton threads, it was observed that synthetic-based acrylic and polyester threads were also used as substrates in various studies. It was observed that these coated threads sense various gases and are used as gas sensors. The prominent properties of sensor yarns, such as their flexibility, repeatability [36], low cost, easy fabrication, and rapid integration with many substrates, provide a significant advantage in obtaining practical gas sensors. In this study, we designed flexible, repeatable single-layer yarn gas sensors for different concentrations of gas detection. For dip coating process, 100% purity and different numbers of cotton, polyester, polyamide, acrylic, viscose yarns, 50% cotton–50% linen, 50% polyester–50% linen blended yarns were used as the substrates and conductive PANI was used as the target coating material. We have developed a gas control system specifically for the tests of using PANI-coated yarn samples as gas sensors. Studies to determine the sensitivity and detection times of flexible yarn sensors were carried out at room temperature. The conductivity properties of 7 different coated yarn samples and their response to CO, NH\(_3\) , and butane were measured. Additionally, their suitability for use as a gas sensor was tested. It was determined that all yarn samples reacted with an increase in conductivity levels when exposed to CO gases. It was observed that at high concentrations of NH\(_3\), the yarn gas sensors reacted by decreasing their conductivity, and some samples completely lost their conductivity properties. The reason for this was thought that the HCl acid used in the last stage of the experimental method could cause a neutralization reaction with NH\(_3\) vapor. When butane gas was introduced into the medium, there was no significant change observed in the conductivity of the yarn samples. The main reason why PANI-coated thread sensors do not respond to butane gas is that PANI has low sensitivity to butane and butane molecules do not provide a strong enough interaction on the PANI surface. The ability of the PANI layer to show the expected conductivity change towards butane gas was limited due to the incompatibility between the chemical properties of the gas and the properties of PANI. This caused the sensor to not detect butane gas effectively. Without sufficient conductivity alteration in gas sensor applications, complete detection and stimulation could not be achieved. Consequently, it was determined that yarn gas sensors produced were not suitable for the detection and sensor applications of butane gas.

2 Materials and methods

In the scope of this study, various commercially available with different numbers yarn were selected as substrates. As substrate yarn samples, a total of 7 different yarns were used: natural fibers cotton, semi-synthetic fibers viscose, synthetic filaments polyester, polyamide, acrylic, and a mixture of 50% cotton–50% linen yarn and 50% linen–50% polyester. Yarns were preferred as a substrate material to be used in wearable sensor applications. Since wearable textiles used in daily life are made of different raw materials, different yarns were used in this study. In this way, the sensor behavior of different yarns coated with the unique physical properties of PANI was investigated. The initial solution for the coating process was prepared using polyaniline (PANI) as the base polymer, N-Methyl-Pyrrolidone (NMP) as the solvent, and hydrochloric acid (HCl) as the oxidizing agent. Based on the preliminary experiment results, a 10 mL NMP solution was prepared by adding the predetermined amount (0.323 g) of PANI. The prepared solution was stirred for 72 h. After this process, 5 mL of ethylene glycol (EG) was added to the solution and stirred for 5 min, thus preparing the initial coating solution as illustrated in Fig. 1

Fig. 1
figure 1

Preparation of coating solution

The yarn samples to be used as substrates were first placed in acetone. Subsequently, for a period of 10 min, they underwent an ultrasonic cleaning process with the aim of removing organic contaminants on the yarn surfaces and facilitating better adhesion of the coating materials to the yarn surfaces. During the ultrasonic bath cleaning process, potential contaminants on the yarn surfaces were removed. The contaminants that can be effectively eliminated include dust, dirt, oils, and other organic particles. Following this, the yarn samples were dried at 60 °C for 1 h. This process, during which the yarn samples were cleaned and made ready for coating, is illustrated in Fig. 2.

Fig. 2
figure 2

Cleaning of yarn samples in ultrasonic bath

The dip coating method was preferred to deposition PANI on the cleaned yarn samples. Dip coating is a method that allows for quick, uniform, practical, cost-effective, and versatile coating on various surfaces [37, 38]. In dip coating, the substrate sample is first cleaned and then immersed into a bath containing a PANI solution in a solvent. During this process, a thin PANI layer is deposited on the surface of the substrate, and the solvent is allowed to evaporate. Due to the specific risks associated with the blending of staple-based natural cotton, linen, and their blend yarns, particularly concerning fiber lengths, and the potential for altering the solution molarity, it was decided to perform coatings in separate flasks for the prepared solution. This decision aimed to mitigate potential complications arising from the interaction of these fibers with the solution, ensuring a more controlled coating process. The prepared coating solution was evenly distributed into flasks, each containing 5 ml. Using the dip coating method, PANI polymer was applied to yarn samples in the prepared flasks for a duration of 10 min. Following the removal of yarn samples from the flasks, they were dried at 60  \(^{\circ }\)C for 2 h. In the final stage of the accumulation process, the yarn samples were immersed in a prepared 5 M HCl solution and left for 30 min. The PANI deposition process by dipping the yarn samples is shown in Fig. 3.

Fig. 3
figure 3

Dip coating process

The surface properties of the samples were analyzed with ZEISS Supra 40 VP FESEM device and their chemical structures were analyzed with PerkinElmer Spectrum 100 FTIR device. This study examines the potential use of polyaniline (PANI)-coated yarn samples as gas sensors. PANI-based gas sensors typically work by measuring changes in the electrical conductivity of PANI upon contact with a target gas. The conductivity of PANI changes in the presence of different gases in the environment as a result of adsorption of gas molecules onto the PANI surface, leading to a change in the charge distribution within the polymer. Gas adsorption on PANI causes a significant change in conductivity. This change can be measured and used to determine the concentration of the target gas in the medium.

Fig. 4
figure 4

Gas control system

A novel gas detection and control system was designed to investigate the applicability of PANI-coated yarn samples as gas sensors. The system shown in Fig. 4 generally consists of a gas chamber, a gas sensor placed inside, sensor connections, sensor resistance, target gas provider, power supply, and an analog-to-digital converter. In the first stage of the system, a gas chamber was created where gas applications were performed. In this chamber, a sensor holder mechanism was positioned where the yarns to be used as sensors could be placed and placed between two conductive connections. One of the conductive connections was connected to the power supply. The sensor resistors were placed in the other conductive connection and then connected to the analog-to-digital converter. 5V applied analog voltage information was converted into 10 bit digital data by ADC. The converted digital data were analyzed on the computer with ADC software. Connections were created for gas inlet and outlet from the target gas source to the gas chamber. A fan was installed to distribute the gas into the chamber. In general, when gas is supplied to the gas chamber, the information of the change of current values passing through the resistance on the sensor triggered by the specified voltage is monitored and evaluated by transferring it to the computer environment through the analog-to-digital converter. The PANI-coated yarns were placed in the prepared gas chamber and connected to the gas control unit to investigate their application as gas sensors. A constant voltage of 5V was applied to the sensor through a power supply. Voltage variations on the resistance added to the sensor system indicated that the film coating was applied correctly, demonstrating the suitability of the yarns for use as sensors. The responses of the yarn sensor samples placed in the gas chamber to different gases, including room conditions, were measured and evaluated. In this study, the use of 7 different yarn samples as gas sensors against CO and NH\(_3\) gases was investigated. The conductivity values of yarn samples intended to be used as sensors for gas applications were measured for 240 s under room conditions. The voltage values across the sensor resistance were calculated when 5V current was applied to the yarn samples at room conditions. The response time of yarn gas sensors is defined as the time it takes for gas to be introduced into the medium, for the gas to be detected and for the current in the sensor resistance to change. According to the calculated response times, the gas flow time to the medium was determined as 120 s. Then, for the first experiment, gas was introduced into the environment at a set concentration for 120 s. After removal of the gas, a period of 240 s was allowed to return to room conditions for the sensors to recover and return to their initial state. These conditions were repeated three times for each yarn sample to measure the reusability of the sensors and their response to different concentrations. Since the chemical structures of the yarns are different, they reacted differently to the chemicals in the deposition solutions. PANI coated as a thin film has different bonding properties with the yarns. Since ethylene glycol, which is used to control the solution viscosity and also acts as a solvent, exhibits different adhesion and coating properties on different yarns, the semiconducting properties of PANI deposited on the surfaces also vary. For this reason, it was observed that different yarn samples coated with PANI exhibit different sensor properties.

3 Results and discussion

3.1 Characterization of PANI-coated yarns

3.1.1 FESEM analysis results

Morphological properties of the samples were obtained by Field Emission Scanning Electron Microscopy (FESEM), Zeiss Supra 40VP microscope, with the samples sputter-coated previously under vacuum with gold/palladium, and applied 15 kV of acceleration voltage. Figure 5 shows FESEM images of PANI-coated yarns at 100X magnification and Fig. 6 shows the PANI formations coated on the yarn. These formations were determined to be PANI by EDX analysis. In the images, it is seen that PANI is homogeneously coated on the yarn surfaces, there is no agglomeration and there is no deformation and breakage in the yarns as a result of the coating process. Thus, it was decided that PANI-coated yarns could be used for sensor applications.

Fig. 5
figure 5

FESEM images of PANI-coated yarns at 100 X magnification

Fig. 6
figure 6

Representation of PANI formations coated on yarn

3.1.2 FTIR analysis results

The interactions between the yarn samples and PANI were characterized through FTIR analysis. The FTIR spectrum was obtained using the ATR module, and the analyses were conducted with a PerkinElmer/Spectrum 100 brand/model instrument. Spectra were acquired in the wave number range of 400–4000 cm−1 with a resolution of 4 cm−1. All samples exhibited strong absorption bands in the range of 740–1650 cm−1, reflecting the characteristics of PANI. FTIR vibration groups of PANI and PANI-coated yarn samples used to make different types of yarns conductive are given in Table 1. FTIR plots of each yarn sample are provided in the Supporting Information file. The characteristic peak of the C–H out-of-plane bending vibration of the 1,4-disubstituted benzene ring is observed at 821 cm−1 [39]. The moderate absorption intensity band at 954 cm−1 of the FTIR spectrum of PANI is attributed to the planar C–H bending vibration of benzene ring deformation. The intensely sharp peak seen at 1157 cm−1 was attributed to C–C stretching caused by C–N stretching. The sharp peak at 1301 cm−1 can be attributed to torsional C–N oscillations in the alkyl chain. The intensely sharp peak at 1589 cm−1 belongs to the C=C stretch in the aromatic ring [40]. C \(\equiv C\) stretches of alkynes were observed at 2020–2158 cm−1 [41]. The peaks at 3380 and 3662 cm−1 are related to the valence oscillations of the C–H and N–H bonds extending within the benzene rings [42]. In the functional groups of cotton, the broad band in the 3740–2907 cm−1 region is due to O–H stretching caused by intra- and inter-molecular hydrogen bonds. The short intense peak at 2847 cm−1 belongs to the CH stretching vibrations of the cellulosic structure of cotton [43]. At 821 cm−1, C–H out-of-plane bending vibration of 1,4-disubstituted benzene ring is observed. The sharp peak is seen at 1499 cm−1 and 1589 cm−1, the C=C stretching in the aromatic ring and the peaks of alkynes observed at 2020 cm−1 and 2158 cm−1 prove that the cotton yarns contain PANI molecules. Characteristic absorption peaks of polyester yarn and PANI-coated polyester yarn were observed; C=O bond at 1714 cm−1, aromatic ring vibrations at 1409 cm−1, carboxylic ester groups in the structure at 1337 cm−1, O=C–O–C groups at 1247 and 1097 cm−1 , C=C vibration peak at 1007 cm−1, five substituted H in benzene at 876 cm−1, and heterocyclic aromatic ring at 725 cm−1, which is similar to the literature [43]. The chemical structure analysis result of the interaction of polyester yarn with PANI proves the interaction of PANI with polyester yarn. The sharp peak belongs to the PANI at 1589 cm−1, the sharp peak at  2020 cm−1 and 2158 cm−1, the slightly strong broad peak at 2517 cm−1, the short sharp peak at 3380 cm−1, the short sharp peak at 3750 cm−1 were clearly seen on the polyester yarn. The difference in the bands between 2750 cm−1 and 3250 cm−1 also proves that PANI and polyester yarn have a strong interaction. In viscose, the wide and broad peak at 3345 cm−1 belongs to the characteristic O–H stretching band of viscose. The sharp intense peak at 2895 cm−1 indicates C–H stretching. 1426 cm−1 and 1361 cm−1 show C–H bendings. The medium intensity sharp peak seen at 1637 cm−1 belongs to the bending band of the absorbed water. The spectral band gap seen in the region between 1253 cm−1 and 798 cm−1 is the fingerprint region of cellulose, where strong C–O–C stretching vibrations of the glycoside ring are observed [44]. PANI–viscose yarn interaction is not as strong as cotton–PANI and polyester–PANI. The intensities of the characteristic peaks of PANI are quite low. The intensely sharp peak of PANI, seen at 821 cm−1, shifted to approximately 720 cm−1 when it interacted with viscose. The low intensity sharp peak of PANI seen at 2850 cm−1 was also seen in the PANI sample interacting with viscose yarn. The sharp peak of viscose in the 1700–1300 cm−1 region, seen at approximately 1650 cm−1, disappeared in the spectrum of PANI–viscose yarn. Absorption peaks of acrylic yarn are 780 cm−1 (sharp), 1020 cm−1 (sharp), 1235 cm−1, 1451 cm−1 (sharp), 1738 cm−1, 2847 cm−1, and 2920 cm−1; the peaks appearing in belong to CC bending, CN stretching, CO stretching, CH bending, CO stretching, CH stretching, and CH stretching, respectively. These are considered characteristic peaks of acrylic [45]. Polyamide phases show peaks of pure polyamide peaks at 2919–2967 cm−1, 1709 cm−1, 1469 cm−1, 1085 cm−1  and 1013 cm−1, respectively, due to N–H stretching of amide group, aliphatic C–H, C–O unsymmetrical stretching vibration carbonyl group, amide I, amide II, and \(\gamma\)-crystalline phase [46]. Functional characteristics of all materials of Linen/Cotton and Linen/Polyester blended yarns were observed in FTIR results. Due to its cellulosic structure, the FTIR spectra of the functional groups of linens are as follows: 3338 cm−1 for O–H stretching, approximately 2900 cm−1 for C–H stretching, 1421 cm−1 for C–H shaking, approximately 1340 cm−1 for C–H bending, 1630 cm−1 (linen–polyester) and 1709 cm−1 (linen–cotton) for C=O stretching, and 1085 cm−1 for C–O stretching at [47]. The functional groups of the yarn samples and PANI used in the study are given in Table 1.

Table 1 Functional groups of raw materials

3.1.3 Gas sensing mechanism

Detection of ammonia gas is important for individual environmental protection and industrial monitoring. The large-scale release of ammonia comes from human activities, animals, and industries. The most known sensor mechanism for NH\(_3\) is the protonation and deprotonation steps of PANI [48]. When PANI-coated yarns are exposed to NH\(_3\) gas, H ions in the imine group (–NH\(^+\)=) of acidified PANI react with NH\(_3\) in the medium to form ammonium ions (NH\(_4\) \(^+\)). As a result, the conductive PANI emeraldine salt is transformed into the non-conductive emeraldine base. This leads to an increase in electrical resistance. The transformation mechanism of PANI is given in Fig. 7. Furthermore, when the PANI-coated yarn sensor is exposed to N\(_2\) atmosphere, NH\(_4\) \(^+\) decomposes to NH\(_3\) and H\(^+\) and the PANI emeraldine base in the sensor is converted back to PANI emeraldine salt, the resistance decreases, and the electrical conductivity increases [49]. This reaction is reversible and the reaction is given in equation 1 [50].

Fig. 7
figure 7

The transformation mechanism of PANI

$$\begin{aligned} NH_3 + PANIH^+ \longleftrightarrow NH_3^+ + PANI \end{aligned}.$$
(1)

3.1.4 CO gas sensor application experiments

In the gas chamber environment, cotton yarn samples were placed between two conductors and the sensor response to CO gas was measured. The data of cotton yarns coated with PANI as CO gas sensor application were measured at room conditions for the specified time. The data obtained are shown in Fig. 8. The voltage on the sensor resistance was determined to be around 1.5 V under room conditions. Upon introducing 400 ppm of CO gas into the environment, the voltage on the sensor resistance increased, reaching 2.5 V, and then stabilizing at 2.75 V after 30 s. When the CO gas was withdrawn from the environment, the sensor resistance returned to values close to the initial state, approximately 1.4 V, after 120 s. In the second experiment, introducing 600 ppm of CO gas resulted in an increase in voltage on the sensor resistance, reaching 3.3 V after 120 s. Upon withdrawing the CO gas for the second time, the sensor recovered over 120 s, and the voltage on the sensor resistance decreased to 1.2 V. For the third experiment, introducing 800 ppm of CO gas led to an increase in voltage on the sensor resistance, starting at around 1.2 V and rising to 3.8 V after 120 s. Upon withdrawing the CO gas, this value decreased to around 1 V.

Fig. 8
figure 8

CO gas application data of PANI-coated cotton yarn samples

The CO gas sensor application data for PANI-coated polyester yarn samples are presented in Fig. 9. Under room conditions, the voltage value on the sensor resistance was measured for 240 s and recorded to be approximately 1 V. Upon introducing 400 ppm of CO gas into the gas chamber, the voltage on the sensor increased, measuring around 2 V, and 140 s after the gas release, it decreased to 0.75 V. When 600 ppm of CO gas was introduced, the voltage on the sensor rose above 2 V after 120 s, and for 800 ppm of CO gas, an increase up to 2.4 V was observed. Upon removing the gas from the environment, the voltage on the sensor dropped to approximately 0.5 V after around 140 s.

Fig. 9
figure 9

CO gas application data of PANI-coated polyester yarn samples

The CO gas sensor application data for PANI-coated viscose yarn samples are provided in Fig. 10. Under room conditions, the voltage on the sensor resistance was measured to be 0.7V. Upon introducing 400 ppm of CO gas into the gas chamber, the voltage on the sensor resistance increased to 0.9V. For 600 ppm CO gas input, this value rose above 1.2V within 20 s, while for 800 ppm CO gas input, it increased to 1.3V after 40 s and 1.4V after 60 s. Upon gas release, values close to the initial measurement were observed.

Fig. 10
figure 10

CO gas application data of PANI-coated viscose yarn samples

The CO gas sensor application data for PANI-coated acrylic yarn samples are presented in Fig. 11. Under room conditions, the voltage on the sensor resistance was measured to be 1.7 V. Upon introducing 400 ppm of CO gas into the gas chamber, it was observed that the voltage on the sensor resistance instantly exceeded 2V. For the entry of 600 ppm of CO gas, the voltage on the resistance was measured at 2.4 V, and after 120 s, it reached a value of 2.8V. In the case of 800 ppm gas input, the voltage on the resistance was determined to be 3.1 V after 120 s. Upon gas release, values close to the initial measurement were recorded.

Fig. 11
figure 11

CO gas application data of PANI-coated acrylic yarn samples

The CO gas sensor application data for PANI-coated polyamide yarn samples are provided in Fig. 12. Under room conditions, the voltage on the sensor resistance was measured to be 0.8 V. Upon introducing 400 ppm of CO gas into the gas chamber, the voltage on the sensor resistance increased to 4 V after 80 s. For the entry of 600 ppm gas, the voltage, which was 4.2 V after 40 s, rose to 5 V after 50 s for 800 ppm gas input. Upon gas release, the voltage on the sensor instantly decreased to 0.7 V, 0.4 V, and 0.2 V, respectively.

Fig. 12
figure 12

CO gas application data of PANI-coated polyamide yarn samples

The CO gas sensor application data for PANI-coated linen/polyester blend yarn samples are presented in Fig. 13. Under room conditions, the voltage on the sensor resistance was measured to be 1.4 V. Upon introducing 400 ppm of CO gas into the gas chamber, the voltage on the sensor resistance increased to 2.5 V after 100 s. For 600 ppm gas input, the voltage was 4.2 V after 40 s, and for 800 ppm gas input, it rose to 5 V after 50 s. After 50 s, 20 s, and 60 s from gas release, the voltage on the sensor decreased to 0.7 V, 0.4 V, and 0.2 V, respectively.

Fig. 13
figure 13

CO gas application data of PANI-coated linen/polyester blend yarn samples

The CO gas sensor application data for PANI-coated linen/cotton blend yarn samples are presented in Fig. 14. Under room conditions, the voltage on the sensor resistance was measured to be 1 V. Upon introducing 400 ppm of CO gas into the gas chamber, the voltage on the sensor resistance increased to 2 V after 120 s. For 600 ppm gas input, the voltage was 2.5 V after 120 s, and for 800 ppm gas input, it rose to 3.5 V after 100 s. After 120 s from gas release, the voltage on the sensor decreased to approximately 1.2 V, close to the initial value.

Fig. 14
figure 14

CO gas application data of PANI-coated linen/cotton blend yarn samples

In PANI-coated yarn samples’ CO gas sensor applications, the percentage changes in conductivity when exposed to 400 ppm, 600 ppm, and 800 ppm CO gas from a gas-free environment are presented in Fig. 15. For acrylic, viscose, cotton, linen/PES, linen/cotton, PES, and polyamide yarns, the conductivity changes were determined to be 0.20, 0.40, 0.69, 0.81, 0.94, 1.26, and 2.75 times, respectively, when 400 ppm of CO gas was introduced into the environment. The conductivity values increased significantly with the concentration of CO gas in the environment. For the polyamide yarn sensor, it is observed that the conductivity, which increased by 2.75 times when 400 ppm of gas was introduced, increased up to 4.7 times when 800 ppm of gas was introduced. Sensor sensitivity varied depending on the concentration of gas in the medium. For sensitivity detection, when 400 ppm of CO gas was introduced into the medium, a conductivity change of 69% was observed in cotton yarn sensors. Similarly, when 600 ppm of CO gas was introduced, this value increased to 120%, and with 800 ppm of CO gas, it rose to 216%. The highest sensor sensitivity was observed in polyamide with a conductivity change of 470%, followed by polyester with 307%, and cotton with 216% at 800 ppm CO concentration.

Fig. 15
figure 15

Percentage conductivity changes in PANI-coated yarn samples in CO gas applications

The response times and recovery times of seven different yarn samples coated with PANI to 400 ppm, 600 ppm, and 800 ppm CO gas when used as gas sensors are presented in Fig. 16. When 400 ppm CO gas is introduced into the gas chamber, the average response times can be listed as Acrylic, Cotton, Viscose, Polyamide, Linen/Cotton, Linen/PES, and PES, respectively. Both reaction and recovery times change as the concentration of the gas increases. Regarding the response time, Cotton shows the most significant change with ambient gas concentration, while the response time of PES yarn sensors remains constant at 110 s for all concentrations. After exposure to 400 ppm, 600 ppm, and 800 ppm CO gas, the average recovery times were 94 s, 77 s, and 74 s, respectively. When the recovery times at all concentrations are analyzed, it is seen that acrylic and polyamide yarn gas sensors have recovery times well below the average. Overall, considering both recovery and response times at all concentrations, acrylic yarn sensors provide the fastest response.

Fig. 16
figure 16

Response and recovery times of PANI-coated yarn samples in CO gas applications

3.1.5 NH\(_3\) Gas sensor application experiments

The semiconductor properties of PANI-coated cotton yarn samples were determined by placing them in the sensor connection point in the gas chamber for 240 s under room conditions. NH\(_3\) gas was introduced into the gas chamber for 120 s to measure the sensor yarns’ reactions to the given gas. The NH\(_3\) gas sensor application data for PANI-coated cotton yarn samples are provided in Fig. 17. It was determined that the voltage on the sensor resistance was around 1.5 V under room conditions. After the introduction of NH\(_3\) gas into the environment, the voltage on the resistance dropped to 0.2 V after 80 s. At 360 s, when NH\(_3\) gas was removed, the voltage on the sensor resistance increased to 1 V after 240 s. When gas was introduced for the second time, the voltage on the sensor resistance decreased again to 0.22 V after 120 s. After gas release, this value was measured as 0.95 V after 160 s. When gas was introduced for the third time, the voltage on the sensor resistance dropped to 0.1 V after 120 s, and there was no increase in this value after gas release.

Fig. 17
figure 17

PANI-coated cotton yarn samples NH\(_3\) gas application data

The NH\(_3\) gas sensor application data for PANI-coated polyester yarn samples are presented in Fig. 18. Under room conditions, the voltage on the sensor resistance was measured at 1.05 V. After introducing NH\(_3\) gas into the environment, the voltage on the resistance dropped to 0.4 V after 40 s. It was observed that the voltage increased to 0.6 V 40 s after NH\(_3\) gas release. When gas was introduced for the second time, the voltage on the sensor resistance decreased again to 0.22 V within 30 s. After gas release, there was no significant change in the voltage on the sensor resistance. Following the introduction of gas for the third time, the voltage on the sensor dropped to 0.05 V, indicating that PANI-coated polyester yarns lost their semiconductor properties.

Fig. 18
figure 18

PANI-coated polyester yarn samples NH\(_3\) gas application data

The NH\(_3\) gas sensor application data for PANI-coated viscose yarn samples are provided in Fig. 19. Under room conditions, the voltage on the sensor resistance was measured at 0.8 V. After introducing NH\(_3\) gas into the environment, the voltage on the resistance dropped to 0.15 V after 20 s. It was observed that the voltage increased to 0.3 V 20 s after NH\(_3\) gas release. When gas was introduced for the second time, the voltage on the sensor resistance decreased again to 0.1 V. After gas release, there was no significant change in the voltage on the sensor resistance, and it was measured at 0.18. When gas was introduced for the third time, the voltage on the sensor increased to 0.2 V. When gas was released from the environment, this value was measured at 0.1 V, and it was determined that the data for the third gas entry and exit were not meaningful.

Fig. 19
figure 19

PANI-coated viscose yarn samples NH\(_3\) gas application data

The NH\(_3\) gas sensor application data for PANI-coated acrylic yarn samples are presented in Fig. 20. Under room conditions, the voltage on the sensor resistance was measured at an average of 1.5 V. After introducing NH\(_3\) gas into the environment, the voltage on the resistance dropped to 0.6 V after 120 s. It was observed that the voltage increased to 0.75 V 5 s after NH\(_3\) gas release, and after 100 s, it further rose to 0.95 V. When gas was introduced for the second time, the voltage on the sensor resistance momentarily dropped to 0.6 V and then further decreased to 0.4 V after 80 s. After gas release, the voltage on the sensor resistance continued to drop, reaching 0.2, and after the third gas entry into the environment, it further decreased to 0.1 V. The data obtained from the sensor after the second gas entry into the environment were irregular and meaningless.

Fig. 20
figure 20

PANI-coated acrylic yarn samples NH\(_3\) gas application data

The NH\(_3\) gas sensor application data for PANI-coated polyamide yarn samples are provided in Fig. 21. Under room conditions, the voltage on the sensor resistance was measured at 0.7 V. After introducing NH\(_3\) gas into the environment, the voltage on the resistance dropped to 0.45 V after 120 s. It was observed that the voltage increased to 0.5 V immediately after NH\(_3\) gas release. When gas was introduced for the second time, the voltage on the sensor resistance gradually decreased to 0.35 V over 120 s. In the second gas release, the third gas entry, and the third gas release, this value continued to decrease, indicating that PANI-coated polyamide yarns lost their semiconductor properties.

Fig. 21
figure 21

PANI-coated polyamide yarn samples NH\(_3\) gas application data

The NH\(_3\) gas sensor application data for PANI-coated linen/polyester blend yarn samples are presented in Fig. 22. Under room conditions, the voltage on the resistance of the blend yarn sensor was measured at 1.4 V. After introducing NH\(_3\) gas into the environment, the voltage on the resistance dropped to 0.6 V after 40 s, and it was observed that this value did not significantly change after gas release. When gas was introduced for the second time, the voltage on the sensor resistance dropped to 0.2 V, and it was determined that this value did not significantly change in the second gas release, the third gas entry, and the third gas release.

Fig. 22
figure 22

PANI-coated linen/polyester blend yarn samples NH\(_3\) gas application data

The NH\(_3\) gas sensor application data for PANI-coated linen/cotton blend yarn samples are provided in Fig. 23. Under room conditions, the voltage on the resistance of the blend yarn sensor was measured at 1.3 V. After introducing NH\(_3\) gas into the environment, the voltage on the resistance dropped to an average of 0.6 V, and it was observed that this value did not significantly change after gas release. When gas was introduced for the second time, the voltage on the sensor resistance dropped to 0.25 V, and it was observed that this value continued to decrease in the second gas release, the third gas entry, and the third gas release.

Fig. 23
figure 23

PANI-coated linen/cotton blend yarn samples NH\(_3\) gas application data

The performance of PANI-coated yarn samples in NH\(_3\) gas sensor applications can be analyzed based on the conductivity changes shown in Fig. 24. The samples were evaluated according to the data obtained when exposed to 400 ppm, 600 ppm, and 800 ppm NH\(_3\) gas in an environment without gas. When 400 ppm NH\(_3\) gas was introduced into the environment, a significant decrease in conductivity values was observed in all yarn samples. The most pronounced decrease was observed in the cotton yarn sample, showing a 600% reduction in conductivity values. After introducing 600 ppm gas, recovery was not observed in samples other than the cotton yarn sample. In this case, distinct observations regarding conductivity changes were not made in the samples other than the cotton yarn. These results reveal the conductivity variations in PANI-coated yarn samples when exposed to NH\(_3\) gas. The more pronounced decrease in conductivity values of the cotton yarn indicates its higher sensitivity to NH\(_3\) gas, suggesting its effective use in sensor applications. Therefore, the highest conductivity changes for sensor sensitivity were observed in 655% cotton, 369% viscose, and 151% linen/polyester yarn sensors, respectively, when NH\(_3\) gas was added to the medium at a concentration of 400 ppm. When the NH\(_3\) gas concentration was increased, the conductivity changes of the yarn samples for sensor sensitivity decreased and then the samples did not show semiconducting properties

Fig. 24
figure 24

Percentage conductivity changes in PANI-coated yarn samples in NH\(_3\) Gas Applications

When PANI-coated yarn samples are used as gas sensors, their response times and recovery times to 400 ppm, 600 ppm, and 800 ppm NH\(_3\) gases are presented in Fig. 25. Upon introducing 400 ppm NH\(_3\) gas into the gas chamber, the response times of the samples can be ranked as Acrylic, polyamide, Cotton, PES, Linen/PES, Linen/cotton, and viscose, based on their average response times. When the gas concentration in the environment exceeds 600 ppm, no recovery is observed in the samples other than cotton, and therefore, response and recovery times could not be calculated. For cotton yarn sensors, the average response times after exposure to 400 ppm, 600 ppm, and 800 ppm NH\(_3\) gases are calculated as 98 s, 112 s, and 117 s, respectively. No recovery is observed in cotton yarn sensors after exposure to 800 ppm gas, and their conductivity values approach zero, similar to other yarn sensors.

Fig. 25
figure 25

Response and recovery times of PANI-coated yarn samples in NH\(_3\) gas applications

3.1.6 Butane gas sensor application experiments

PANI-coated yarn samples were placed at the sensor connection point in the gas chamber under room conditions, and measurements were conducted at a fixed 5V voltage. After 240 s, the environment was exposed to 400 ppm of butane gas for 120 s. This cycle was repeated for 600 ppm and 800 ppm of butane gas. However, no significant conductivity change was observed in all PANI-coated yarn samples upon the introduction of butane gas into the environment. Comparative gas sensor data regarding the introduction and removal of butane gas in the environment for PANI-coated seven different yarn samples under room conditions are presented in Fig. 26. Due to the absence of observed conductivity changes, the use of the produced yarn gas sensors for the detection and sensor applications of butane gas was not deemed suitable.

Fig. 26
figure 26

PANI-coated yarn samples butane gas application data

4 Conclusions

This study involved the characterization of different yarn surfaces through the coating of polyaniline (PANI) onto the yarn surfaces. Morphological analysis confirmed that PANI was uniformly coated on the yarn surfaces and was suitable for sensor applications. FTIR analysis examined the molecular structure, functional groups, and chemical bonds of PANI-coated yarns. It was determined that PANI successfully integrated into the surfaces of the yarns, containing characteristic components such as C–H, aromatic ring, C=N, and N–H, and that chemical stability and structural regularity were ensured by band intensity and width. The produced yarn gas sensors were investigated for their ability to respond to carbon monoxide and ammonia gases. Gas sensor applications were conducted using a specialized gas detection and control system. Definitive evidence regarding the effectiveness of PANI-coated yarn sensors in detecting butane gas was not obtained. This indicates a limited sensitivity or response capability to this type of gas. All types of yarns showed an increase in conductivity when exposed to CO gas. However, polyamide yarn exhibited the highest conductivity increase compared to others. PANI-coated yarns displayed sensitivity to NH\(_3\) gas, leading to a decrease in conductivity values. Cotton yarn provided the highest sensitivity to NH\(_3\) compared to others. In CO gas applications, acrylic yarn sensors exhibited the fastest response time, while cotton yarn sensors demonstrated the most consistent response and recovery times. In NH\(_3\) gas applications, cotton yarn sensors showed the fastest response time, but no recovery was observed after exposure to 800 ppm NH\(_3\). PANI-coated yarn sensors can be used as an alternative repeatable gas sensor for CO gas and as a disposable gas sensor for NH\(_3\) gas. It is understood that the produced yarn gas sensors contribute to the development of sensors that can operate integrated into wearable technologies with sensitive detection at room temperature and short response times.