Go Down

Topic: Too much variations in temperature? (Read 1 time) previous topic - next topic

levon


It is best to remove the defect with a capacitor rather than hide it with an averaging.
What is your board ? Uno or Mega?

Edit : the pin which is decoupled is Aref.


I have a UNO, thanks for the info. At this point I'm not confident enough to make the modification to the board you suggest, but I've stored this away for future reference.

Can I put this capacitor somewhere in the circuit on the breadboard .. all my circuits for now are on breadboards as I learn my way around this. Could I put this between the output of the sensor and the analog input on the board?

Thanks.

grendle

take 2 readings, discard the first one

Code: [Select]

float trash=analogRead(0);
float realone=analogRead(0);
Serial.print(realone);


there is also something in the datasheet for the atmega328p on getting better precision from the adc. and... 10.4 Adc noise reduction mode, page 39.

Grumpy_Mike

Quote
Could I put this between the output of the sensor and the analog input on the board?

No put it from the analogue input to ground.

Quote
take 2 readings, discard the first one

This is only useful when looking at two or more analogue inputs of high impedance. With only one input it is not going to do anything for you.

68tjs

Quote
Can I put this capacitor somewhere in the circuit on the breadboard

No.
Aref is connected dirrectly to the heart of the ADC. 
If Aref is noisy, measurement will be noisy.

The decoupling of Aref in entrance of the  board does not work because after the decoupling capacitor Aref track is too long and acts as an antenna. This is a design error of UNO board and probably Mega
You must bypass the interference signals with a soldered capacitor as close as possible to the microcontroller.

turgo

#19
Jul 08, 2013, 08:14 am Last Edit: Jul 08, 2013, 08:32 am by turgo Reason: 1
The Mega 2560 has an internal voltage reference that cuts down on noise:
 
Code: [Select]
  //Set analog reference to 2.56 volts internal
  analogReference(INTERNAL2V56);

I also use a capacitor between ground and my analog pin.

I think you should use the digital DS18B20 one wire sensors.

68tjs

#20
Jul 08, 2013, 09:44 am Last Edit: Jul 08, 2013, 09:48 am by 68tjs Reason: 1
The most important is to remember that Aref is dirrectly connect to the internal reference.
On Aref you can mesure the exact value of the "2.56V internal reference".
And if Aref is noisy Mesurment is also noisy.

ATMega328 Datasheet (for ATMega2560 it is the same):
Quote
ADC Voltage Reference
The reference voltage for the ADC (VREF) indicates the conversion range for the ADC. Single
ended channels that exceed VREF will result in codes close to 0x3FF. V REF can be selected as
either AVCC, internal 1.1V reference, or external AREF pin.
AVCC is connected to the ADC through a passive switch. The internal 1.1V reference is gener-
ated from the internal bandgap reference (VBG) through an internal amplifier. In either case, the
external AREF pin is directly connected to the ADC, and the reference voltage can be made
more immune to noise by connecting a capacitor between the AREF pin and ground
.
VREF can also be measured at the AREF pin with a high impedance voltmeter. Note that VREF is a high
impedance source, and only a capacitive load should be connected in a system.

If the user has a fixed voltage source connected to the AREF pin, the user may not use the other
reference voltage options in the application, as they will be shorted to the external voltage.
If no
external voltage is applied to the AREF pin, the user may switch between AVCC and 1.1V as ref-
erence selection.

The first ADC conversion result after switching reference voltage source may
be inaccurate, and the user is advised to discard this result.



Edit : doing an average without remove the origin of the default is like "to hide the dust under the carpet"

levon


take 2 readings, discard the first one

Code: [Select]

float trash=analogRead(0);
float realone=analogRead(0);
Serial.print(realone);


there is also something in the datasheet for the atmega328p on getting better precision from the adc. and... 10.4 Adc noise reduction mode, page 39.


Thanks, I'll take a look at the documentation, much to learn here :)

levon


Quote
Can I put this capacitor somewhere in the circuit on the breadboard

No.
Aref is connected dirrectly to the heart of the ADC. 
If Aref is noisy, measurement will be noisy.

The decoupling of Aref in entrance of the  board does not work because after the decoupling capacitor Aref track is too long and acts as an antenna. This is a design error of UNO board and probably Mega
You must bypass the interference signals with a soldered capacitor as close as possible to the microcontroller.


Thank you for the additional information, I see what you are saying.

levon


I think you should use the digital DS18B20 one wire sensors.


Would a digital sensor eliminate the noise issue (I'd think so, but being a newbie I'd rather know :)

Go Up