The Hexabitz Biosignal Logger is a powerful and portable tool designed for capturing biosignal data using the Hexabitz Single-Lead, EXG Monitor (H2BR0x). This project aims to facilitate the process of collecting and analyzing biological signals for users through a simple and accessible device.
Key Features1. Real-Time Data Collection: The Hexabitz Biosignal Logger can collect biosignal data in real time directly from the H2BR0x unit.
2. Ease of Use: The device is controlled and samples are collected using BOS command line, making it user-friendly for developers and researchers.
3. Modular Connectivity: Hexabitz's modular design allows for easy integration and addition of other units as needed.
🌟 Single-Lead, EXG Monitor (H2BR0x):Hexabitz Single-Lead, EXG Monitor Module (H2BR0) is one of a kind module that can record publication-grade biopotential signals from your body be it from the heart (ECG), brain (EEG), eyes (EOG), and muscles (EMG).
What makes it different?
- Record publication-quality biopotential signals like ECG, EMG, EOG, or EEG.
- Small size allows easy integration into mobile and space-constrained projects.
- H2BR0 is based on STM32G0 MCU.
- Program advanced C code with our easy-to-use APIs.
- You can connect to external hardware or combine with other Hexabitz modules!
- The module is equipped with an open source MATLAB interface.
1. Hardware Setup:
In order to access the serial COM port of your computer, use your preferred serial terminal emulator tool, and reach Hexabitz CLI via USB-to-UART cable.
If you’re using a standard FTDI USB-UART 3.3V power and communication cable, refer to the following instructions to connect the colored cable wires correctly:
🔴Red (VCC) >> 3.3V (the top power pad, i.e., the corner edge pad).
⚫️Black (GND) >> GND (the bottom power pad, i.e., the corner edge pad).
🟡Yellow (RXD) >> MCU TXD (the top communication pad, i.e., the side edge pad).
🟠Orange (TXD) >> MCU RXD (the bottom communication pad, i.e., the side edge pad).
2. Software Configuration:
0. Update Module Firmware: There are three easy methods to get pre-compiled firmware HEX files for the release you want without cloning and compiling the firmware:
- Navigate to module website page, Resources tab and download HEX files for latest firmware release.
- Visit module firmware repository on GitHub and click on Releases, recent releases should show up with their associated HEX files.
- Visit module firmware repository on GitHub and navigate to the Compiled folder within the code. The folder contains HEX files for current and previous releases. Simply copy the release you want if you have a local copy. If you are browsing the repository online, click on the HEX file then, click on Raw to display and download the file. You can also download a zip folder of the entire repository using the Clone or download button.
1. Install MobaXtrem from here: https://mobaxterm.mobatek.net/download.html
2. Connect the FTDI USB to UART Serial cable to the USB hub.
3. Solder a header connector to one of the power ports of module.
4. Connect the red wire of the FTDI cable to exg module power port top side.
5. Connect the black wire of the FTDI cable to module power port bottom side.
6. Connect the yellow wire of the FTDI cable to module port P2 top side.
7. Connect the orange wire of the FTDI cable to module port P2 bottom side.
8. You should see a single red indicator LED blink on the module.
9. Open MobaXtrem and choose the following settings:
10. Press enter in the Commands window, you should see BOS CLI welcome message. You can use backspace if you misspell a letter.
Note: Once you open the port, press the ENTER keyboard key to start the communication session. You should see the CLI welcoming message represented below which contains the ID number of the connected module and its matching array port. Note if the module is native, i.e., not part of an array via a fixed or explored topology, it will show up as ID = 0 (unless you change the default ID in the code).
11. Type ping (and press enter), you will see a single indicator LED blink on the module and a response message on the terminal.
12. Type help to view a list of available Commands.
13. Type status to view a report on module ports, firmware, etc.
General Usage Tips
- Type help anytime to view the list of commands enabled in this module (and in this firmware). You can figure out the firmware version, compile-time, and date using the status command.
- If you misspell a command you can use the BACKSPACE keyboard key to delete the last characters and replace them with correct ones, as long as you have not pressed ENTER yet. BACKSPACE does not actually work in the terminal window as in a regular text editor, but it will still work fine with the CLI. You cannot clear a character from the terminal window, for instance when you press BACKSPACE, the blinking cursor will move back one step, but the previous character will stay displayed. However, It will be removed from the CLI buffer. If you write a new character, it will replace the old one on the terminal window, and it will be added to the CLI buffer.
- If you misspell a command and press ENTER, it will be ignored, and you will get an error message “Command not recognized”. This will happen as well if you typed fewer parameters than expected in the command. If you type more than the required parameters, then the extra ones will be ignored. Command parameters are separated by at least one white space (SPACE key) and they will be parsed according to their order.
- If you typed multiple white spaces between parameters, they will be parsed correctly. However, the maximum number of characters in each command (i.e., line) should not exceed 49 (it’s adjustable in the code).
- If you hit ENTER without writing anything, the last command will be repeated.
- All CLI commands and parameters are case-insensitive, that’s why writing in lower-case, upper-case, or mixed-case will be perfectly recognized.
- It’s referred to each module by its ID prefixed with # (e.g. #7) or by its alias name.
Commands:
Obtaining a normal sample and a filtered sample from the ECG signal:
Obtaining a normal sample and a filtered sample from the EOG signal:
Obtaining a normal sample and a filtered sample from the EEG signal:
Obtaining a normal sample and a filtered sample from the EMG signal:
Determine the duration of the EMG signal exceeding the threshold:
Extract the heart rate from the ECG signal:
Establish the EMG signal threshold within the range of 0 to 100:
Detect eye movement patterns (rapid right or left, up or down) based on electrode positioning:
Monitor the status of electrodes:
plot exg (Numofsample: minimum=100):
3. Data Collection and Analysis: Once the system is set up and configured, start collecting biosignal samples.
Now that we have the stream data saved in data.txt, we can use Python to read and plot the data. We'll use the matplotlib library for visualization.
Use the following Python script to read the EOG data and plot it:
import matplotlib.pyplot as plt
# Read data from the text file
with open('data.txt', 'r') as file:
lines = file.readlines()
samples = []
filtered_samples = []
# Extract values from the text
for line in lines:
parts = line.split()
sample_value = float(parts[1])
filtered_value = float(parts[3])
samples.append(sample_value)
filtered_samples.append(filtered_value)
# Plot the data
plt.plot(samples, label='Sample')
plt.plot(filtered_samples, label='Filtered Sample')
# Add titles and labels
plt.title('Sample vs Filtered Sample')
plt.xlabel('Index')
plt.ylabel('Value')
# Display the legend
plt.legend()
# Show the plot
plt.show()
Explanation of the Python Code
- Reading Data: The script reads the data from data.txt.
- Extracting Values: It processes each line to extract the sample and filteredSample values.
- Plotting Data: It uses matplotlib to plot these values on a graph, providing a visual representation of the data trends.
Comments
Please log in or sign up to comment.