1 Introduction

Tuberculosis is an infectious illness that can affect the human lungs besides other body parts. It is caused by mycobacterium tuberculosis bacteria. Most infected cases exhibit no symptoms. These cases are known as latent tuberculosis. About 10% of latent tuberculosis cases can become an active disease which, if not cured, kills about 50% of those cases. The usual symptoms of active tuberculosis are cough, night sweats, weight loss and fever. If other parts of the human body are infected, a wider range of symptoms can appear. Tuberculosis is an infectious disease and can spread from one person to another through the air. When sick people who have active tuberculosis sneeze, cough, speak or spit, the tuberculosis germs spread into the air and other people may be infected. It is enough for an uninfected person to inhale a few tuberculosis germs to become infected. Active infections most likely occur in the cases of people with HIV/AIDS and heavy smokers. Diagnosis of active tuberculosis requires a culture of body fluids, microscope examination or chest X-rays [1]. Tuberculosis can lead to high mortality in humans. It is the reason for about 3 million deaths annually. Every year, 8–10 million people are infected with tuberculosis [2].

Tuberculosis often increases the Erythrocyte Sedimentation Rate (ESR). Recent researches have demonstrated an increase in platelet counts in pulmonary tuberculosis [3, 4] which leads to a decrease in the index of refraction of the blood. This decrease in the index of refraction is the key point on which the current optical sensor is based.

Theoretical and experimental works on photonic crystals (PCs) have experienced a lot of interest by researchers due to potential applications in the field of optoelectronics [5,6,7,8,9]. In optics, developing novel devices based on PCs has become an important new trend. A PC is a man-made structure having a periodic dielectric structure. It creates an energy bandgap for photons called a photonic bandgap. The propagation of electromagnetic waves of a frequency lying in the photonic bandgap range is prohibited in a similar manner as the periodic potential does for the crystal electrons [10]. PCs have been proposed for a group of applications such as resonator [11], multiplexer [12], reflector [13], polarization controller [14], filter [15], refractometer [16] and switches [17]. Since the PC fabrication for both visible and IR regions was considered well-matched with its scaling factor from nano- to microscales [18], the optical sensors based on PCs have received increasing interest. Cavity-based and defective PCs [19] were proposed for chemical sensor [20], temperature sensor [21], biosensor [22], hydrostatic pressure sensor [23] and gas sensor [24].

It is very significant to find new techniques for the detection of tuberculosis because a large portion of the cases (about 98%) occur in third world countries without any access to medical analysis laboratories [25]. Optical sensors are regarded as analytical detectors that transduce the blood interactions into an optical signal [20]. There are a large number of biosensors such as acoustic, electrical, nanomechanical, electrochemical, piezoelectric, magnetic, and optical.

In this work, the tuberculosis bacteria are detected using a biosensor based on a one-dimensional (1D) defective binary PC. The transfer matrix method is employed to analyze the proposed structure. The effect of some parameters such as incident angle, defect layer thickness and central wavelength is investigated to achieve the highest sensitivity of our sensor.

2 Design and theoretical model

A 1D binary defective PC is proposed for mycobacterium tuberculosis bacteria detection. The PC has the structure (AB)N/C/(AB)N. Layers A and B have thickness d1 and d2 and indices of refraction n1 and n2. C is the defect layer with a thickness df and index nf. The defect layer lies midway between two identical periods. Figure 1 shows a schematic diagram of the proposed binary defective PC.

Fig. 1
figure 1

Schematic diagram of a 1D binary PC having a blood sample as a defect layer

Wide selections of well-established techniques to simulate PCs are described in the literature. Most of these techniques are described in Prather et al. work [26]. Finite-difference time-domain (FDTD), plane-wave expansion method and finite element method (FEM) are three examples of these methods. In the special case of 1D PCs, the transmission spectrum can be simulated using many numerical tools such as FDTD methods and FEM. The TMM is a very flexible technique to simulate 1D photonic structures. We consider a system consisting of air/multilayer/substrate. The parameters connected to air and substrate media are just the refractive indices, n0 and ns, respectively. If Es and Hs are the electric and magnetic fields in the substrate, we can write the incident fields (E0 and H0) in terms of Es and Hs as

$$\left[\begin{array}{c}{E}_{0} \\ {H}_{0}\end{array}\right]=\prod_{j=1}^{K}{W}_{j}\left[\begin{array}{c}E_{\text{s }}\\ H_{\text{s}}\end{array}\right]=\left[\begin{array}{cc}{w}_{11}& {w}_{12}\\ {w}_{21}& {w}_{22}\end{array}\right]\left[\begin{array}{c}E_{\text{s }}\\ H_{\text{s}}\end{array}\right]$$
(1)

