1 Introduction

Magnesium alloys have high strength, low density, high elastic modulus, fast heat dissipation, good impact resistance and biocompatibility, so they have been widely used in many fields such as aerospace, transportation, electronic equipment, health care and so on [1,2,3]. However, magnesium alloys have a multi-phase structure, high chemical activity and low electrode potential, resulting in poor corrosion resistance [4, 5]. Due to this drawback, it limits its application to some fields or special environments. To date, surface treatment technology is an economical and promising approach that has been employed to improve the anti-corrosion performance of magnesium alloys [6], such as chemical conversion [7], electrodeposition [8], micro-arc oxidation [9], hydrothermal treatment [10], sol–gel method [11] and spraying method [12]. HA [13] has high biocompatibility and bioactivity. Medical applications for the process of preparing HA superhydrophobic coatings on magnesium alloy surfaces are possible. HA is non-toxic and degradable, so it can also be used in the oil-water separation of edible oil [14], which is expected to achieve massive output. A potential application for HA exists in the fields of photocatalysis [15] and wastewater treatment [16]. Inspired by the natural water repellency of lotus leaves, an increasing number of researchers have focused on studying superhydrophobic effect [17]. The excellent corrosion resistance of superhydrophobic HA coating is due to the formation of an air diaphragm when the surface is in contact with water, which is equivalent to an air cushion, preventing direct contact between the substrate and water, so it plays a role in protecting the substrate. In general, the microstructure and chemical composition of the coating have an impact on the wettability of the coating surface [18], suggesting that researchers can change the wettability of the coating based on these two aspects. Following the pioneering works, the micro-morphology of the existing superhydrophobic coatings has rod-like, needle-like, petal-like, layered, flake structures and so on [19,20,21]. These special morphologies play a great role in water repellency and corrosion resistance. Considering that the coating may be subjected to harsh environments such as high temperature, it is easy to damage or degrade the surface and lose its superhydrophobic properties. Therefore, the stability of superhydrophobic coating is particularly important if it is used in high-temperature environments. It is necessary to evaluate the superhydrophobic coating from the perspective of high temperature stability [22]. In addition to corrosion resistance and stability, other special properties of superhydrophobic coatings have also attracted the attention of researchers, such as self-cleaning properties [23]. Recently, Tang et al. [24] prepared a polyurethane/MoS2 coating with a mastoid-like rough structure by spraying, which has efficient self-cleaning properties. Latthe et al. [25] prepared a silica superhydrophobic coating by the sol–gel method, and the antifouling ability was significantly enhanced. Through deposition and heat treatment, Isimjan et al. [26] created a TiO2/SiO2 coating on the surface of stainless steel with a micro-nano rough structure. After low-energy modification, it achieved a superhydrophobic effect and could be applied to the self-cleaning of pipeline surfaces. Lai et al. [27] successfully prepared porous hollow HA microspheres by an ion exchange process under hydrothermal conditions. However, there are few studies on the application of HA in the field of superhydrophobicity. Rojaee et al. [28] used the sol–gel method to coat HA coating on the surface of AZ91 magnesium alloy. It has good corrosion resistance in a simulated body fluid environment. By using a spraying technique, Abdullah et al. [29] produced HA coating on the surface of AZ31 magnesium alloy, but the cost of directly spraying HA powder was too high, and there were still defects in bonding strength and composition. Kang et al. [30] prepared HA superhydrophobic coating by the hydrothermal method, which has excellent corrosion resistance. In general, the preparation of superhydrophobic coatings by hydrothermal treatment is carried out under high pressure and temperature, which is not easy to operate and has a high energy consumption. The cost of the spraying or template method is too high. In contrast, the combination of electrodeposition and chemical immersion is a cheap, simple and relatively safe technique to create the superhydrophobic HA coating.

In this experiment, HA coating was obtained by simple electrodeposition, chemical immersion and then chemically modified with STA anhydrous ethanol solution to obtain a superhydrophobic HA coating with flake morphology. Reaction temperature affecting coating wettability was studied by the single factor control variable method. In addition, the self-cleaning, high-temperature stability, mechanical stability, and anti-corrosion properties of the sample were evaluated by various tests.

2 Experimental

2.1 Materials

