1 Introduction

Transparent conducting oxides (TCOs) are electrically conductive and optically transparent materials with comparably low absorption of light. They are mainly used in optoelectronic devices, including solar cells, optoelectrical interfaces and circuits, light-emitting diodes, liquid crystal displays, transparent field effect transistors, etc. [1,2,3]. Mainly used TCOs are zinc oxide (ZnO), Indium tin oxide, Tin oxide (SnO2), Indium Oxide (In2O3), Lanthanum oxide (La2O3), Cadmium Oxide (CdO), etc. ZnO is the most preferred of these due to its high chemical stability, nontoxicity, and ease of preparation. ZnO has a wide direct band gap of 3.37 eV, as well as large thermal conductivity and high catalytic activity, which makes ZnO suitable for applications like laser diodes, solar cells, photocatalysts, and in nonlinear optics [4,5,6,7]. The nature and properties of the synthesized ZnO nanostructure can be controlled by various deposition techniques, which include spin coating [8], magnetron sputtering [9], thermal evaporation [10], spray pyrolysis [11], sol–gel method [12], etc. Among various methods, the sol–gel dip coating method is the most preferable since it is the most cost-effective due to the minimal equipment required, and it can easily produce uniform and high-quality thin films. This method involves the formation of a gel by hydrolysis of a precursor solution followed by condensation. Then the deposition of liquid material on a substrate is done by immersing a substrate into the solution, followed by draining and drying.

The inclusion of suitable dopants can improve or change the characteristics of the host materials. It can be doped with alkaline-earth metals to increase its optical and structural properties (II group elements). It is preferable to dope ZnO with alkaline-earth metal of Magnesium (Mg) for modifying optical and structural properties when compared to other II group elements. Since Mg2+ and Zn2+ ions have a similar ionic radius and also Mg has a wide band gap of 7.7 eV, it helps to tune the bandgap of ZnO. Also, Mg is less hazardous than other elements in the group. Several reports have recently been available on the structural and optical characteristics of Mg-doped ZnO using various deposition methods. Shkir et al. [13] reported the structural, linear, and nonlinear optical characteristics of Mg-doped ZnO film on a glass substrate for optoelectronic applications. They observed an improvement in crystallite size with doping with a proper c-axis orientation with an enhancement in transparency as well as optical bandgap with Mg doping. Also, noticed an enhanced nonlinear optical property with lesser optical limiting value. The effect of Mg concentration on the structural, morphological, and optical properties of nanostructures prepared by the sol–gel process was reported by Priscilla et al. [14]. The samples showed a smaller crystallite size and wider bandgap in contrast to pure ZnO, which contradicts the previous report. As an increase in dopant concentration, a blue shift of near band edge emission to higher energy was observed. Okeke et al. [15] studied the effect of particle size and defects on photocatalytic and antibacterial activities of Mg-doped ZnO nanostructure at various doping concentrations using the biosynthesis method, and the synthesized material showed a spherical and petal-like shape. They noticed an improvement in photocatalytic and antimicrobial properties, which are attributed to surface defects and larger surface areas. Hence, they came to the conclusion that doped samples would be more useful in applications involving photocatalyst detoxification and preventing bacterial biofilm formation on surfaces. The impact of Mg concentration on the structural and optical properties of doped ZnO films was studied by Siregar et al. [16] using the sol–gel spin coating process. The synthesized samples showed a hexagonal wurtzite structure with crystallite sizes between 24 and 28 nm, while the surface morphology showed a structure resembling uniformly grounded granules. The band gap of the deposits was in the range of 3.155 to 3.217 eV. Although there have been studies on the chemical synthesis of Mg-doped ZnO films, there is inconsistency in the structural and optical properties of Mg-doped ZnO films synthesized using the dip coating approach. Also, there is a lack of understanding of the dependence of the structure and surface morphology on the optical characterization of the deposited Mg-doped ZnO films.