where K is the total number of layers and \({W}_{j}\) is the characteristic matrix of one layer and wij are the matrix elements. Wj can be written as

$${W}_{j}=\left[\begin{array}{cc}{\cos}({\delta }_{j})& -\frac{i {\sin}({\delta }_{j})}{{\gamma }_{j}}\\ -i{\gamma }_{j}{\sin}({\delta }_{j})& {\cos}({\delta }_{j})\end{array}\right]$$
(2)

\({\delta }_{j}\) is the phase variation of the light wave propagating through the jth layer which can be written as

$${\delta }_{j}=\frac{2\pi }{\lambda }{n}_{j}{d}_{j}{{\cos}\theta }_{j}$$
(3)

where \({n}_{j}\) is the refractive index of the layer and dj its thickness. \({\theta }_{j}\) is the angle of incidence in the jth layer which is given in terms of the initial incidence angle \({\theta }_{0}\) as

$${{\cos}\theta }_{j}=\sqrt{1-{\left(\frac{{n}_{0}{ \sin}({\theta }_{0})}{{n}_{j}}\right)}^{2}}$$
(4)

\({\gamma }_{j}={n}_{j}{\cos}({\theta }_{j})\) for transverse electric (TE) wave whereas \({\gamma }_{j}={\cos}({\theta }_{j})/{n}_{j}\) for transverse magnetic (TM) wave and \({n}_{0}\) is the refractive index of the ambient medium. The only difference between TE and TM modes is \({\gamma }_{j}\). When photonic crystals are considered that are surrounded by air from both sides, both modes have the same transmission spectra for normal incidence angle (\({\theta }_{0}=0\)). In some optical branches, studying one of the two modes is enough and the results can be generalized to the other mode. In this work, we will study TE mode and the same methodology can be applied to TM mode. The transfer matrix W0 for one period consisting of two layers A and B can be written as W0 = WA WB. The full transfer matrix W of a defective binary PC can be expressed as

$$W={({W}_{0})}^{N}{W}_{D}{({W}_{0})}^{N}=\left[\begin{array}{cc}{W}_{11}& {W}_{12}\\ {W}_{21}& {W}_{22}\end{array}\right]$$
(5)

where WD is the transfer matrix of the defect layer and Wij are the elements of the total transfer matrix W.

The transmission coefficient can be written as

$$t=\frac{2{\gamma }_{\text{in}}}{\left({W}_{11}+{W}_{12}{ \gamma }_{\text{out}}\right){\gamma }_{\text{in}}+({W}_{21}+{W}_{22 }{\gamma }_{\text{out}})}$$
(6)

and the transmittance can have the form

$$T=\frac{{\gamma }_{\text{out}}}{{\gamma }_{\text{in}}}{\left|t\right|}^{2}$$
(7)

The reflection coefficient can be written as

$$r=\frac{\left({W}_{11}+{W}_{12}{\gamma }_{\text{out}}\right){\gamma }_{\text{in}}-({W}_{21}+{W}_{22}{\gamma }_{\text{out}})}{\left({W}_{11}+{W}_{12}{\gamma }_{\text{out}}\right){\gamma }_{\text{in}}+({W}_{21}+{W}_{22}{\gamma }_{\text{out}})}$$
(8)

and the reflectance can have the form

$$R={\left|r\right|}^{2}$$
(9)

For transverse electric (TE) waves, \({\gamma }_{\text{in}}={\gamma }_{\text{out}}= {\cos}({\theta }_{0})\) since the binary PC is assumed to be surrounded by air.

Based on the above theoretical equations, we can study the properties of the transmission spectra of the defective binary PC.

3 Results and discussion

3.1 Tuberculosis sensor