AZ31B magnesium alloy was purchased from Guangdong Hongdi Metal Materials Co., Ltd., and cut into a rectangular sample with a size of 40 mm × 20 mm × 2 mm. Deionized water was laboratory-made. Ammonium dihydrogen phosphate (NH4H2PO4, AR), hydrochloric acid (HCl, AR), calcium chloride (CaCl2, AR), anhydrous ethanol (CH3CH2OH, OR), sodium hydroxide (NaOH, AR), potassium dihydrogen phosphate (KH2PO4, AR), sodium chloride (NaCl, AR), magesium sulfate (MgSO4, AR), STA (C18H36O2, AR), potassium chloride (KCl, AR), gluose (C6H12O6, AR), sodium hydrogen phosphate heptahydrate (Na2HPO4·7H2O, AR) and sodium bicarbonate (NaHCO3, AR) were purchased from Shanghai Sinopharm Chemical Reagent Co., Ltd.

2.2 Preparation of Superhydrophobic HA Coating

The superhydrophobic HA coating was prepared on AZ31B magnesium alloy by electrodeposition, chemical immersion and low-energy modification. This preparation method has the advantages of low price, environmental protection and simple operation. The schematic diagram is shown in Fig. 1.

Fig. 1
figure 1

The schematic diagram of superhydrophobic HA coating on magnesium alloy surface

2.2.1 Pretreatment

The surface of the magnesium alloy sample was mechanically polished with 240#, 600#, 1000#, 1500#, 2000# SiC sandpaper in turn. The sample was placed in deionized water and dehydrated alcohol, respectively, for 10 min of ultrasonic cleaning to get rid of the debris and oil on the surface. Finally, the sample was dried by cool air after it was taken out.

2.2.2 Preparation of HA Coating

A 100 mL mixed solution containing 0.042 mol/L CaCl2 and 0.025 mol/L NH4H2PO4 was fully stirred to mix well, and then the pH of the electrodeposition aqueous solution was adjusted to 4 with a 10 vol% HCl solution. The polished magnesium alloy sample was used as the cathode, graphite as the anode and the electrode spacing was 2 cm. Next, the deposition was performed at a current density of 0.5 mA/cm2 in a solution rising up to 80 °C for 1 h. After that, the sample was rinsed with deionized water, then placed in a 100 mL 0.25 mol/L NaOH solution and heated in a water bath at 80 °C for 3 h. Sealing the beaker with film to prevent solution evaporation. Subsequently, the sample was washed with deionized water and dried in cold air. Finally, the HA coating on magnesium alloy was obtained.

2.2.3 Low Surface Energy Modification

The HA-coated sample was placed in the 0.025 mol/L STA anhydrous ethanol solution at room temperature for 2 h. Then the sample was dried for 1 h in a vacuum oven at 80 °C to obtain a superhydrophobic coating with a micro-nano scale rough structure.

2.3 Characterizations

The microscopic structure of the sample surface was observed by scanning electron microscopy (SEM, Nova Nano SEM450, FEI Inc.), and the effect of chemical immersion reaction parameters on the microstructure was studied. The elemental species and content of the sample surface were qualitatively measured by X-ray energy spectrometry (EDS, Aztec, Oxford). X-ray diffractometer (XRD, X’Pert PRO MRD, PANalytical) was used to examine the crystal structure of the sample surface. The ray source was Cu target and the scanning range was 15–75°. Fourier transform infrared spectroscopy (FTIR, NEXUS, Thermo) was used to determine the characteristic peaks on the surface of the sample to analyze the corresponding organic groups. Measuring the WCA of a 3 µL water droplet on the sample surface using a dynamic/static contact angle meter (SL200B, KINO, USA). The average of five separate places made up the measured WCA. The sample was placed on the glass slide (the length of the glass slide (L) is 60 mm) and let a water drop (3 µL) stay on the sample. To facilitate the rolling off of the water droplets from the sample, the left side of the slide was gradually elevated. The height (H) at which the slide was lifted when the water droplets began to roll was measured. By utilizing the inverse trigonometric function formula \(\left( {{\text{SA}} = {\text{arcsin}}\frac{{\text{H}}}{{\text{L}}}} \right)\) to derive the size of SA. A differential thermal analyzer TG/DTA6300 was used to measure the thermogravimetric (TG) and differential thermogravimetric (DTG) curves from 30 °C to 400 °C with a 5 °C/min dynamic temperature rise rate.

