The brain–computer interface (BCI) establishes a direct communication system between the brain and a computer or other external devices. Since the inception of BCI technology half a century ago, it has advanced rapidly and developed into an active area of frontier research in modern applied science and technology. This article provides a comprehensive survey on BCI with respect to a brain-in-the-loop communication system. In the present work, we first introduce the underlying architecture of the