Question on OpenBCI_GUI Networking Widget to Arduino (EMG)

Hello, I just bought a "Cyton Biosensing Board (8-channels)" and would like to work on the following task:
When the EMG signals (say Channels 1 and 2) sense that the sets of muscles contract, an Arduino UNO board would do a certain task correspondingly (say turn on a LED).

The two possible ways I can think of are:
Method 1: Cyton senses the EMG signals from two channels. OpenBCI_GUI would then do the simple analysis (unlike the complication in the signal analysis of EEG, I would just see if the EMG signal is higher than a certain threshold). Then OpenBCI_GUI would send a command to Arduino through Serial port by networking widget. Arduino board will do the corresponding actions upon receiving the commands.
Method 2: Cyton senses the EMG signals from two channels. OpenBCI_GUI would then send time domain data or FFT data or EMG data to Arduino through Serial port by networking widget. Arduino board will do the data analysis by itself and do the corresponding actions.

Which method is better?

My technical background: I am okay in ordinary Arduino C programming but have no experience in Java programming. I have installed the Processing IDE and get the IDE ready for the OpenBCI_GUI, but have no ideas on how to edit the program to achieve what I want to do in Method 1. It looks easier for me in Method 2, although I know that data analysis would be better to be done in the computer. I tried to write a simple Arduino programme for my Arduino UNO and confirmed that the OpenBCI_GUI can continuously send something to Arduino through Serial port with networking widget but I have no idea on what the OpenBCI_GUI is sending to Arduino.

Can anyone help? Thank you very much for the reading and look forward to your help!

Best wishes,
John

Comments

  • techsupporttechsupport United States
    I like approach 1 because it requires sending less data over serial port to arduino. There is a way to already send EMG data over the networking widget. You can adjust the thresholds and be able to output over serial port! Have you checked out the EMG widget yet?
  • With the help of my friend in modifying the programme in Processing, I am now able to send a character to Arduino using networking widget after knowing simple analysis of the FFT data! (e.g. sending character 'A' through serial if the amplitude is higher than a certain value at a certain frequency) This is the way I deal with EMG now. But I have no idea about what the EMG widget is representing. What is the circles in EMG widget means? How can I adjust the threshold? What output is it making over serial port?

    Thank you very much for the kind help!
  • edited November 2018
    Hi John,

    Great question!

    It is important to consider what this widget is trying to achieve. In a nutshell, we are trying to map the current flex of a muscle into the "comfortable flex range" of said muscle, and then represent that as a decimal between 0 and 1. Having the normalized value is nice because then you can apply it as scalar to any other variable, allowing for a pseudo-analog mapping of the strength of any muscle flex to an arbitrary output. In theory, if you relax, the value will be 0, and if you flex, the value will go to 1. The current EMG strength is a collection of raw voltage values averaged (or smoothed) over a known window of time. The bigger the window your averaging over, the smoother the data.

    We establish an upper threshold (the outer dark blue circle of the circular visualizer) and a lower threshold (the inner dark blue circle) for the constantly updating "comfortable EMG range." Then we're mapping the current EMG (the filled circle that matches the color of the channel) value between the upper and lower thresholds. This pseudo-analog mapped value is represented more clearly in the bar graph off to the right of each channel's circular visualizer. The upper threshold is constantly creeping downwards and lower threshold is constantly creeping upwards until they get the Min ΔuV away from one another. This ensures that the overall system never creates an upper/lower flex range that is too big to influence with a muscle flex. The drop-downs of the widget are designed to allow you to tweak the various parameters of this relationship.

    There are 4 drop-downs giving us control over 4 parameters: 
    1) Smooth
    2) uV Limit 
    3) Creep 
    4) Min ΔuV

    Smooth: 
    This is the size of the window. If we set this value at the smallest setting of 0.01 seconds (ie lowering the smooth value), our data will be very jittery but responsive. Alternatively, if we increase the smooth and set our window to 2.0 seconds, the output will be very smooth but not as responsive.

    uV Limit: 
    This is a cutoff point for an allowable uV value in any individual data block. Any uV values above this number will be chopped off, and set to this upper uV limit. This is to prevent crazy big blips in the data from substantially distorting the average. Sometimes dropped packets and rapid body movements can great large spikes that don't correlate to muscle activity. This helps account for those issues.

    Creep: 
    This value indicates how quickly the upper uV limit creeps downward and how quickly the lower limit creeps upward. Notice that by adjusting this value, the upper threshold and lower threshold rings will creep inwards more quickly. I prefer this to be slow. If this is too fast and we wait too long between muscle activations, the upper threshold will have crept very close to the lower threshold and the system will be hyper sensitive. This can certainly be improved with a smarter algorithm.

    Min ΔuV: 
    This value sets the minimum voltage range between the upper threshold and lower threshold. The upper threshold and lower threshold cannot get any closer than this. By making this value bigger, you will have to flex harder to go from 0 to 100% flex, after the thresholds have crept as close as they will get to one another (aka Min ΔuV). 

    What do we really care about for controlling things? If we want analog control over an output, I think it's the normalized flex value represented in the bar graph. Or, if we want binary control, maybe we want to use a boolean YES/NO of whether the bar graph is full or not.

    I hope that helps clarify things a bit. Let me know if you have any other questions.

Sign In or Register to comment.