A 1D binary PC is considered which is composed of air/(A/B)N/C/(A/B)N/air, where N is the number of periods. Layers A and B are chosen as GaAs (n1 = 3.36) and BaF2 (n2 = 1.46), respectively. Usually, Si and SiO2 are used in the design of photonic crystals. The refractive indices of GaAs and BaF2 are almost the same as Si and SiO2, respectively. GaAs, BaF2, Si, and SiO2 are all semiconductor materials. Moreover, there is an advantage of some devices constructed from GaAs over those utilizing silicon due to the high electron mobility of GaAs. The optical layer thickness is equal to one-quarter of the wavelength, i.e., \({d}_{1}=\frac{{\uplambda }_{\text{Centarl}}}{4{ n}_{\text{A}}}\) and \({d}_{2}=\frac{{\uplambda }_{\text{Centarl}}}{4{ n}_{\text{B}}}\). The defect layer is either a normal blood sample (NBS) or an infected sample with tuberculosis bacteria (TBi), i = 1, 2, 3 and 4. The thickness of the defect layer is df and the indices of the samples are presented in Table 1 [2]. We consider normal incidence in which θ0 = 0. The wavelength of the incident radiation is taken from 800 to 2500 nm with a central wavelength of λC = 1650 nm. The number of periods is taken as N = 5. The transmission spectrum through the proposed binary PC without any defect layer is shown in Fig. 1a. A photonic bandgap of a width of 973.85 nm can be seen with left and right edges are at wavelength positions of 1295 nm and 2268.85 nm, respectively. Figure 1b shows the transmission spectrum through the structure when the NBS is in the defect gap. The thickness of the defect gap is taken as df = 1D where D = d1 + d2. The width of the photonic bandgap becomes 1105.76 nm where the left and right edges are at wavelength positions of 1278.64 nm and 2384.4 nm, respectively. A defect mode can be seen in the figure at a resonant wavelength of \({\lambda }_{\text{peak}}\) = 1797.81 nm. An enlarged view of the defect mode is plotted in Fig. 1c. The full width at half maximum (FWHM) of the resonant peak is 0.41 nm where the wavelength positions of the left and right edges at half maximum are at 1797.6 nm and 1798.01 nm. The quality factor (QF) of the resonant peak is found as 4384.90 which is calculated as \({\text{QF}}=\frac{{\lambda }_{\text{peak}}}{\text{FWHM}}\), where \({\lambda }_{\text{peak}}\) is the resonant wavelength.

Table 1 Defect mode position and sensitivity of tuberculosis cells at θ0 = 0.0°, n1 = 3.36, n2 = 1.46, df = 1D, \(\lambda_{\text{c}}=1650 \, \text{nm}\) and N = 5

Figure 3 shows the transmission spectra when the NBS and TBi are treated as defect layers. The resonant peak shifts to a lower wavelength region when compared to Fig. 2b. The new wavelength positions of the defect mode are cell-dependent. The new wavelength positions are at 1796.41, 1795.94, 1795 and 1794.06 nm for TB1, TB2, TB3 and TB4 cells, respectively. The sensitivity can be calculated as \(\left(\text{Sensitivity}=\frac{\Delta \lambda }{\Delta n}\right)\) where \(\Delta \lambda\) is the wavelength shift between the resonant peak position of NBS and TBi and \(\Delta n\) is the refractive index change between NBS and TBi. The sensitivity is found as 466.66, 467.5, 468.33 and 468.75 nm/RIU for the samples of TB1, TB2, TB3 and TB4 cells, respectively. Table 1 presents the refractive indices of different tuberculosis cells, defect mode positions of each and the sensitivity of the proposed binary PC to each cell. Based on the values presented in Table 1, the average sensitivity is given by 467.70 nm/RIU (Fig. 3).

Fig. 2
figure 2

Transmission spectrum of a binary PC without a defect layer (a), with an NBS as a defect layer (b) and an enlarged view of the defect mode (c). The parameters of the three panels are θ0 = 0.0°, n1 = 3.36, n2 = 1.46, \(\lambda_{\text{c}}=1650 \, \text{nm}\) and N = 5

Fig. 3
figure 3

Transmission spectra of a binary PC for different cells at θ0 = 0.0°, n1 = 3.36, n2 = 1.46, df = 1D, \(\lambda_{\text{c}}=1650 \, \text{nm}\) and N = 5

3.2 Effect of the incident angle

The effect of the incidence angle on the proposed sensor sensitivity is investigated. The transmission spectra are studied for different incident angles in the range from θ0 = 0° to θ0 = 89° in steps of 10° and the sensitivity corresponding to each angle is calculated. Some of the results are presented in Tables 2 and 3. The average sensitivities corresponding to angles of incidence of 20° and 40° are found, respectively, as 498.22 nm/RIU and 585.83 nm/RIU. Table 4 shows all the studied angles of incidence and the corresponding average sensitivities. The sensitivity attains a considerable enhancement as the incident angle increases from 0° to 85°. For further increase of the angle of incidence beyond 85°, insignificant enhancement of the sensitivity can be observed. The variation of the sensitivity as a function of the angle of incidence is shown in Fig. 4 (black points). The relation between the tuberculosis sensor sensitivity (S) and the incident angle (\({\theta }_{0}\)) can be fitted according to the following relation

