Hello everyone! I am doing a project using Myo armband with Processing. Using the myo-for-processing library, the signal data processing receives for the device is raw and hence very jittery. I need to smoothen that signal data for better output. Can anyone help regarding this?
Collect multiple values and then get the medain. Alternatively or additionally you can make it so the code doesn’t jump to the next value but increases / decreases the variable until the value is the same.
Usually you can implement a smoothing algorithm to work in your myo data. I believe there is a library that also remove noise. You can install it through the Contribution manager in the PDE and see if you can make it to work. Notice this library is not built for myo but it is more of a general library. You still need to create some code to use it for your purpose.
Just out of curiosity, what myo arm version are you using?
Kf
Can you help me out a bit here?
import de.voidplus.myo.*;
Myo myo;
ArrayList<ArrayList> sensors;
void setup() {
size(800, 400);
background(255);
noFill();
stroke(0);
// …
myo = new Myo(this, true); // true, with EMG data
sensors = new ArrayList<ArrayList>();
for (int i=0; i<8; i++) {
sensors.add(new ArrayList());
}
}
void draw() {
background(255);
// …
// Drawing:
synchronized (this) {
for (int i=0; i<8; i++) {
if (!sensors.get(i).isEmpty()) {
beginShape();
for (int j=0; j<sensors.get(i).size(); j++) {
vertex(j, sensors.get(i).get(j)+(i*50));
}
endShape();
}
// println(sensors.get(i));
}
}
}
// ----------------------------------------------------------
void myoOnEmgData(Device myo, long timestamp, int [] data) {
// Data:
synchronized (this) {
for (int i = 0; i< data.length; i++) {
sensors.get(i).add((int) map(data[i], -128, 127, 0, 50)); // [-128 - 127]
}
while (sensors.get(0).size() > width) {
for(ArrayList sensor : sensors) {
sensor.remove(0);
}
}
}
println(“data [0]”, " = ", data[0]);
//println(“data [1]”, " = ", data[1]);
// println(“data [6]”, " = ", data[6]);
//println(“data [7]”, " = ", data[7]);
}
Here, int [ ] data is the signal data I am receiving every millisecond from 8 EMG sensors. How do I retrieve the values from it ? Sorry to bother you, I am not really proficient in processing.
Hi,
I tried using the signal filter library but for some reason, it’s just crashing my sketch. Do you know of any other library that would help me do the job? Also, I am using this Myo : https://www.youtube.com/watch?v=1u5-G6DPtkk
Please format your code
It consist on these two steps:
- In your code editor (PDE, VS code, Eclipse, etc) ensure you execute the beautifier function. This function automatically indents your code. Auto-indenting makes your code easier to read and helps catching bugs due to mismatch parenthesis, for instance. In the PDE, you use the key combination:
ctrl+t
- You copy and paste your code in the forum. Then you select the code and you hit the formatting button aka. the button with this symbol:
</>
That’s it! Please notice you do not create a new post in case you need to format something you already posted. You can edit your post, copy the code to the PDE, indent the code properly there and then past it back here, format the code and >> save << the edits.
Extra info:
Formatting your code makes everybody’s life easier, your code looks much better plus it ensures your code integrity is not affected by the forum’s formatting (Do you know the forum processes markup code?) Please visit the sticky posts or the FAQ section/post to learn about this, other advantages and super powers you can get in this brand new forum.
Kf
Check these links:
Smoothing - Wikipedia
http://195.134.76.37/applets/AppletSmooth/Appl_Smooth2.html
Intro. to Signal Processing:Smoothing
You can implement a moving average as it is one of the simple ones.
Do you mind showing your attempt?
Kf
Not really to answer your question but related to the topic:
Does anybody know how that band works?
Does it pick up electric signals of the nerves and if so what voltage levels can be expected here and how does it pick those up? Wires?
Or is it a capacitive sensor? Or pressure? Or acceleration and gyro?
@MxFxM Check section V in this pdf: https://zapdf.com/recognition-of-human-arm-gestures-using-myo-armband-for-the.html
Kf
@kfrajer wow that’s an interesing read. Thank you!