In the present work, we focused on the synthesis of Mg-doped ZnO films on glass substrate using the sol–gel dip coating method and examined the role of structure and composition on optical and photoluminescence characteristics of the synthesized films for optoelectronic applications.

2 Experiments

The dip coating method was used to prepare the Zn1−xMgxO (x = 0–0.04) thin film on a glass substrate. 0.1 M ZnO was prepared by dissolving Zinc acetate dehydrate [supplied by Aldrich company and 99.99% purity] in ethanol, and Mg was added to the solution at various concentrations by dissolving Magnesium chloride hexahydrate [supplied by Aldrich company and 99.99% purity] in ethanol. Then the mixture of the two solutions was stirred for 40 min using a magnetic stirrer. Prior to the deposition, the glass substrate was soaked in chromic acid, and then it was washed using soap water, followed by ultra-sonication. Then the solution was deposited on a clean glass substrate by immersing the substrate in solution using a holder. The film was deposited on the substrate at a rate of 2 min/cycle. Then, the film was kept at a temperature of 150 °C, in the furnace for half an hour. The sample number of MZO1, MZO2, MZO3, and MZO4 represents the Zn0.99Mg0.01O, Zn0.98Mg0.02O, Zn0.97Mg0.03O, and Zn0.96Mg0.04O samples, respectively.

The X-ray diffractometer (Rigaku ultima IV) operated at 40 kV was used to quantify the structural characteristics of the prepared samples. The diffractometer uses Cu-Kα radiation of wavelength 1.54 Å and energy 8.042 keV. The two-dimensional images of the film were obtained from the Zeiss scanning electron microscope. The films' widths of 1 µm and 300 nm were focused on obtaining the surface image of the film from a scanning microscope operating at 12 kV EHT and magnification of 40kX. The elemental analysis of the prepared samples was carried out by energy-dispersive spectroscopy technique (EDS). The optical properties of the films were investigated, including transmittance and absorbance curves collected from the Shimadzu UV1800PC; UV–Vis-NIR double beam spectrophotometer working in the 300–750 nm range. All optical investigations were carried out at room temperature. The defect-oriented films were also investigated using photoluminescence spectra obtained with a Jasco FP8300 fluorescence spectrometer equipped with a 450W Xenon lamp. The thickness measurement of the deposits was carried out by using a profilometer (Bruker DektakXT), and it was approximately 500 ± 10 nm.

3 Results and discussion

3.1 Structural analysis

X-ray diffraction spectra (Fig. 1) for Zn1−xMgxO (x = 0–0.04) thin film showed maximum intensity peaks corresponding to (1 0 0), (0 0 2), and (1 0 1) planes, which correspond to characteristic planes of hexagonal wurtzite structure of ZnO according to standard ICDD card no: 01-075-1526. The intensity of the ZnO peaks gradually reduced as Mg doping increased. This suggested a reduction in crystallinity, an increase in distortion, and defects in the host matrix [15]. The spectrum revealed a shift of peaks toward the lower angle region for 1 and 2 at.% doping, however, for 3 and 4 at.%, the peaks shifted toward the higher angle side, confirming the incorporation of Mg2+ ions into the ZnO lattice. The crystallite size of the deposits were calculated by using Debye Scherrer formula, with full-width half maximum (FWHM) at (1 0 1) plane

$$D = \frac{k\lambda }{{\beta \cos \theta }}$$
(1)
Fig. 1
figure 1

XRD pattern of Zn1−xMgxO (x = 0–0.04) thin film deposited on glass substrate