Table 2 Defect mode position and sensitivity to tuberculosis cells at an incidence angle of θ0 = 20°
Table 3 Defect mode position and the sensitivity to tuberculosis cells at an incidence angle of θ0 = 40°
Table 4 Effect of the incident angle on the sensitivity to tuberculosis cells at d = 1D and N = 5
Fig. 4
figure 4

Sensitivity versus the incident angle of a binary PC for TE wave at n1 = 3.36, n2 = 1.46, df = 1D, λC = 1650 nm and N = 5

$$S\left( {\theta _{0} } \right) = 465.424 + \,0.5882\theta _{0} + 0.041~\theta _{0}^{2} + 9.672 \times 10^{{ - 4}} \theta _{0}^{3} - 1.0585 \times 10^{{ - 5}} ~\theta _{0}^{4}$$
(10)

The fitting equation is also plotted in Fig. 4 (blue line). The fitting equation is useful to predict the sensitivity of tuberculosis sensor at any incident angle between \({\theta }_{0}=0.0^\circ\) and \({\theta }_{0}=89^\circ\).

3.3 Effect of the defect layer thickness

The variation of the sensitivity with the defect layer thickness is investigated. The defect layer thickness is varied from df = 1D to df = 13D in steps of 2D. Tables 5 and 6 present the results of df = 5D and df = 9D, respectively. The average sensitivities corresponding to defect layer thicknesses of 5D and 9D are calculated as 1013.33 nm/RIU and 1185 nm/RIU, which means a significant sensitivity enhancement compared to the initial value found in subsection 3.1. This improvement can be explained according to the standing wave formula given by [27]

Table 5 Defect mode position and sensitivity to tuberculosis cells at a thickness of defect layer df = 5D
Table 6 Defect mode position and sensitivity to tuberculosis cells at a thickness of defect layer d = 9D
$$\text{OPD}=L \lambda ={n}_{\text{eff}} K$$
(11)

where \(\text{OPD}\), \(L,\) \(\lambda\), \({n}_{\text{eff}}\) and \(K\) are the optical path difference, integer, wavelength of the incident light, effective structure index and the geometric difference of the path. As the refractive index of the defect layer decreases, the standing wave resonant condition changes and a blue shift takes place to keep the optical path difference unchanged. In this case, the resonant defect peak shifts to a lower wavelength region. When the defect layer thickness increases, the electromagnetic wave will have a long geometric path through the defect layer and a strong interaction between the incident light and the cell layer will occur.

Table 7 shows all the defect layer thicknesses and the corresponding average sensitivities. The sensitivity keeps enhancing with the increase of the defect layer thickness. After df = 13D, the sensitivity tends to saturate. The enchantment between df = 11D and df = 13D is not as large as that between df = 1D and df = 3D. For defect layer thickness greater than df = 13D, an insignificant improvement of the sensitivity can be obtained. The variation of the sensitivity as a function of the angle of incidence is shown in Fig. 5 (black points). The relation between the tuberculosis sensor sensitivity (S) and the defect layer thickness (df) can be fitted according to the following relation

Table 7 Effect of defect layer thickness on the sensitivity to tuberculosis cells at θ0 = 0° and N = 5
Fig. 5
figure 5

Sensitivity versus the thickness of tuberculosis cell layer of a binary PC for TE wave at n1 = 3.36, n2 = 1.46, θ0 = 0°, λC = 1650 and N = 5

$$S\left({d}_{\text{f}}\right)=171.993+0.85{d}_{\text{f}}-3.068\times {10}^{-4}{d}_{\text{f}}^{2}+5.421\times {10}^{-8}{d}_{\text{f}}^{3}-3.62\times {10}^{-12}{d}_{\text{f}}^{4}$$
(12)

The fitting equation is plotted in Fig. 5 (blue line). The fitting Eq. (13) is useful to predict the tuberculosis sensor sensitivity at any value of the defect layer thickness.

3.4 Effect of the central wavelength

The behavior of the sensitivity with the central wavelength variation is explored. The central wavelength is varied from λC = 1650 nm to λC = 2000 nm in steps of 50 nm. The results of λC = 1650 nm and λC = 1700 nm are shown in Tables 8 and 9, respectively, with average sensitivities are found as 467.70 nm/RIU and 481.14 nm/RIU. The sensitivity gets improved as the central wavelength grows. Table 10 shows all the central wavelengths considered and the corresponding average sensitivities. The sensitivity can reach a value of 564.79 nm/RIU at λC = 2000 nm. The sensitivity variation as a function of the central wavelength is shown in Fig. 6 (black points). The relation between the sensitivity of tuberculosis sensor (S) and the central wavelength (λC) of a proposed binary PC can be fitted according to the following relation

