Controlling LEDs of Arduino Uno R4 With Your Mind (EEG)
by Upside Down Labs in Circuits > Sensors
68 Views, 0 Favorites, 0 Comments
Controlling LEDs of Arduino Uno R4 With Your Mind (EEG)

What if you could control LEDs with nothing but your mind?
In this project, we’re using a BioAmp EXG Pill which acts as an EEG sensor to record brainwaves and an Arduino UNO R4 Minima to analyze these brainwaves in real-time
But before moving forward, let's get familiar with BCI and EEG.
What is electroencephalography (EEG)?
Electroencephalography (EEG) is a method to record an electrogram of the spontaneous electrical activity of the brain. It is typically non-invasive, with the EEG electrodes placed along the scalp (commonly called "scalp EEG") using the International 10–20 system. EEG signals or brainwaves can be divided into 5 types as mentioned below:
- Delta - 0.2 to 3 Hz
- Theta - 3 to 8 Hz
- Alpha - 8 to 13 Hz
- Beta - 13 to 30 Hz
- Gamma - 30Hz and above.
For more information on brainwaves check the YouTube video: https://www.youtube.com/watch?v=2QOoR600dJY
What is Brain-Computer Interface (BCI)?
A brain-computer interface (BCI), sometimes called a brain-machine interface (BMI), is a direct communication link between the brain's electrical activity and an external device, most commonly a computer or robotic limb.
How does this game work?
When we focus, our brain generates more beta brainwaves, typically in the frequency range of 13 to 30 Hz. These brainwaves are associated with active thinking, problem-solving, and sustained attention. When the system detects high beta wave activity - indicating focused concentration - it triggers our output, and the LED lights up. As your mind relaxes and beta power drops, the LED turns off.
Supplies
HARDWARE:
1 x BioAmp EXG Pill
1 x BioAmp Cable v3
3 x Gel Electrodes
3 x Jumper Cables
1 x Arduino Uno R4 Minima with USB Cable
1 x Nuprep Skin Preparation Gel
1 x Wet wipe
1 x Laptop (do not connect to charger while recording the EEG signals)
SOFTWARE:
Arduino IDE (https://www.arduino.cc/en/software)
Arduino CMSIS DSP Library (Available under Arduino IDE libraries)
You can get any of the kit mentioned below from our online stores (Shipping Worldwide)
- DIY Neuroscience Kit - Pro (2025 Edition) (DigiKey | Tindie | Robu | Amazon India | Upside Down Labs Store)
- DIY Neuroscience Kit - Basic (DigiKey | Tindie | Robu | Amazon India | Upside Down Labs Store) and Arduino Uno R4 Minima
- BioAmp EXG Pill (DigiKey | Tindie | Robu | Upside Down Labs Store), Nuprep Skin Preparation Gel (Tindie | Upside Down Labs Store) and Arduino Uno R4 Minima
- BioAmp EXG Pill - EXG Explorer Pack (Tindie | Mouser | Robu | Amazon India | Upside Down Labs Store), Nuprep Skin Preparation Gel (Tindie | Upside Down Labs Store) and Arduino Uno R4 Minima
Assembling BioAmp EXG Pill

If in case you received an unassembled BioAmp EXG Pill from a marketplace/distributor, then you may have to assemble it for this project by soldering the header pins and JST PH 2.0 connector, as shown in the diagram.
Connecting BioAmp Cable

Connect BioAmp Cables to BioAmp EXG Pill as shown.
Skin Preparation

Apply Nuprep Skin Preparation Gel on the skin surface where electrodes would be placed to remove dead skin cells and clean the dirt from the skin surface. After rubbing the skin surface thoroughly, clean it with a wet wipe or an alcohol swab.
About Nuprep Gel:
Nuprep skin preparation gel is a mildly abrasive, highly conductive gel that should be applied before placing the electrodes on the skin to improve measurements. When applied gently, it strips away the top layer of skin and moistens the underlying skin layer, which reduces the skin impedance with minimal skin irritation and discomfort.
Complete guide on Skin Preparation: https://docs.upsidedownlabs.tech/guides/usage-guides/skin-preparation/
Electrode Placements

.png)
Let's understand the electrode placements before moving forward in this project. For recording EEG from the prefrontal cortex part of the brain, you have to place the electrodes on your forehead, specifically between Fp1 and Fp2 (refer to the International 10-20 system for recording EEG)
What is the International 10-20 system for recording EEG?
It is an internationally recognized method to describe and apply the location of electrodes in the context of an EEG exam or voluntary lab research. This method was developed to maintain standardized testing methods, ensuring that a subject's study outcomes (clinical or research) could be compiled, reproduced, and effectively analyzed and compared using the scientific method.
Measuring EEG using Gel electrodes:
- Connect the BioAmp Cable to gel electrodes,
- Peel the plastic backing from the electrodes.
- Place the IN+ cable of the BioAmp EXG Pill between the Fp1 and Fp2 positions
- Place IN- on the bony part behind the earlobe on one ear.
- Place REF on the bony part behind the earlobe of the other ear.
Connecting Arduino Uno R4 Minima

