This work aims to apply PANI.Ag cantilever nanosensor to detect volatiles from in vivo E. heros and interfering compounds. The stink bug insects were collected in crops and kept in an environment (chamber) that mimicked the soy culture. The study was carried out with male and female insects together and with male and female insects separated; with interfering compounds from stink bug Diceraeus furcatus; in addition, with synthetic compounds as tridecane and hexenyl (Z)− 3-acetate. The cantilever nanosensor exposed to the volatiles from males and females showed a reduction in the resonance frequency and did not show a response to the volatiles from the chamber that contained only food and water (without insects), and control (synthetic air). The response of the volatiles from the chamber containing female insects was similar to the chamber without insects and was very close to the control. In the chamber containing only males, a reduction in the resonance frequency resulted from the pheromone released by the insects. The resonance frequency did not change considerably when exposed to the volatiles from the environment with D. furcatus , when compared to the control, as well as to tridecane and hexenyl (Z)− 3-acetate compounds. Thus, the gas nanosensor was able to distinguish the volatile compounds released by male E. heros , making it a promising alternative for agriculture in integrated pest management. • Detection pheromone compounds from E. heros insects in vivo with nanosensor . • Volatile molecules from E. heros males and females. • The resonance frequency did not change when exposed to interferent compounds. • Agriculture integrated pest management.