Noise output from electromagnetic sensor

Hi everyone, I am begginer using arduino, and I am trying to find out the output voltage that comes from an electromagnetic sensor. It is meant to work giving values between 0 and 2.5 depending on how the magnetic field changes. When measuring the output with the ARDUINO UNO board I commonly receive a lot of noise in the signal, sometimes a low frequency (around 4Hz) frequency how is shown in the image 1 and another times with this type of noise in the second image (plotted with matlab) that I cannot figure out where it comes from. I don't know if this is quite common sometimes or related with the sampling rate...

Do you have any idea of where this signal comes from? Any suggestions to stabilize the signal?

Circuit assembly and the code used is also attached. Thanks in advance! :blush:

void setup() {
// initialize serial communication at 9600 bits per second:

// the loop routine runs over and over again forever:

void loop() {
// read the input on analog pin 0:
int sensorValueX = analogRead(A4);

// print out the value you read:

Serial.println(" ");

delay(100); // delay in between reads for stability

@migferba, your topic was moved to a more suitable section of the forum.

Please edit your post, select all code and click </>; next save your post again.

Please post a link to the sensor.

All sensors produce noise, as well as possibly genuine signals.

The frequency of the signal/noise you observe may be totally misleading, due to aliasing with the sample rate.

With your code, the sample rate is unpredictable, because printing takes time, depending on the number of characters that are actually printed.

This line is not useful, and the comment is wrong. If you want a stable sample rate, you need to use millis() or micros() (see the Blink Without Delay tutorials).

delay(100); // delay in between reads for stability
1 Like

If your test setup is anywhere near the mains AC power wiring, it will pick up the fluctuating magnetic field from the wiring.

1 Like

put 1uF and 0.1 uF from A4 to ground.

Hi, @migferba
Welcome to the forum.

We need to see a much closer picture of your sensor and a link to data/specs please.
A circuit diagram would also help.

If you are powering the sensor from another supply, do you have the gnd of that supply and the gnd of the UNO connected together?

Thanks.. Tom.. :grinning: :coffee::+1: :australia:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.