3 Results and Discussion

3.1 Reaction Mechanism

H 2 PO 4 could be ionized to form HPO42−and PO43−. Ca2+, HPO42− and water molecules to form dihydrate calcium phosphate (DCPD) in the electrodeposition reaction. A small amount of Ca2+, PO43−and OH to form HA, but the main chemical reaction in the electrodeposition is the formation of DCPD, and the equations are as follows:

$$2{\text{H}}_{2} {\text{PO}}_{4}^{ - } + 2e^{ - } \to 2{\text{HPO}}_{4}^{{2 - }} + {\text{H}}_{2} \uparrow$$
(1)
$${\text{Ca}}^{{2 + }} + {\text{HPO}}_{4}^{{2 - }} + 2{\text{H}}_{2} {\text{O}} \to {\text{CaHPO}}_{4} \cdot 2{\text{H}}_{2} {\text{O}}$$
(2)

The electrodeposition provided the calcium source and phosphorus source for subsequent chemical immersion. In the chemical immersion reaction, DCPD reacted with NaOH at 80 °C to form HA. The reaction was maintained for 3 h until it was completed. The reaction equations of chemical immersion are as follows, and the crystal structure of HA is shown in Fig. 2.

$$2{\text{HPO}}_{4}^{{2 - }} + 2e^{ - } \to 2{\text{PO}}_{4}^{{3 - }} + {\text{H}}_{2} \uparrow$$
(3)
$$10{\text{Ca}}^{{2 + }} + 6{\text{PO}}_{4}^{{3 - }} + 2{\text{OH}}^{ - } \to {\text{Ca}}_{{10}} \left( {{\text{PO}}_{4} } \right)_{6} \left( {{\text{OH}}} \right)_{2}$$
(4)
Fig. 2
figure 2

Crystal structure of HA.

3.2 Microstructure of Superhydrophobic HA Coating

Figure 3a showed the morphology of the magnesium alloy substrate after polishing. It could be seen that there were some scratches and abrasive chips on the surface. The surface after electrodeposition had grown a radiated flakes-like structure, as presented in Fig. 3b. After chemical immersion, as shown in Fig. 3c, the surface structure became disordered flakes, like scattered petals. After the modification of the low-energy modifier STA, the microstructure did not change significantly, and it was still a disordered flake structure, as shown in Fig. 3d.

Fig. 3
figure 3

SEM images of a magnesium alloy substrate, b electrodeposited coating, c unmodified HA coating and d modified HA coating

To investigate how reaction temperature affects the morphology of the coatings and wettability on surfaces, the electrodeposited samples were immersed in NaOH solution at 20 °C, 40 °C, 60 °C, 80 and 100 °C for 3 h, respectively. In Fig. 4, the morphology is shown. The coating flake structure was large and the distribution was scattered when the reaction temperature was 20 °C, as shown in Fig. 4a. The size of the HA flake structure became smaller, dense and evenly distributed with the increase in temperature. Figure 4d showed that the growth effect of HA was the best until the reaction temperature reached 80 °C. When the temperature reached 100 °C, the size of HA becomes loose again.

Fig. 4
figure 4

The SEM images of HA coating at different reaction temperatures: a 20 °C. b 40 °C. c 60 °C. d 80 °C. e 100 °C. f 80 °C (enlarged view)

The WCA of the sample surface, overall, exhibited an increasing trend as the temperature rose. When the reaction temperature reached 80 °C, the WCA was the highest, but after 80 °C, the WCA decreased slightly. The growth of HA was better generated at this temperature, thus providing a greater source of hydrophobic groups for subsequent modification by STA. The reason might be that the growth of the HA flake structure increased the contact area between water droplets and the coating (Fig. 5).

Fig. 5
figure 5

The WCA of HA coating surface at different reaction temperatures

3.3 Chemical Compositions of HA Coating

