The effects of different dopants on the synthesis, optical, electrical and thermal features of polyaniline were investigated. Polyaniline (PANI) doped with p-toluene sulfonic acid (PANI-PTSA), camphor sulphonic acid (PANI-CSA), acetic acid (PANI-acetic acid) and hydrochloric acid (PANI-HCl) was synthesized through the oxidative chemical polymerization of aniline under acidic conditions at ambient temperature. Fourier transform infrared light, X-ray diffraction, UV-visible spectroscopy, field emission scanning electron microscopy, photoluminescence spectroscopy and electrical analysis were used to define physical and structural features, bandgap values, electrical conductivity and type and degree of doping, respectively. Tauc calculation reveals the optical band gaps of PANI-PTSA, PANI-CSA, PANI-acetic acid and PANI-HCl at 3.1, 3.5, 3.6 and 3.9 eV, respectively. With the increase in dopant size, crystallinity is reduced, and interchain separations and d-spacing are strengthened. The estimated conductivity values of PANI-PTSA, PANI-CSA, PANI-acetic acid and PANI-HCl are 3.84 × 101, 2.92 × 101, 2.50 × 10−2, and 2.44 × 10−2 S·cm−1, respectively. Particularly, PANI-PTSA shows high PL intensity because of its orderly arranged benzenoid and quinoid units. Owing to its excellent synthesis, low bandgap, high photoluminescence intensity and high electrical features, PANI-PTSA is a suitable candidate to improve PANI properties and electron provider for fluorene-detecting sensors with a linear range of 0.001–10 μM and detection limit of 0.26 nM.