Software
ardEEG uses two pieces of software: an Arduino sketch that reads the shield and sends the data over Wi-Fi, and a Python script on your computer that receives, filters and plots it.
ardEEG ─SPI─► Arduino UNO R4 WiFi ─UDP, port 13900─► Python on your computer
(1.Send_data_via_wifi.ino) (1.Alpha_real_time.py)Source: github.com/Ildaron/ardEEG/tree/main/software (opens in a new tab)
Arduino sketch
software/arduino/1.Send_data_via_wifi.ino (opens in a new tab) sets up the ADS1299, reads every sample and sends packets of 50 samples over Wi-Fi.
Change three things before uploading:
char ssid[] = "Wifi Name"; // your Wi-Fi name
char pass[] = "password"; // your Wi-Fi password
...
udp.beginPacket("192.168.1.241", 13900); // your computer's IP address, portUpload: Arduino IDE → board Arduino UNO R4 WiFi → Upload. Then unplug the USB cable and power the Arduino from the battery.
The Arduino UNO R4 WiFi joins 2.4 GHz networks. If your router has separate 2.4 and 5 GHz names, use the 2.4 GHz one.
Python receiver
software/python/1.Alpha_real_time.py (opens in a new tab) receives the packets, converts them to µV, filters them and shows 8 live graphs.
pip install matplotlib scipy
python 1.Alpha_real_time.pySet your computer's IP at the top first:
UDP_IP = "192.168.1.241" # this computer's IP on the Wi-Fi network
UDP_PORT = 13900
Change the filter
The script shows the 8–12 Hz alpha band by default. The band is set by these two lines (the names are swapped, but the values are the band edges):
highcut = 8 # lower edge, Hz
lowcut = 12 # upper edge, HzFor a general EEG view with blinks and chewing, use highcut = 1 and lowcut = 40.
Speed test
speed_test_250_samples.py (opens in a new tab) checks that the data arrives at the full rate (250 samples per second = 6,750 bytes per second). It receives 25 packets and prints the time taken next to the expected time (5 seconds).
python speed_test_250_samples.py # set UDP_IP inside firstIf it takes much longer than expected, the Wi-Fi link is too slow or losing packets. Move the Arduino closer to the router.
Check the port is free (Windows)
If the Python script can't receive, check nothing else uses port 13900:
netstat -ano | findstr :13900More
- Manual on Google Colab (opens in a new tab)
- Signals & Datasets: sample recordings with plotting scripts
- Specification: data format and registers, for writing your own receiver