Designing firmware to measure and transmit brainwave data between EEG devices and computers through serial communication
Overview
Cerelog is revolutionizing human-computer interaction through advanced neural interface technology, developing high-resolution Brain Computer Interface (BCI) platforms. Their flagship product, the Cerelog ESP-EEG, is an 8-channel biosensing circuit board designed for EEG, EMG, ECG, and BCI research applications with 24-bit ADC resolution and 500 SPS sample rate.
During my internship at Cerelog, I worked on BrainFlow integration and dataflow optimization for their EEG hardware. This project involved developing systems for real-time brainwave data processing and serial communication, building robust protocols to handle the complex data flow between their ESP32-based hardware and software applications.
Key Contributions
- BrainFlow Integration: Improved hardware integration with the BrainFlow library, an industry-standard open-source library for biosignal processing
- Timestamp Optimization: Developed time-function improvements to achieve accurate timestamping within 125ms precision
- Serial Protocol Management: Implemented message packaging and unpacking for the ADS1289 chip data format with proper padding and checksum validation
- Error Handling: Built robust error handling and data formatting systems for reliable data flow between hardware and software
- Board Configuration: Set up parametric configuration capabilities for sample rates, channel control, and voltage signal gain adjustments
Technical Details
The project involved working with Cerelog's ESP32-based EEG hardware and the BrainFlow library. Key technical challenges included:
- Serial Protocol Implementation: Working with the ADS1289 chip's specific message format requiring 2-byte start markers, 1-byte message length, 4-byte timestamps, 27-byte data payloads, and checksum validation
- Arduino ESP32 Integration: Developing firmware for the ESP32 chip to handle SPI communication with the ADS1289 and USB serial communication with the computer
- BrainFlow Compatibility: Ensuring the hardware could seamlessly integrate with BrainFlow's push_package() format for downstream signal processing and ML applications
- Real-time Data Processing: Managing buffer systems and implementing timestamp synchronization for accurate 500Hz data collection
Impact
This internship experience was foundational in my understanding of how software engineering can be applied to real-world problems in emerging technology fields. The work with brainwave data and serial communication systems demonstrated the importance of building robust, real-time systems that can handle complex data streams reliably.
Reflection
This project marked an important step in my transition from mechanical engineering to software engineering. Working with brainwave data and real-time systems showed me how software can be used to interface with and process data from physical sensors and devices, bridging the gap between hardware and software in meaningful ways.