PIEEG: Turn a Raspberry Pi into a Brain-Computer-Interface to measure biosignals
Ildar Rakhmatulin* – PhD electronic researcher
Sebastian Völkl - Brain-Computer-Interface developer
This paper presents an inexpensive, high-precision, but at the same time, easy-to-maintain PIEEG
board to convert a RaspberryPI to a Brain-computer interface. This shield allows measuring and
processing eight real-time EEG(Electroencephalography) signals. We used the most popular
programming languages - C, C++ and Python to read the signals, recorded by the device . The process
of reading EEG signals was demonstrated as completely and clearly as possible. This device can be
easily used for machine learning enthusiasts to create projects for controlling robots and mechanical
limbs using the power of thought. We will post use cases on GitHub
(https://github.com/Ildaron/EEGwithRaspberryPI) for controlling a robotic machine, unmanned aerial
vehicle, and more just using the power of thought.
Source - https://github.com/Ildaron/EEGwithRaspberryPI
Web-Site - https://www.hackerbci.com/
Slack - pieeg.slack.com
License - GNU General Public License v3.0
keywords: PIEEG, ironbci, hackerbci, raspberryPi, EEG, brain-computer interface
BCI Brain-computer interface
SBC Single-board computer
IC Integrated circuit
ADC Analog digital converter
The popularity of BCI’s has increased significantly in recent years, making neuroscience more
accessible to scientists and engineers from various fields of activity. Neuroscience in particular has not
stood aside, and today machine learning is widely used to determine the relationship between thoughts
and EEG. We believe that the relationship between machine learning and neuroscience will only grow
as the scope of BCI expands significantly. Today BCI’s are actively used not only for medical
purposes [1, 2020] but also in many other industries, such as videogames [2, 2020], and this direction
is auspicious because it’s one of the fastest-growing [3, 2016]. As for other fields, Vo et al [4, 2019]
and Rakhmatulin [5, 2020] have providedan overview of the possibilities of machine learning and
EEG and described the prospects in this area quite favorably.
In recent years, many devices were introduced to the market as low-cost devices, but their prices also
usually started from a thousand dollars.At the same time, there is a problem in evaluating the quality
of the proposed devices on the market. In the review paper, Rashid et al. [6, 2020] showed that BCI
developers use different evaluation metrics to confirm the effectiveness of the developed devices,
which complicates the analysis of these BCIs. To avoid this problem, in addition to the technical
features, we presented the results of the experiments as completely as possible on the GitHub page
and uploaded the datasets for different cases.
In recent years, the activity on the BСI market has inspired optimism and gave reason to hope that
BCI may soon can become an everyday means of human-computer interaction. However the positive
start in the field of BCI hardware was interrupted by chip shortage [7, 2021], which complicated the
production process, drove up the cost of ICs and made them scarce. Therefore, it has become
expensive to develop full-fledged devices [8, 2021]. For this reason, we have developed an
Open-Source board that is designed to convert a RaspberryPI to a Brain-computer interface. We made
a shield because it reduced the number of ICs on the board and increased reliability. We chose the
RaspberryPi, mainly because it is the most popular SBC on the market [9, 2017]. It should also be
noted that one of the limiting factors for the widespread use of BCI is the difficulty in reading EEG
signals, as they are susceptible to electromagnetic, motion, and other types of noise. [10, 2021].
Therefore, signal processing by software is just as important as the hardware component of the BCI.
We have developed an open-source software where data collection takes place in С, which is
necessary for high speed, and signal processing in real-time by Python. We chose Python because it is
one of the most popular languages in data science [11, 2015] with many forums and documentation.
1.1 Review the paper
The following papers presented devices which in their characteristics are close to our device. Tyler et
al. [12, 2015] presented a board for measuring biosignals. The authors didn't provide information
about the component manufacturer, PCB layout, or PCB specifications. For these reasons, it is very
difficult to judge the potential of the device. Uktveris et al [13, 2018] developed a board for reading
biosignals with ADC ADS1299. The board presented in their work is aimed at the Arduino market as
a shield for the MEGA2560 models. Therefore, this board is only a transmitter, and signal processing
must be done on a computer. As for the combination of single-board computers and an ADC for
reading bio signals, we did not find similar devices among the published works. We found the most
similar project in GitHub (https://github.com/wjcroft/RaspberryPiADS1299)- but the publication on
this work is not presented, so it is very difficult to understand the quality of the received EEG signal.
For example, it is not clear whether voltage regulators were used, without which the ADS 1299 would
not be able to provide a clean EEG signal. We also did not find software for signal processing. The
development of the hardware part is an applied science and from the engineering point of view,
Gerber files, BOM files, and electrical circuits are needed to confirm the experiments.. Many works
are stated as open sources, but the authors did not indicate the source, so their statements about the
openness of the sources can be considered advertising. As for the SBCs for reading signals, we found
papers where SBCs were at best used as transmitters for sending data to a desktop computer [14,
2016], [15, 2021], but the capabilities of the SBC are greater than just being a transmitter. For these
reasons, we developed a shield that receives data and transmits it to the RaspberryPi, and we have
written software that processes data in real-time on RaspberryPi. Thus, we can say that the
RaspberryPi has become a BCI. A general view of the device showed in fig. 1.
Fig.1. General view of the device
The possibilities of the device are very extensive and largely depend on the user how he wants to use
this device. To start the measurement process, electrodes must be connected to a device that reads
data, processes received signals and controls external devices, fig.2.
Fig. 2. Schematic representation of the use of the device
This device can be used as a shield for OrangePI (http://www.orangepi.org/), BananaPI
(https://www.banana-pi.org/), and some other single-boards computers, for this just need to make a
match on GPIO40.
2. Technical details
Table 1 lists the main technical data of the device
Table 1. PIEEG characteristic
8 channels for connecting electrodes, 1 channel for connecting a
reference, and 1 channel for connecting a bias signal, with
common-mode noise suppression
Data transfer via SPI with a frequency from 250 SPS to 16 kSPS
1, 2, 4, 6, 8, 12, 24
Of power and live bits for ADS1299
The free 33 PIN from RaspberryPI GPIO40 can be used for user tasks, for example - connecting any
For the measurement process, the PIEEG should be connected to the Raspberry PI3 or RaspberryPI4.
Then the device must be connected to a battery (power supply) and linked to the electrodes. Full
galvanic isolation from the mains required. This also applies to the monitor. Only use a monitor
that is powered by the same battery as and for the RaspberryPI, as in the fig.3-a. Electrodes should be
positioned according to International 10-20 system, fig.3-b. As electrodes we used dry electrodes, the
advantages of which are described in this article [16, 2021].
Fig. 3. Assembled device. Screen, battery, cap and 8 electrolytes connected by according to
International 10-20 system -a, location of electrodes - b
Today many signals processing software, both commercial and non-commercial can be used for signal
processing tasks. The following open source programs are on the market: Brainstorm
(https://neuroimage.usc.edu/brainstorm/Introduction), TAPEEG (https://sites.google.com/site/tapeeg/),
sLORETA (https://neurofeedbackalliance.org/sloreta/), Brainflow (https://brainflow.org/), Timeflux
(https://timeflux.io/). But it is worth noting, that the software review is just as complicated by the lack
of any comparison criteria as for the hardware, as we wrote earlier. At the same time, we do not share
the policy in which the authors of the hardware part need to add their devices to the software. Since
this policy increases the size of the software and the compilation time,t is much easier to make and
maintain a simple and understandable protocol for data transfer. For example, in our case, for the data
to the software is transmitted by an array for 8 channels, fig.4.
Fig. 4. Example of data transfer from device to software
The software should be as clear and simple as possible. When changing the code and using external
libraries, it is important to have as little compilation effort as possible. We did not find any suitable
software and developed our own software. Software details can be found on the GitHub page
4. Technical tests
In addition to the technical details presented in Table 1, we made a typical check of the device for
artifacts. The chewing artifact is one of the most pronounced artifacts, Wei, et al. [17, 2016] described
this artifact in detail in the EEG signals. Unlike chewing, blinking artifact [18, 2009] is quite often
used to control external objects, for example, to control electric wheelchairs [19, 2010]. For PIEEG
chewing and blinking artifacts detection in real-time presented in fig.5.
Fig.5. Chewing and blinking with EEG signal on PIEEG (real-time)
Band–pass filter with 1-30 Hz for the same data (not real-time) in fig. 8.
Fig. 6. Pass filter with 1-30 Hz for artifact and blinking
Alpha rhythm of alpha waves is the rhythmic activity of the EEG, recorded in the primary with open
or closed eyes at rest in 85-95%. This phenomenon is well studied and described in many works [20,
2019]. The alpha wave detection process shown in fig. 9.
Fig.7. Alpha waves detection in EEG signal without low-pass filter
Conclusion and discussion
This is currently one of the easiest devices to use for reading and processing biosignals. This board is
especially useful for researchers who set goals for controlling external objects, mechanical limbs
through blinking, paradigms, and the image motor, and more. We will update the site, upload datasets
and continue to improve the software and will publish cases on the use of this device to control
In the next version of the hardware, we will consider the possibility of installing gyroscopes and
accelerometers to control the position of the object and add shields to protect against external
During the development, we largely followed the interests of the user, specially choosing the most
popular tools for signal processing. In the future, we plan to provide this function in the software for
detecting the paradigms P300 and SSVEP. These paradigms are currently one of the most popular
tools for controlling external objects using the power of thought. Our final task is to control a
mechanical limb by motor imagery methods, which has not yet been fully realized through
non-invasive methods. This method is the most natural and therefore the achievement of a positive
result in this area will significantly improve the position of BCI in the world of neurobiology.
Conflicts of Interest: None
Ethical Approval: Not required
1. Rakhmatulin, I. (2020). Deep learning and machine learning for EEG signal processing on the
example of recognizing the disease of alcoholism. https://doi.org/10.1101/2021.06.02.21258251
2. Alakus, T., Gonen, M., & Turkogly, I. (2020). Database for an emotion recognition system based on
EEG signals and various computer games – GAMEEMO. Biomedical Signal Processing and Control,
60, 101951. https://doi.org/10.1016/j.bspc.2020.101951
3. Gatzoulis, C., Loizides, F., & Zaphiris, P. (2016). Planning for Computer Games Research and
Industry: A Structured Dialogue Design Approach. Comput Game. 5, 95–114.
4. Vo, H., Dang, L., Nguyen, I,. & Huynh, V. (2019). A Survey of Machine Learning algorithms in
EEG," 2019 6th NAFOSTED Conference on Information and Computer Science (NICS), 500-505.
5. Rakhmatulin, I. (2020). Review of EEG Feature Selection by Neural Networks. Int. J. Sci. Bus.
2020, 4, 101–112. http://dx.doi.org/10.2139/ssrn.3675950
6. Rashid, M., et al. (2020). Current Status, Challenges, and Possible Solutions of EEG-Based
Brain-Computer Interface: A Comprehensive Review. Front. Neurorobot.
7. Sparkes, M. (2021). When the chips are down. New Scientist, 251, 3351, 42-46.
8. Rakhmatulin, I. (2021). The electronic board to replace the reference voltage on the earlobe for
EEG measurement. Measurement, 173, 108673. https://doi.org/10.1016/j.measurement.2020.108673
9. Ray, S., Dhaheri, A. (2017). Using Single Board Computers in University Education. Recent
Advances in Information Systems and Technologies. Advances in Intelligent Systems and Computing,
10. Mumtaz, W., Rasheed, S., & Irfan, A. (2021). Review of challenges associated with the EEG
artifact removal methods. Biomedical Signal Processing and Control, 68, 102741.
11. Chollet, F., & others. (2015). Keras. Available at: https://github.com/fchollet/keras
12. Tyler. S., Leibbrandt, S., & Fitzgibbon, S. (2015). Measurement of neural signals from
inexpensive, wireless and dry EEG systems. Physiol Meas. 36(7), 1469–1484
13. Uktveris, T., Jusas, V. (2018). Development of a modular board for EEG signal acquisition.
Sensors. 18, 2140
14. Tejwani, K., Vadodariya, J., & Panchal, D. (2016). Biomedical Signal Detection using Raspberry
Pi and Emotiv EPOC. 3rd International Conference on Multidisciplinary Research & Practice, 6, 1,
15. Ali, H., et al. (2021). EEG-based Brain Computer Interface Prosthetic Hand using Raspberry Pi 4.
(IJACSA) International Journal of Advanced Computer Science and Applications, 12, 9
16. Rakhmatulin, I., & Gan, Y. (2021). Review Dry and Non-Contact EEG Electrodes for 2010-2021
Years. Preprints, 2021030555 .doi: 10.20944/preprints202103.0555.v1
17. Wei, Z., Zou, J., & Zhang, J. (2016). Automatic recognition of chewing noises in epileptic EEG
based on period segmentation. Neurocomputing. 190, 107-116
18. Babusiak, B., & Gála, M. (2009). The eye-blinking artifacts detection and elimination in the EEG
record. IFAC Proceedings. 42, 1, 254-259. https://doi.org/10.3182/20090210-3-CZ-4002.00051
19. Lin, J., Chen, K., & Yang, W. (2010). EEG and eye-blinking signals through a Brain-Computer
Interface based control for electric wheelchairs with wireless scheme," 4th International Conference
on New Trends in Information Science and Service Science, 731-734
20. Seco, G., et al. (2019). EEG alpha rhythm detection on a portable device. Biomedical Signal
Processing and Control, 52, 97-102.https://doi.org/10.1016/j.bspc.2019.03.014