Table 8 Defect mode position and sensitivity to tuberculosis cells at a central wavelength of \(\lambda_{\text{c}}=1650 \, {\text{nm}}\)
Table 9 Defect mode position and sensitivity to tuberculosis cells at a central wavelength of \(\lambda_{\text{c}}=1700 \text{nm}\)
Table 10 Effect of the central wavelength on the sensitivity to tuberculosis cells at θ0 = 0°, df = 1D and N = 5
Fig. 6
figure 6

Sensitivity versus the central wavelength of a binary PC for TE wave at n1 = 3.3, n2 = 1.46, θ0 = 0°, df = 1D and N = 5

$$S\left({\uplambda }_{\text{c}}\right)=-44082.6+101.2 {\uplambda }_{\text{c}}-0.0863 {\uplambda }_{\text{c}}^{2}+3.27314\times {10}^{-5}{\uplambda }_{\text{c}}^{3}-4.64\times {10}^{-9}{\uplambda }_{\text{c}}^{4}$$
(13)

which is shown as a blue line in Fig. 6.

3.5 Tuberculosis sensor optimization

Figure 7 shows the defect mode of the defective binary PC when the NBS and tuberculosis-infected samples are treated as defect layers at the optimized parameters of θ0 = 85°, \({d}_{\text{f}}\) = 13D and λC = 2000 nm. When the NBS is treated as a defect layer, the resonant peak position is found at 2389.63 nm. It is found that resonant peak shifts to a lower wavelength region as tuberculosis samples are treated as defect layers. The new wavelength positions of the defect mode are sample dependent and are found at 2380.06, 2376.87, 2370.43 and 2363.96 nm for the samples of TB1, TB2, TB3 and TB4, respectively. The sensitivity is found as 3190, 3190, 3200 and 3208.75 nm/RIU for the samples of TB1, TB2, TB3 and TB4, respectively. Table 11 presents the refractive indices of different tuberculosis samples, defect mode positions of each and the sensitivity of the proposed binary PC to each cell. The average sensitivity is calculated and found 3197.18 nm/RIU which is extremely high when compared to most recent sensitivities published in the field of biosensing. Table 12 presents a comparison of the current work with the most recent works. In 2020, Ramanujam et al. studied the sensitivity of a defected ring mirror 1D-PC for detecting mycobacterium tuberculosis bacteria and they achieved a sensitivity of 700 nm/RIU. In 2021, Arafa et al. studied the sensitivity of a 1D-PC for detecting mycobacterium tuberculosis bacteria and they have achieved a sensitivity of 1390 nm/RIU. The proposed sensor in our work achieved the highest sensitivity among all works.

Fig. 7
figure 7

Transmission spectra of a binary PC for TE wave at θ0 = 85°, n1 = 3.36, n2 = 1.46, df = 13D, λC = 2000 nm and N = 5

Table 11 Defect mode position and sensitivity to tuberculosis cells at a thickness of defect layer df = 13D, λC = 2000 nm and θ0 = 85°
Table 12 Comparison of the proposed sensor sensitivity with most recent biosensing designs

4 Conclusion

In this work, a novel biosensor based on a binary PC was proposed for the detection of mycobacterium tuberculosis bacteria in the blood. The structure air/(GaAs/BaF2)N/(Defect)/( GaAs/BaF2)N/air was used. The defect layer was the blood sample which is located midway between the two periods. The sensitivity was found to gain a significant enhancement as the incident angle increases from 0° to 85°. When the incident angle increases beyond 85°, slight sensitivity improvement was observed. The sensitivity was also considerably enhanced with the increase of the defect layer thickness when increasing the thickness from df = 1D to df = 13D, where D = d1 + d2. After df = 13D, the sensitivity tends to saturate. Moreover, when the sensitivity was studied with the central wavelength variation, it was found it attains an improvement with the increase of the central wavelength. The optimized parameters were considered as θ0 = 85°, \({d}_{\text{f}}\) = 13D and λC = 2000 nm. When assuming a PC with these parameters, the sensitivity is found 3197.18 nm/RIU which is extremely high. We compared our results with the most recent papers published in this field of biosensors and found that the sensitivity obtained in the current work is the highest. In addition, our sensor has a simple design, tunable fabrication and low cost and can be useful for the detection of many organisms that can exist in the blood.