The wettability of a surface is also influenced by its chemical composition. Therefore, it is crucial to identify and clarify the chemical components present in the coating. Analysis using Energy Dispersive Spectroscopy (EDS) revealed that the coating predominantly consisted of calcium (Ca), oxygen (O), and phosphorus (P). In addition, trace amounts of zinc (Zn), aluminum (Al), and magnesium (Mg) metal elements were also detected, as depicted in Fig. 6.

The Ca/P atomic ratio in HA is non-stoichiometric and can be influenced by the synthesis method employed. In standard HA, the Ca/P atomic ratio is approximately 1.67 [31]. A Ca/P ratio lower than 1.67 indicates calcium-deficient HA, while a ratio higher than 1.67 indicates phosphorus-deficient HA. In the present experiment, the calculated Ca/P atomic ratio was determined to be 1.809, indicating that the coating consisted of phosphorus-deficient HA. This observation can be attributed to the increased consistency of HA on the magnesium alloy substrate, which resulted in a small amount of dicalcium phosphate dihydrate (DCPD) remaining at the bottom of the coating. As the DCPD was unable to react with sodium hydroxide (NaOH) and convert into HA, it led to a deficiency in phosphorus within the coating structure.

Fig. 6
figure 6

a EDS maps of superhydrophobic HA coating and b EDS spectra of superhydrophobic HA coating

Figure 7 showed the XRD pattern of the magnesium alloy substrate, the electrodeposited coating, and the HA coating. There were three diffraction peaks at the 2θ of 22.35°, 29.26° and 32.83° in the XRD pattern of the electrodeposited coating, besides the diffraction peaks of the AZ31B substrate, corresponding to DCPD. After the chemical immersion reaction, the diffraction peaks ascribed to HA at 27.35° and 32.14° were observed, while the characteristic peaks of DCPD had disappeared.

Fig. 7
figure 7

XRD spectra of magnesium alloy substrate, electrodeposited coating and superhydrophobic coating

To demonstrate that the HA coating was low-energy modified by STA, FTIR analysis was needed. Figure 8 showed the FTIR analysis results of the coating surface and STA. The infrared spectra of superhydrophobic HA coating and STA were curves a and b, respectively. In the high-frequency region, the spectra of STA and superhydrophobic HA coatings had a common absorption peak at 2848 cm−1. The absorption peak, which corresponded to the asymmetric stretching vibration of C–H, was found at 2916 cm−1, while another absorption peak, which corresponded to the symmetric stretching vibration of C–H, was found at 2848 cm−1. The C–H asymmetric vibration of the superhydrophobic coating was lightly moved at the corresponding location, and the absorption peak was found at 2918 cm−1, which indicated that the HA coating surface was successfully modified by STA. In the low-frequency region of the STA infrared spectrum curve, the typical peaks of carboxyl (–COOH) were reflected by the absorption peaks at 1702 cm−1 and 1471 cm−1. However, there was no carboxyl absorption peak in the low-frequency region of the infrared spectrum of the superhydrophobic HA coating. Two new absorption peaks were generated on the superhydrophobic coating surface, which were located at 1573 cm−1 and 1470 cm−1, respectively. These two new absorption peaks represented the presence of –COO–, which was the appearance of the same carboxylate on the surface of the sample. It was also proven that STA existed on the superhydrophobic coating surface in a chemical bond-binding manner. It could be seen that the water droplets spread completely on the surface of the HA coating, which was due to the large number of hydrophilic groups (-OH) on the surface. After modification with STA, the hydrophilic group of the HA coating was transformed into the hydrophobic group. The WCA of the coating surface reached 160.21°, which further indicated that STA was successfully modified on the HA coating.

Fig. 8
figure 8

FTIR of STA a and HA superhydrophobic coating b

3.4 Wettability of Superhydrophobic HA Coating Surface

Figure 9a displayed the WCA of the superhydrophobic sample surface, showing water droplets standing on the superhydrophobic coating surface. The WCA value was measured to be 160.21°, and the SA was approximately 2°. In Fig. 9b, the rolling process of water droplets on the sample surface was depicted. The water droplet maintained a round shape and did not wet the surface. This behavior could be attributed to the formation of an air cushion created by the rough micro-nanostructures of the superhydrophobic coating. The presence of this air cushion effectively protected the substrate from being wetted by water droplets. The classical Cassie-Baxter equation can explain this phenomenon [32].

