Teensy 3.1 - analogRead 0.1 uF capacitor but what kind?

Status
Not open for further replies.

C3D

Active member
Hello Forum,

since my values on the analog pins are jumping wild i read that one should use a 0.1 micro farad capacitor.

But what kind of capacitor?

I read that electrolyte caps are the best for smoothing signals.

So:

0.1 micro farad
electrolyte
Volts ??
with + and - pole ??


Thanks! :)
 
The choice of the capacitor type depends on the desired bandwidth, the low pass corner frequency and the source impedance. No ideal capacitor exists. Real capacitors are always an ideal capacitor in parallel with a resistor (dielectric losses) and in series with an inductor (wound plate and wiring inductance) and another resistor (wiring losses and no supraconducting plates). Different capacitor types (electrolytic, polyester/polystyrene, ceramic and so on) have different loss characteristics over different frequencies and temperatures. One would choose an electrolytic capacitor for extremely low source impédances, high required capacitance and low frequencies. But the 0.1uF which you require here is a small value for an electrolytic capacitor and a polyester cap would have a much better noise suppression bandwidth since its parasitic inductance is smaller. For a ceramic capacitor, 0.1uF or 100nF is already a high capacitance since these are best at high frequencies and small capacitance values. Thus, for an universal application, the polyester/polystyrene cap or a low ESR ceramic capacitor (X7R series) would be the way to go.
 
Generally ceramic capacitors are best. But not all are created equal. They have 3 digit codes which technically are a temperature spec but can be thought of as an indication of the capacitor's quality. NP0 & C0G mean the same thing and are the best. NP0 is the older term that might be someone's trademark so the modern term for these ceramics is C0G, which is why there's 2 names used for the same thing. Usually these are limited to lower values, though every year capacitor manufacturers seem to add higher and higher capacitance in these types.

The ones beginning with "X" are usually a pretty good trade-off, reasonably good but affordable. The ones starting with "Y" are a much lower quality, and the "Z" types have such low quality that they should generally only be used in disposable products.

But whether a capacitor is even the right solution for your "values on the analog pins are jumping wild" is a good question. We know nothing about what you're really doing, so any general advice about capacitors is blind guessing whether it's the right thing for your needs.

There are a couple scenarios where adding a capacitor can actually make things worse, not better. The 2 that come to mind are when an opamp directly drives the pin and adding a capacitor compromises the feedback loop's phase margin for stability, and use of analog mux chips where adding a capacitor on the switched signal without allowing enough time for each new signal to fully settle within the ADC's resolution causes the channels to interfere with each other.
 
Thank you guys, this is my simple setup.
The battery is 2x 18650 = 8,4V
I'm aware of the possibility of averaging the analogRead() results. But i want to clean the noise with hardware first as good as possible.

AnalogRead_Fluctuating.jpg

The components i used are these :
Step Down Converter
Voltage Divider 5x

Code:
void setup() {
	Serial.begin(9600);
	pinMode(A3, INPUT);
}
void loop() {
	int V = analogRead(A3);
	Serial.print(V);
	Serial.print(",");
	delay(500);
}

Results without anything plugged in A3 :

321, 213, 273, 215, 189, 275, 178, 207, 258, 247, 216, 209, 21 2, 247, 233, 150, 187, 250, 267, 226, 246, 184, 219, 173, 225, 184, 143, 142, 173, 218, 214, 109, 227, 170, 201, 201, 161, 119,
174, 170, 176, 174, 166, 152, 133, 113, 151, 147, 199, 177, 20 3, 158, 193, 120, 104, 196, 113, 192, 159, 229, 232, 209, 147, 202, 214, 209, 222, 218, 199, 167, 190, 268, 237, 286, 228, 219,
208, 259, 258, 248, 220, 246, 238, 248, 278, 247, 259, 251, 25 5, 233, 204, 242, 258, 299, 318, 249, 302, 238, 295, 249, 236, 284, 246, 250, 218, 267, 290, 228, 295, 183, 245, 269, 285, 296,
253, 279, 224, 277, 217, 247, 220, 282, 291, 265, 239, 271, 27 6, 267, 260, 259, 250, 240, 212, 281, 266, 240, 274, 230, 279, 264, 322, 236, 261, 272, 259, 290, 264, 303, 300, 283, 225, 257,
250, 272, 215, 289, 241, 254, 222, 229, 211, 259, 225, 258, 24 1, 265, 218, 222, 290, 199, 298, 288, 255, 282, 261, 224, 215, 221, 284, 292, 240

Results with Battery plugged in Divider and then in A3 :

497, 497, 493, 492, 493, 498, 493, 498, 495, 495, 493, 496, 49 7, 494, 497, 496, 496, 496, 493, 494, 497, 495, 496, 497, 497, 497, 494, 497, 495, 497, 494, 498, 492, 493, 492, 496, 497, 497,
492, 494, 496, 494, 498, 498, 494, 493, 493, 497, 493, 494, 49 7, 493, 497, 496, 493, 497, 494, 492, 496, 495, 496, 497, 495, 496, 495, 495, 496, 498, 492, 493, 497, 496, 496, 492, 491, 494,
496, 493, 495, 498, 496, 497, 496, 495, 496, 494, 497, 495, 49 7, 494, 495, 496, 496, 495, 496, 493, 494, 493, 498, 497, 496, 493, 492, 491, 493, 495, 495, 493, 492, 496, 496, 495, 491, 496,
495, 497, 496, 497, 496, 498, 496, 496, 498, 494, 497, 497, 49 5, 496, 496, 496, 492, 496, 492, 494, 496, 496, 497, 496, 493, 496, 494, 497, 497, 496, 497, 497, 498, 493, 495, 497, 492, 497,
496, 495, 495, 496, 498, 498, 492, 498, 491, 494, 497, 494, 49 2, 492, 494, 492, 492, 492, 497, 498, 496, 497, 496, 491, 494, 496, 496, 498, 494, 491, 496, 496, 494, 497, 496, 495, 492, 494

Code:
void setup() {
	Serial.begin(9600);
	pinMode(A3, INPUT);
	delay(3000);
}

int maxi = 0;
int mini = 1023;

void loop() {
	int V = analogRead(A3);
	if (V > maxi) { maxi = V; SP(); }
	if (V < mini) { mini = V; SP(); }
}

void SP() {
	Serial.print(maxi);
	Serial.print(",");
	Serial.println(mini);
}

Min,Max-Results with Battery plugged in Divider and then in A3 (without delay after 10minutes):

493, 1023
493, 493
493, 490
493, 488
495, 488
498, 488
498, 487
498, 486
499, 486
499, 485
525, 485
526, 485
526, 484


Thanks! :)
 
Okay i will try that.
Yesterday i ordered already some TANTAL and electrolyte 0.1 uF capacitors.

So the ceramic capacitor should also have 0.1 uF ?

Thanks! :)
 
Status
Not open for further replies.
Back
Top