3

Currently trying to read off values from a photodiode through analogread. It's constantly so noisy and I thought it might be something wrong with my low-pass filter, but I decided to just connect a 1.5V battery to an analog pin and had just as much noise (upwards of 10mV oscillations). Is there a way around all of this noise? Because this makes the collected data unusable for my project.

this is how I connected the battery to read of analog values that were still noisy

Code to read off analog values:

int diodePin = A0;
int sensorValue = 0;
int sensorVoltage = 0;

void setup() {

Serial.begin(57600);

}

void loop() {

sensorValue = analogRead(diodePin); sensorVoltage = sensorValue*(5000/1024); Serial.println(sensorVoltage); delay(10);

}

Yousuf
  • 31
  • 2
  • 4
    Without a schematic it'll be impossible to help, although it may be more relevant on the electronics SE. 0.01V out of 3.3V/5V doesn't sound that bad, but it depends on context and hardware. – Dave Newton Jun 28 '21 at 16:48
  • are the readings noisy if the sensor is exposed to sunlight only? – jsotola Jun 29 '21 at 02:54
  • no. noisy readings at all times. as i said, even if I literally just try to read the voltage of a AA battery off of an analog input, it doesn't give me a smooth reading at all. – Yousuf Jun 29 '21 at 03:51
  • sure: take 3 readings, sort, keep only the middle one. – dandavis Jun 29 '21 at 04:30
  • 1
    I need continuous good readings so that I can perform a Fourier transform on the collected data – Yousuf Jun 29 '21 at 13:50
  • Please post the schematic, not a frizzy thing. Your question is a tough one and without being there the next best thing is the schematic you drew as you wired it. Links to technical information on the hardware devices makes it easier for all of us. At this point all we can do is guess. – Gil Jun 29 '21 at 15:35
  • 1
    Just to make sure I understand: you're putting 1.5V into an analog pin (5V reads 1024, so 1.5V would be ~307), it's a 10-bit ADC so ~5mV with the default analog reference. You're seeing values from 306-308. What are you using to power the Arduino? Have you tried using a different reference or a stable AREF input? Have you checked things like [this] (https://forum.arduino.cc/t/help-with-weird-analog-input-problem-unstable-analog-reference/82011)? Without a solid reference voltage this still doesn't seem that unusual. Analog had a lot of moving parts. – Dave Newton Jun 30 '21 at 14:02
  • Per your frizzy thing you should get zero as the Arduino does not have any power and the A+ and Ground are connected together on the + terminal. Posting a schematic would help a lot, Dave Newton suggested that a few days ago. – Gil Jun 30 '21 at 20:32

1 Answers1

3

I always do two things for when "reading" analog data with an Arduino.

  1. Measuring the voltage supply of the arduino board through its internal reference and calibrating with another 'good" voltmeter ("4 1/2" digits-20000 points or "3 3/4" digits-6000 points). ( Usefull link https://www.instructables.com/Secret-Arduino-Voltmeter/ )

  2. Sampling more analog datas to calculate a "mean" ... This can remove some "noise" and add "some bits". 16 samples would add "4" bits at your "readings". Of course, the global sample rate will be lower.

Don't forget, ground star of wires !!!

Antonio51
  • 151
  • 5
  • Keep in mind that averaging samples will increase the resolution but might not improve accuracy. Only random noise can be "averaged out"...systemic inaccuracy will remain. – Elliot Alderson Jul 27 '21 at 20:57
  • Right. Only in the case if "linearity" is better than 1/16 LSB min ... which is very "rare". Some cases of 1/4 LSB of very good converters. – Antonio51 Jul 28 '21 at 07:02