In the present work, PANI (polyaniline) emeraldine salt (doped) and base (dedoped) were used as the sensitive layer of a silicon microcantilever, and the mechanical response (deflection) of the bimaterial (coated microcantilever) was investigated under the influence of humidity. PANI in the emeraldine base oxidation state was obtained by interfacial synthesis and was deposited on the microcantilever surface by spin-coating (dedoped). Next, the conducting polymer was doped with 1 M HCl (hydrochloric acid). A four-quadrant AFM head with an integrated laser and a position-sensitive detector (AFM Veeco Dimension V) was used to measure the optical deflection of the coated microcantilever. The deflection of the coated (doped and undoped PANI) and uncoated microcantilever was measured under different humidities (in triplicate) at room pressure and temperature in a closed chamber to evaluate the sensor's sensitivity. The relative humidity (RH) in the chamber was varied from 20% to 70% using dry nitrogen as a carrier gas, which was passed through a bubbler containing water to generate humidity. The results showed that microcantilevers coated with sensitive layers of doped and undoped PANI films were sensitive (12,717 ± 6% and 6,939 ± 8%, respectively) and provided good repeatability (98.6 ± 0.015% and 99 ± 0.01%, respectively) after several cycles of exposure to RH. The microcantilever sensor without a PANI coating (uncoated) was not sensitive to humidity. The strong effect of doping on the sensitivity of the sensor was attributed to an increased adsorption of water molecules dissociated at imine nitrogen centers, which improves the performance of the coated microcantilever sensor. Moreover, microcantilever sensors coated with a sensitive layer provided good results in several cycles of exposure to RH (%). SCANNING 36:311–316, 2014. © 2013 Wiley Periodicals, Inc.