Servo noise in ADC readings

Hello everyone.

I'm designing a myoelectric control system to control a simple 2 DOF gripper. I've already made the myoelectric signal adquisition circuit and it works really well, with very little noise. I'm using Arduino to do the analog to digital conversion with a sampling frequency of 1KHz (using the MsTimer2 library). I perform a moving average of the myoelectric signal, to have an estimate of the amplitude. Then, when the amplitude exceeds a certain threshold, the servomotor moves to a predefined position.

The problem arises when the servomotor starts moving. As you can see in the attached images, when the servo is working, the EMG signal is riddled with noise. I've tried to solve this putting a 10uF capacitor between the power and GND pins of the servo, and a 100nF capacitor between the control and GND pins of the servo. But the noise is still there (in fact, the images are taken using the capacitors). I'm powering the Arduino, the EMG circuit and the servo with the USB cable. Maybe if I use a separate power source for the servo the noise problem can be solved?

What else can I do? I prefer to eliminate the noise via hardware, and not software, to keep the Arduino program as simple as possible. Also, I have a time constraint: all the signal processing has to be done in less than 1ms, as every 1 ms a new sample is taken (using the MsTimer2 interrupt).

Thank you in advance.

EMG signal without servo noise.
EMG signal with servo noise.
EMG signal with a lot of servo noise.

Something wrong with your moving average filter, should be pretty easy to clean up.
Try 100 nF cap on a motor power wires, instead of control line, also you could add up ferrite beads.

Try shilding the cables. And tie shields to ground only at 1 end.

Magician:
Something wrong with your moving average filter, should be pretty easy to clean up.
Try 100 nF cap on a motor power wires, instead of control line, also you could add up ferrite beads.

The signal in the images is the raw EMG signal, not the averaged one. The moving average works well when the motor is not moving, but when it does, the moving average have amplitude bumps, corresponding to the noise spikes.

I have a 10uF cap on the motor wires, and I've also tried a 100nF one with more or less the same result. I thought about putting an inductor in series (that's the same than use ferrite beads, if I'm not wrong), but I don't know what value I should choose.

kf2qd:
Try shilding the cables. And tie shields to ground only at 1 end.

I suppose that you mean shielding the motor cables, not the one that goes from the EMG circuit to the ADC pin of the Arduino. I'll try this.

Thanks guys!

I'm powering the Arduino, the EMG circuit and the servo with the USB cable. Maybe if I use a separate power source for the servo the noise problem can be solved?

Not too smart to power servos from the arduino. Servos need a larger seperate power supply.

zoomkat:

I'm powering the Arduino, the EMG circuit and the servo with the USB cable. Maybe if I use a separate power source for the servo the noise problem can be solved?

Not too smart to power servos from the arduino. Servos need a larger seperate power supply.

Yep, I thought so. Thanks!

Well, problem solved. I've powered the servo with 9V and a 7805 and the system works like a charm. Thank you all.

When everything is finished, I'm planning to publish everything in my webpage. I'll publish the schematics of the EMG circuit, the Arduino code and the robotic gripper .stl files (I'm going to make it with a MakerBot 3D printer). Of course, all this will be well documented, and I'll also include a section with the theory behind EMG signals.

I'm also planning to design, and perhaps sell, a 2 or 4 channel EMG shield for Arduino, although I'm not sure if there's enough interest in the Arduino community for an EMG shield to make it a profitable investment.

Thanks again for all your help. Cheers!