$$\cos \theta _{c} = f_{0} \cos \theta _{0} + f_{0} - 1$$
(5)

where \({f}_{0}\) is the area fraction of liquid–solid contact, and \({\theta }_{0}\)is the WCA of the STA-modified AZ31B magnesium alloy substrate in a stable state (the fixed value is about 118.6°) [33]. \({\theta }_{c}\) is the WCA of the superhydrophobic HA coating, about 160.21°. It can be calculated that the liquid-solid contact area fraction \({f}_{0}\) is about 11.3%, and the WCA of water droplets and the air retained in the rough structure is 88.7%.

Fig. 9
figure 9

The state of water droplets on the superhydrophobic coating surface

When the superhydrophobic sample was immersed in deionized water, a striking silver mirror phenomenon was observed on the coating surface, as illustrated in Fig. 10 [34]. This phenomenon arose from the total reflection of light within the deionized water by the air cushion presented on the superhydrophobic HA coating. In contrast, the magnesium alloy substrate did not exhibit this reflective behavior.

Fig. 10
figure 10

Phenomenon of magnesium alloy substrate and superhydrophobic HA coating sample immersed in water

3.5 Low Adhesion Property

Indeed, low adhesion is a significant characteristic of superhydrophobic coatings [35]. The surface of the coating exhibits minimal adhesion to water droplets, providing energy-saving benefits and reducing drag. This property has great potential for research and application in liquid transportation. The adhesion property of the HA coating was measured using a contact angle measuring instrument. The deionized water with a volume of 3 µL was absorbed by the syringe, and the water droplets were suspended in the needle position as shown in Fig. 11a. The sample stage was incrementally raised towards the water droplets until it reached the position shown in Fig. 11b. At this point, the sample was further raised until the needle exerted a squeezing effect on the water droplets. As depicted in Fig. 11d, the water droplets were compressed and deformed. Subsequently, the sample stage was gradually lowered. The contact area between the water droplets and the coating increased slightly throughout the entire process, from initial contact to the squeezing of the superhydrophobic HA coating, but it was still observed that the water droplets adhered well to the needle, and no trace of water was left on the surface of the sample. Therefore, the experimental results clearly indicate that the coating exhibits a notable low adhesion property.

Fig. 11
figure 11

Test process of low adhesion property

3.6 Self-Cleaning Property

The self-cleaning property plays a vital role in preventing fouling and significantly extends the application possibilities of magnesium alloys. To compare the effects, a superhydrophobic sample and a magnesium alloy substrate were placed at a slight incline, where the tilt angle is about 7°. Using a rubber-headed dropper, 10 µL of mud was carefully dropped onto the sample surfaces to observe the differences. Figure 12a indicated that the slurry spread and polluted the surface of the magnesium alloy substrate, whereas on the superhydrophobic HA coating, as shown in Fig. 12b, the slurry rolled down in a spherical shape without polluting the surface. To simulate solid pollutants, fly ash particles were evenly dispersed on the sample surface. As depicted in Fig. 13, it is evident that when water droplets were applied to the superhydrophobic sample surface, they rolled down, effectively carrying away the pollutants and meeting the self-cleaning criteria. In contrast, the behavior on the magnesium alloy substrate differed significantly, with a noticeable water droplet spreading across the surface.

Fig. 12
figure 12

Self-cleaning properties of magnesium alloy substrate a and superhydrophobic HA coating b for liquid contaminants

Fig. 13
figure 13

Self-cleaning properties of magnesium alloy substrate a and superhydrophobic HA coating b for solid contaminants

In addition, the principle of antifouling for superhydrophobic coatings is further elucidated theoretically. On a superhydrophobic surface, particles interact with water droplets through various forces including gravity (G), friction (F), adhesion (Fad), and interfacial forces (Fγ) [36]. The gravity of the fly ash particles is expressed as \(\rho g\frac{4}{3}\pi {R}^{3}\), where its density is 0.90 g/cm3 [37], and the component of the interface force in the perpendicular direction can be expressed as [38]:

$${F}_{\gamma }^{Z}=2\pi R\gamma {sin}^{2}\left(90^\circ +\frac{\alpha }{2}\right)\left|\text{cos}{\theta }_{c}\right|$$
(6)

