The emerging body-electric closed-loop system may significantly contribute to disease treatment or other healthcare areas. Here, a flexible electronic smell detector linking to brain (mimicking olfactory epithelium) has been designed for constructing artificial olfactory-substitution perception-behavior closed-loop systems. Driven by the body motion, the device can output a series of triboelectric-sensing signal like a specific code for differentiating gas species (e.g. methanol: 11011111). The signal transmitted into mouse brain at somatosensory barrel cortex can participate in mouse perception and act as the brain stimulator. The brain can accordingly control the body to engage in particular behavior, and this movement can operate the device in turn. An artificial olfactory closed loop is formed among the device, brain and body. This new approach can promote the development of closed-loop human-machine interactions and self-powered multifunctional systems.