where k is the shape factor which is 0.9 for spherical shape crystallite, λ = 1.5406 Å is the wavelength of X-ray used, θ is the Bragg’s angle, and β is the full width at half maxima in radians. The estimated crystallite size was observed to decrease as Mg content increased (Table 1). This effect could be explained by the fact that, after Mg is integrated into the Zn lattice, Mg2+ ions may hinder the aggregating growth of ZnO nanostructures due to their smaller ionic radii (0.57 Å) compared to Zn2+ (0.74 Å), resulting in a reduction in crystallite size [17]. Similarly, the reduction in crystallite size with different doping contents synthesized by the sol–gel method was reported by Hashim et al. [17], whereas Mia et al. [18] and Rouchdi et al. [19] noticed an enhancement in crystallite size with an increase in Mg concentration deposited on a glass substrate.

Table 1 Estimated structural parameter values from XRD data of Zn1−xMgxO (x = 0–0.04) thin film

From Bragg’s law, we have

$$d = \frac{n\lambda }{{2\sin \theta }},$$
(2)

where d is the interplanar distance and n is the order of diffraction, here n = 1. The calculated value of d for pure and Mg-doped ZnO films is given in Table 1, which is close to the standard value of ZnO.

The lattice parameters (a and c) for hexagonal nanostructures were calculated by using the following relations,

$$\frac{1}{{d_{{\left( {hkl} \right)}}^{2} }} = \frac{{4\left( {h^{2} + k^{2} + hk} \right)}}{{3a^{2} }} + \frac{{l^{2} }}{{c^{2} }}$$
(3)
$$a = \frac{\lambda }{{\surd 3\sin \theta_{{\left( {100} \right)}} }}$$
(4)
$$c = \frac{\lambda }{{\sin \theta_{{\left( {002} \right)}} }},$$
(5)

where (h k l) is miller indices.

The dislocation density is defined as the length of dislocation lines per unit volume. It can be estimated using the relation given by

$$\delta = \frac{1}{{D^{2} }}$$
(6)

The strain induced in the film was calculated using the relation,

$$\varepsilon = \frac{\beta \cos \theta }{4}$$
(7)

Enhancement of the strain and dislocation density values in the films was found with increase of dopant level, which can be related to a decrease in crystallinity. Similar observations were reported by Okeke et al. [15], whereas Rouchdi et al.[19] noticed a reduction of that dislocation density as Mg content increased.

3.2 Morphological and elemental analysis

Figure 2 reveals the surface morphology of the prepared ZnO and Zn0.97Mg0.03O thin films. As can be observed, the samples have highly ordered nanograin structures; nevertheless, as the dopant concentration grew, the surface morphology changed considerably, and the size of the nanograins decreased. The reason for this is the successful insertion of Mg ions into Zn lattice sites. As a result, the Mg atoms enhance the density of nuclei and limit grain growth, which reduces grain size and may have an effect on structural alterations. Similar morphology was observed by Devi et al. [20] for pure ZnO. Similar structural changes were observed by Ameur et al. [21], in which they noticed wrinkled structure for pure ZnO, which shrined after adding Mg.

Fig. 2
figure 2

SEM images of a ZnO and b Zn0.97Mg0.03O thin films

The EDS analysis of the film shows that the stoichiometry of the deposits was in agreement with the expected atomic percentage. The EDS spectra revealed that the deposits only contained Zn, O, and Mg (Fig. 3). The spectra also revealed that no other foreign elements were found in the synthesized samples. The expected and obtained composition values (Table 2) are nearly identical, showing that the film has proper homogeneity and uniformity composition of distribution.

Fig. 3
figure 3

Typical EDAX spectra of Zn0.97Mg0.03O thin film

Table 2 Comparison of obtained and estimated composition of Zn1−xMgxO films from EDAX spectra

3.3 Optical characterization

The optical transmittance spectra of the samples prepared at various doping concentrations are depicted in Fig. 4a, and the spectra can be separated into two regions: absorption and transparent. The graph clearly showed that the pure ZnO had a transmittance of more than 80%, and that the transmittance increased with Mg doping. As doping increased, the absorption edge moved toward shorter wavelengths, which was responsible for the enhanced transmittance in the lower wavelength region as compared to pure ZnO [19]. Similar results were observed by Devi et al. [20] using SILAR-coated Mg-doped ZnO film, whereas Fang et al. [22] noticed a reduction in transmittance at the lower concentration for the sample prepared by a modified Pechini method.