Among them, R represents the particle radius, which interacts with the surface tension of water (72 nN/µm at 25 °C). Additionally, α symbolizes the contact angle between water droplets and particles, which corresponds to the water contact angle exhibited by the superhydrophobic coating surface.

The magnitude of the adhesion force (Fad) is influenced by the particle size. It is assumed that there exists a linear relationship between Fad and the particle radius R. Therefore, the relationship between these two variables can be expressed as follows [39]:

$$\frac{{F}_{\gamma }^{Z}}{{F}_{ad}+G}=\frac{{F}_{\gamma }^{Z}=2\pi R\gamma {sin}^{2}(90^\circ +\frac{\alpha }{2})\left|{cos}{\theta }_{c}\right|}{(kR+C)+\rho g\frac{4}{3}\pi {R}^{3}}$$
(7)

where k and C are coefficients and constants related to the particle type and surface properties, respectively. According to this equation, when the sample is tilted at an angle, the value of \({F}_{\gamma }^{Z}\)/(Fad+G) is greater than 1 for a wide range of R and k, indicating that the upward force acting on the particles in the vertical direction is much greater than the downward force. So the rolling liquid can easily carry away surface contaminants and meet self-cleaning requirements. Figure 14 shows a schematic diagram of the forces on the fly ash.

Fig. 14
figure 14

Force diagram of pollutant particles on superhydrophobic surface

3.7 The Stability of Superhydrophobic HA Coating

The stability of the coating in practical applications has garnered increasing attention. The stronger the stability, the longer the service life of the coating. In this experiment, the stability testing encompasses both mechanical stability and high-temperature stability.

3.7.1 Mechanical Stability

As illustrated in Fig. 15, a tape-peeling experiment was conducted to evaluate the mechanical stability of the coating. An adhesive tape was applied and pressed onto the sample surface with a 100 g weight for 40 s. The tape was then peeled off, and this process was recorded as one cycle. Figure 16a demonstrated that even after 75 cycles, the WCA remained above 150°, indicating that the coating still possessed superhydrophobic properties. At 80 cycles, the WCA decreased to 148.2°, and the coating is slightly cracked, resulting in the loss of superhydrophobicity. However, the coating exhibited good hydrophobic properties, indicating satisfactory mechanical stability. As the number of peelings increased, the coating gradually fell off, the microscopic morphology as shown in Fig. 16b, which was the reason for the decline in superhydrophobic performance.

Fig. 15
figure 15

Simulation of tape stripping experiment

Fig. 16
figure 16

a The change of WCA of superhydrophobic coating in tape-peeling test; b SEM image of the coating after tape-peeling test

3.7.2 High-Temperature Stability

In this experiment, the superhydrophobic sample was subjected to different temperatures in a vacuum oven for 2 h. After cooling to room temperature, the sample was taken out, and the WCA was recorded at various holding temperatures until the surface lost its superhydrophobicity, as shown in Fig. 18a. The temperature was increased by 50 °C increments. The results showed that the WCA reached a plateau at around 155° before reaching 200 °C, indicating that the superhydrophobicity was maintained within this range. Even when the temperature was further increased to 225 °C, the WCA remained relatively high, at approximately 149.3°, suggesting that the surface still retained its hydrophobic properties. However, when the temperature reached 250 °C, the superhydrophobicity was completely lost, and the WCA dropped to nearly 0°, indicating a transition to superhydrophilicity. Based on the observations from Fig. 17, it can be seen that there were no significant changes in the flake structure of the HA coating before and after the high-temperature test. Furthermore, as depicted in Fig. 18b, the TG curve analysis of the surface modifier STA suggested that the decline in superhydrophobicity of the sample could be attributed to the gradual thermal decomposition of the STA coating at 200 °C. This implied that the increase in temperature caused the surface modifier STA to undergo thermal decomposition, which subsequently led to the loss of its superhydrophobic properties.

Fig. 17
figure 17

a SEM image before high temperature test; b SEM image after high temperature test

Fig. 18
figure 18

a The change of WCA measured on superhydrophobic HA coating after heating treatment; b TG and DTG curves of STA.

3.8 Anti-corrosion Ability