Connect the BioAmp EXG Pill to Arduino Uno R4 Minima as directed below:
- VCC to 5V
- GND to GND
- OUT to A0
Now connect Arduino Uno R4 Minima to the laptop using a USB cable.
Note:
BE VERY CAREFUL and follow the above diagram while making the connections between your BioAmp EXG Pill & Arduino Uno R4 Minima, especially the GND and VCC, or else it may damage the sensor.
Uploading Firmware
- Install Arduino IDE (https://www.arduino.cc/en/software) and launch it.
- Install Arduino CMSIS-DSP Library from the Library Manager.
- Download Brain BioAmp Arduino Formware GitHub repository and extract the folder.
- Open the appropriate .ino sketch you want to run in Arduino IDE:
- BCILED: Controls an LED based on focus levels.
- BCIToggle: Toggles the LED on/off using sustained focus for 4 seconds.
- Select your board and COM port under the Tools menu and upload the code.
Note: If an error occurs during code upload, try reconnecting the board and double-press the reset button before uploading again.
Controlling LED With Your Mind

You have 2 options to control the built in LED of Arduino Uno R4 Minima with your mind.
- BCILED: This sketch allows you to control the built-in LED on the Arduino Uno R4 Minima using your focus. When your beta activity rises (indicating strong concentration), the LED lights up. As your mind relaxes and beta power drops, the LED turns off. It creates a simple yet effective neurofeedback to train and observe your concentration levels.
- BCIToggle: This sketch enables hands-free toggling of the built-in LED using sustained focus. By maintaining your concentration for 4 to 5 seconds, the system switches the LED on or off, like flipping a switch using your brain. This method can be extended to control other devices, making it a stepping stone for advanced brain-controlled interfaces.
Note:
- Your laptop should not be connected to the charger as it can induce 50/60 Hz AC interference noise. While recording/visualizing the signals, it is recommended to maintain 5m distance from any AC appliances.
- Whenever you blink, the beta‑wave reading dips sharply as eye movement artifacts momentarily overshadow the true beta signal.
Troubleshooting
If you experience issues with signal quality, then check the below link for tips for best signal acquisition:
https://docs.upsidedownlabs.tech/guides/troubleshoot/tips/index.html
Additionally, there’s an example sketch in the project folder (Brain BioAmp Arduino Firmware) named BCIFFT which displays live EEG bandpower on Serial Monitor of Arduino IDE. You can use this to observe beta waves and all the other brainwaves. If the percentage of beta waves rises above 20 when you focus, the program is working perfectly.
Conclusion
What we've built isn't just a tech demo but it's a glimpse into a future of neurotechnology.
The possibilities are endless. What are you doing to make with it?
Let us know what you think about this project in the comment section below.
You can also mail us at support@upsidedownlabs.tech for any queries or issues while you make this project.