Fig. 4
figure 4

a transmittance spectra and b () vs (αhν)2 plot of Zn1−xMgxO (x = 0–0.04) thin film

By dividing the absorbance value by the thickness of the film, we can calculate the absorption coefficient (α) from the absorbance data. The α value can be related to energy () by the relation

$$\alpha = \frac{\beta }{h\nu }\left( {h\nu \, - \, E_{{\text{g}}} } \right)$$
(8)
$$\left( {\alpha h\nu } \right)^{1/n} = \left( {h\nu - E_{{\text{g}}} } \right)$$
(9)

where β is the band tailing parameter, which is a constant, Eg is the optical band gap energy, and n is the power factor. The type of transition that takes place in the material determines the value of n, and for the direct allowed transition n = ½, for indirect allowed transition n = 2, n = 3/2 for direct forbidden transition, and n = 3 for indirect forbidden transition. It was found that for Zn1−xMgxO samples showing a direct allowed transition, hence n = ½, then Eq. (9) becomes

$$\left( {\alpha h\nu } \right)^{2} = \left( {h\nu - E_{{\text{g}}} } \right)$$
(10)

Therefore, in order to determine the energy bandgap, the (αhν)2 versus energy () graph (Tauc’s plot) was plotted (Fig. 4(b)) using the data obtained from the absorption spectra. The band gap (Table 3) value of Zn1−xMgxO films decreased as magnesium content increased from 0 to 4 at.%. This might be due to a large number of defects in the film, which was further confirmed by the increased strain values (Table 1). Similar results were observed by Raj et al. [23] due to strong quantum confinements and an increase in their surface area-to-volume ratio, whereas Iqbal et al. [24] observed an increase in optical bandgap as dopant concentration increased, which they explained as the possibility of new defects forming in the ZnO lattice after Mg doping due to variations in electronegativity and ionic radii.

Table 3 Estimated energy band gap and Urbach energy of Zn1−xMgxO (x = 0–0.04) thin film

In the Tauc’s plot, the exponential part of the curve which arises from the localized states is called Urbach tail, and the energy associated with this region of the curve is called the Urbach energy (Eu). The relation connecting the absorption coefficient (α) and the energy () is given by

$$\alpha = \alpha_{0} \exp \left( {\frac{h\nu }{{E_{{\text{u}}} }}} \right)$$
(11)

where \(\alpha\)0 is the constant. Now take the logarithm on both sides of the above equation, then we get a straight line equation as

$$\ln \alpha = \ln \alpha_{0} + \left( {\frac{h\nu }{{E_{{\text{u}}} }}} \right)$$
(12)

Therefore, the plot by taking lnα on y-axis and on the x-axis gives the straight line, and its inverse of the slope gives the Urbach energy value. The computed Urbach energy values are summarized in Table 3, and it was found to increase as Mg concentration increases (Fig. 5). The higher Urbach energy value of deposits indicates that the number of defect states increases due to Mg doping. Furthermore, the electronic states arising due to the presence of Mg will add to the defect states and result in an increase in the Urbach energy [25]. We observed a nonlinear relationship between bandgap and Urbach energy. Hence, Mg doping is useful for tuning the optical bandgap of the ZnO matrix.

Fig. 5
figure 5

Urbach energy graph of Zn1−xMgxO (x = 0–0.04) thin film

3.4 Photoluminescence