Due to their multi-phase structure and low corrosion potential, magnesium alloys inherently exhibit poor corrosion resistance. This drawback imposes restrictions on the utilization of magnesium alloys across various sectors. However, the challenge of weak anti-corrosion performance in magnesium alloys can be effectively addressed by applying a superhydrophobic coating to their surface.

3.8.1 Electrochemical test

Electrochemical experiments serve as a means to evaluate the anti-corrosion properties of superhydrophobic samples. In this study, the corrosion resistance of the samples was tested using the CS310H electrochemical workstation provided by Wuhan Kesite Instrument Co., Ltd. The corrosion solution used in these tests was Hank’s solution [40], and the chemical constituents of this solution are detailed in Table 1. The electrochemical measurements were conducted using a standard three-electrode system. Specifically, a platinum plate, saturated calomel electrode, and the sample itself (with a surface area of 1 cm2) were employed as the counter electrode, reference electrode, and working electrode, respectively. Evaluation of the instantaneous corrosion rate of the coating was carried out through the application of potentiodynamic polarization curve analysis. In general, a higher corrosion potential (Ecorr) indicates a lower tendency for corrosion, while a lower corrosion current density (icorr) corresponds to a lower corrosion rate [41]. In this study, potentiodynamic polarization curves were recorded using a scanning rate of 0.333 mV/s. Comparing the potentiodynamic polarization curves of the magnesium alloy and the superhydrophobic sample (as depicted in Fig. 19), it can be observed that the superhydrophobic HA coating exhibits a higher corrosion potential than its substrate. Furthermore, the corrosion current density is reduced by approximately two orders of magnitude, as indicated in Table 2. The following formula can be used to determine how well a superhydrophobic coating inhibits corrosion [42]:

$$n=\frac{{i}_{corr, 0}-{i}_{corr,1}}{{i}_{corr,0}}\times 100\text{\%}$$
(8)

where, the corrosion current densities of the superhydrophobic sample and magnesium alloy substrate are represented by icorr,1 and icorr,0, respectively. The corrosion inhibition efficiency n calculated by the formula is 99.21%, indicating that the anti-corrosion property of the superhydrophobic HA coating is obviously stronger than that of the magnesium alloy substrate. By synthesizing a layer of superhydrophobic HA coating on the magnesium alloy, the problem of easy corrosion can be solved, thereby further expanding the application range of magnesium alloy.

Table 1 Chemical constituents of Hank’s solution
Fig. 19
figure 19

Potentiodynamic polarization curves of superhydrophobic HA coating and magnesium alloy substrate

Table 2 Polarization parameters of AZ31B substrate and superhydrophobic HA coating

Electrochemical Impedance Spectroscopy (EIS) was also employed to assess the anti-corrosion capability of the sample. EIS graphs were recorded within a frequency range of 105 Hz to 10−2 Hz. The EIS data was fitted using ZView software. In Fig. 20a, it could be observed that the superhydrophobic HA sample exhibited a considerably larger capacitance ring compared to the magnesium alloy substrate. This observation further supported the superior anti-corrosion ability of the superhydrophobic HA coating [43]. Analyzing Fig. 20b revealed that the impedance modulus Bode diagram indicated a significantly higher low-frequency impedance for the superhydrophobic HA coating compared to the magnesium alloy substrate. The impedance magnitude of the superhydrophobic sample was approximately two orders of magnitude greater than that of the substrate. Examining the phase angle Bode diagram in Fig. 20c, it could be observed that the substrate exhibited only one time constant, while the superhydrophobic sample displayed two distinct time constants. These time constants were attributed to the presence of two electrochemical processes occurring on the superhydrophobic sample [44]. The first electrochemical process was the electrochemical process between the magnesium alloy surface and the electrolyte in the low frequency region, which was also the only electrochemical process of the substrate compared with the superhydrophobic sample. The appearance of the time constant in the high-frequency region could be attributed to the existence of the superhydrophobic petal-like coating. The appearance of a superhydrophobic coating created an air cushion between the coating and the corrosive solution, avoiding direct contact and enhancing its corrosion resistance. To visually demonstrate the corrosion resistance of both the superhydrophobic sample and the magnesium alloy substrate, the EIS experiment data was fitted using an equivalent circuit, as depicted in Fig. 21. Rc represents the resistance of the superhydrophobic HA coating, Rs represents the resistance of the solution and Rct represents charge transfer resistance. CPE stands for constant phase element, which can be expressed as [45]:

