Arduino Serial Plotter Not Displaying Negative Values for EMG Signal

Hi everyone,

I'm working on an EMG sensor project with electrodes, a sensor board, an Arduino, a 9V battery, and an additional battery; all components are connected as per my current setup. When I connect the sensor output to an oscilloscope, I can observe the raw signal which includes both negative and positive values as expected. However, when I connect the sensor to the Arduino and view the data using the Serial Plotter, the negative values are missing and the displayed signal does not resemble what I see on the oscilloscope.

Could this be due to the limitations of the Arduino’s input pins, or might there be an issue with my connections or code? My background is primarily in software, and my hardware experience is limited. I’d appreciate any insights or suggestions from those who might have encountered a similar issue.

Thanks in advance for your help!

(Edit: Added hardware info)
Hardware:
Arduino Mega 2506 R3
Large Breadboard
2x 9V Batteries
EMG Muscle Sensor v3
Disposable electrodes
Electrode cables
10 LEDs and 10 resistors (The LEDs and resistors are not for receiving the signal, but for turning them on and off later according to the signal level.)
connection wires

EMG Sensor:

Which sensor?
A schematic / wiring diagram will be useful.

Arduinos can't handle negative voltages; they will damage your Arduino.

Which is...?

If you are hooking this anonymous sensor up to an Arduino's analog input pin, are you taking into account that the pin's input range is limited to [0..Vcc]?

Yes.

You might want to look at this How to get the best out of this forum before you proceed any further.
We only know what you tell us, and without knowing what you have, we don't stand a chance.

So far there is nothing you have told us that comes close to what is needed to identify, let alone solve your problem.

The Arduinios, and all other processors I have come across will not handle negative voltages. The trick to handling them is to add a DC offset to them. Then that offset makes a new zero point, then the Serial Plotter will show variations around this new reference point.

Sorry i added all hardware info and manual with schematic diagram now.

As far as I understand, Arduino pins can’t detect negative voltages, and I’m losing the negative part of the signal. Is there a way for me to capture the negative signal as well and get a signal similar to what I see on the oscilloscope? I’m not expecting it to be as high-quality as the oscilloscope, but I need this signal to train a machine learning model.

It's more serious that that, as already mentioned. You must not expose the Arduino pins to negative voltage, it can damage them.

But this is module is designed for Arduino. It should not output any negative voltage.

Hello,
I realized that I gave incomplete information since I haven’t posted in any forum before, and I apologize for that.
I’m wondering if there is a DC offset in the sensor itself. If not, could you guide me on how I can add one?

Thank you.

From the datasheet:


The SIG output is shown connected directly to the Arduino analog pin, so it must have circuits to prevent damage to the Arduino from negative voltages.

The schematic shows a circuit producing a signal labelled as "rectified" so I guess this deals with the negative voltages in some way.

If this sensor is designed for Arduino and doesn't output a negative signal, is the negative signal I see on the oscilloscope due to the DC offset mentioned by @Grumpy_Mike ? If there is a DC offset in the sensor, why can’t the Arduino detect this signal?

If you have the scope set on AC mode, that may be giving rise to the negative voltages you are seeing. Try DC mode.

I'm trying to understand the op-amp circuit stages shown in the schematic. Some of them I can just about understand, but the part producing the "rectified" signal is a little beyond my analog electronics experience. I'm not sure what it is doing, but I notice there is a pair of diodes there. Maybe this circuit turns the negative voltages to positive, rather than adding a DC offset?

I think you misunderstood me. I’m trying to capture the EMG signal that fluctuates between characteristic negative and positive values, which I can see correctly and as I want on the oscilloscope, but I’m losing the negative signals and getting a low quality signal when using the Arduino.

If you read the Muscle Sensor V3 User Manual, then you will see the following explanation:

I know i did. As i said before i am not familiar with any hardware. It's a machine learning project and i am a software engineering student. I am using the same sensor connecting to oscilloscope and arduino but getting different results.

This module isn't going to give you what you want. It's clear now that it rectifies the negative parts of the signal and does not add a DC offset.

If you want the latter, you will need to design an alternative circuit to amplify the EMG signal and add the offset. The rectification done by the module can't be undone with additional circuits.

Can you show us what results you are getting on the oscilloscope and the Arduino, so that we can see the difference that you are getting?

How often does your Arduino code take readings of the sensor output?

Yes you will. This is because as mentioned before there is no DC offset being applied to the results because the Arduino can not show negative values.

Try taking the reading you get and adding 512 to the value. This should give you a DC offset on the results.

I have limited access to the electronics lab (I'm using the lab oscilloscopes), so I might not be able to immediately share a image from the oscilloscope, but I can share a similar example image. Also, for the signal I obtained from the Arduino, I'm not at my computer right now, but I'll share it as soon as possible. As for the Arduino sampling, I've tested it with no delay as well as with delay(1), delay(10), delay(50), delay(100), delay(200) and different baud rates. Could the lower signal quality be due to the Arduino's own ADC?

I tried what you mentioned before, but since the negative part of the signal is lost, adding 512 only lifts the truncated lower portion a bit. I can't get values below 512 because the Arduino can't read below 0. So, I guess I need to offset the signal before sending it to the Arduino. How can i do that?

Probably not.
Most Arduinos have a 10 bit ADC.

Oscilloscopes often only have 8 bit ADCs (unless you have a relatively new 12 bit HD one) .

So the Arduino might have a higher resolution than the oscilloscope.
I think any differences are more likely to be due to the sampling speed/number of samples taken.