The study of photoluminescence (PL) properties of a material can efficiently offer information regarding optically active defects, excited state relaxation routes, and associated optical characteristics. Figure 6 displays the PL spectra of Zn1−xMgxO (x = 0–0.04) thin film taken at 345 nm excitation wavelength at room temperature. The peak at different emission wavelengths in the UV–Vis regions is shown in Table 4. It was noticed that PL spectrum of ZnO exhibits near band edge (NBE) emission nearly around 390 nm in the UV region due to exciton recombination, and deep-level defects such as Zinc interstitials (Zni) and Oxygen vacancies (Vo), and acceptor defect states such as Zinc vacancies (VZn) and Oxygen interstitials (Oi) cause other emission peaks in the visible area [26]. It was noticed a shift of peak related to near band edge emission toward the lower wavelength region, which may be attributed to the inclusion of Mg dopant into the ZnO matrix. With the addition of Mg, there was a reduction in PL intensity and also the broadening of peaks. The dampening of the NBE emissions suggests that crystallinity of doped samples has more defects, which are capable of trapping photogenerated free electrons and holes. The strong visible emissions are also observable, with the peak wavelengths of these emissions varying significantly depending on the dopant concentration (Fig. 7). Violet emission is most likely related with an electron transfer from a shallow donor level of Zni level to the upper level of the valance band [27]. The peaks between 420 and 470 nm correlate to blue emission, which is caused by the defect emission of Zinc interstitial (Zni) [28]. A green emission was observed around 530 nm, and according to Fujihara et al. [29], oxygen vacancies are considered to be the main defects causing the green PL in ZnO. The singly ionized oxygen vacancy (VO) is assumed to be responsible for the green PL emission among the three distinct charge states, namely VO, VO, and V••O (doubly ionized). According to Chandrinou et al. [30], the yellow–orange emission is caused by the optical transitions from the bottom of the conduction band to the oxygen interstitial. The interesting thing that we noticed is that a red emission peak at a higher concentration (4 at.%). The origin of red emission was widely attributed to deep-level defects such as oxygen vacancies and oxygen interstitials, which were commonly seen in oxygen-rich samples [31].

Fig. 6
figure 6

PL spectra of Zn1−xMgxO (x = 0–0.04) thin film using an excitation wavelength of 345 nm

Table 4 De-convoluted Zn1−xMgxO (x = 0–0.04) thin film having peak in the UV–Vis region
Fig. 7
figure 7

De-convoluted PL spectra of Zn1−xMgxO (x = 0–0.04) thin film

The color coordinates on the Commission Internationale de L′Eclairage (CIE) chromaticity diagram are usually used to evaluate the quality of a light source. The CIE diagram can be used to successfully determine color parameters such as dominant wavelength, luminous efficiency, correlated color temperature, and color purity. The used color space is called the 1931 CIE (x, y) color space. Figure 8 displays the luminescence's CIE chromaticity coordinates at various doping levels. At higher doping concentrations, the coordinates are shifted away from the white light zone, whereas at lower doping concentrations, they are moved toward the white light region. The colorimetric coordinates (x,y) of the films are in the nearly white light region, suggesting that the films emit the most white light.

Fig. 8
figure 8

CIE chromaticity diagram of Zn1−xMgxO (x = 0–0.04) thin film

4 Conclusion

Nano-structured Zn1−xMgxO (x = 0–0.04) thin films of a thickness of about 500 nm were synthesized on a glass substrate by dip coating technique. The XRD peak confirms the formation of the hexagonal ZnO films. The XRD peak intensity decreased steadily as a function of dopant concentration. The reduction of crystallite size with increasing strain values in the deposited films confirmed the incorporation of Mg in the ZnO matrix. The surface morphology exhibited a grain-like structure that varied due to the addition of Mg dopant. EDAX spectra showed the existence of the desired components in the deposits. As concentration increased, the energy bandgap decreased, and optical transparency improved as compared to the host matrix. PL spectra validated the various emission peaks associated with the NBE and DLE and showed violet, blue, green, and yellow–orange emission as well as red emission for 4% doped ZnO. CIE diagram showed the near white light emission for the prepared nanostructures. By tuning the preparation parameters, Mg-doped films can be used in light-emitting diodes.