$${Z}_{CPE}=\frac{1}{{Y}_{0}{\left(jw\right)}^{n}}$$
(9)

where, Y0, j, w and n denote the CPE constant, imaginary number, angular frequency and dimensionless exponent, respectively. In Fig. 21a, CPEdl represented the double-layer capacitance at the interface between the magnesium alloy substrate and the test solution. Conversely, Fig. 21b illustrated CPEc as the protective barrier provided by the superhydrophobic coating. Table 3 highlighted that the Rct (charge transfer resistance) of the HA superhydrophobic sample was notably high, measuring 3.84 × 105. This value was more than two orders of magnitude greater than that of the magnesium alloy substrate. Hence, it could be deduced that the superhydrophobic HA coating exhibited significant corrosion resistance and effectively protected the magnesium alloy substrate.

Fig. 20
figure 20

EIS results of AZ31B substrate and superhydrophobic sample in Hank’s solution: a Nyquist diagram, b impedance modulus diagram and c phase angle diagram

Fig. 21
figure 21

EIS equivalent circuit diagram of AZ31B magnesium alloy substrate a and HA superhydrophobic sample b

Table 3 Electrochemical impedance parameters of magnesium alloy substrate and HA superhydrophobic sample

3.8.2 Hydrogen Evolution Test

The substrate and the HA superhydrophobic sample were selected as the objects of testing. One side of the sample was exposed to Hank’s solution for 21 days, while the other side was encapsulated with epoxy resin. To ensure consistency, the volume ratio of the solution to the exposed area of the sample was controlled at 20 mL·cm−2. The temperature of Hank’s solution was maintained at 37 ± 0.5 °C using a water bath for heating. For hydrogen collection, a device consisting of a 50 mL inverted funnel and a 25 mL acid burette was assembled. This device was used to collect the released hydrogen. Figure 22 illustrated the schematic diagram of the immersion experimental device. During the soaking period, the volume of hydrogen released from the sample was measured every 42 h, and the changes in hydrogen evolution over time were observed and recorded. To maintain stable ion concentrations in the solution and minimize test errors, the solution was replaced every 7 days. The pH value of the solution in the beaker was measured using a PHS-3 C pH meter. The pH value of Hank’s solution was measured every 24 h, and the changes in pH value over time were observed and recorded. At least three parallel samples need to be set up and the average value of the test results of each sample should be taken.

Fig. 22
figure 22

Hydrogen evolution test device

Based on Fig. 23, the data revealed that during the 21-day immersion in Hanks solution, the magnesium alloy substrate exhibited a substantial hydrogen evolution capacity of 11.6 mL. Additionally, the pH of the solution rose to 9.3, indicating an alkaline environment. However, compared to the HA superhydrophobic sample, the HA superhydrophobic coating showed no noticeable hydrogen evolution during the initial stages of immersion. As the immersion time increased, the superhydrophobic coating gradually deteriorated, and after 12 days, there was a pronounced production of hydrogen. After 21 days, the amount of hydrogen evolution reached approximately 2.1 mL, which was less than 20% of the hydrogen evolution observed on the substrate. The pH of the solution remained relatively stable around at 7.5 throughout one cycle. These findings demonstrate the excellent corrosion resistance of the HA superhydrophobic coating, which plays a crucial role in protecting the magnesium alloy substrate.

Fig. 23
figure 23

Hydrogen evolution curve a and solution pH curve b of the magnesium alloy substrate and HA superhydrophobic sample immersed in Hank ‘s solution

4 Conclusion

In this paper, the HA coating was created via electrodeposition and chemical immersion on the surface of AZ31B magnesium alloy. The WCA reached 160.21° and the SA reached 2.5° after modification by STA. The coating has excellent self-cleaning property, good mechanical stability and high-temperature stability. Furthermore, it demonstrated notable corrosion resistance in electrochemical tests, effectively protecting the substrate and significantly improving the corrosion resistance of the magnesium alloy. The corrosion inhibition efficiency reached an impressive level of up to 99%. This research opened up the possibility of expanding the development and application of magnesium alloys.