Smoothing Analog Temperature Sensor Output with a Capacitor

Thread Starter

bryancostanich

Joined Feb 10, 2018
13
Hi folks! I'm using a TMP36 plugged into the ADC on a Netduino, and the signal is pretty noisy:

SDS00006.png

The spikes in there are my concern; they tend to make a bit of a mess of readings. I can oversample, of course, and that works fine, but I'd really like to clean them up a little bit with hardware.

In my (limited) understand and reading, I know that a capacitor resists changes in voltage, so I tried varying capacitors between the `Sout` and `GND`, including 0.1µF, 0.22µF, 1µF, 4.7µF, and 10µF, all with what looks like no effect. I also thought I could try to smooth the voltage _to_ the sensor by putting them between `Vin` and `GND`.

however, none of this has actually changed my signal.

Any ideas?
 

Thread Starter

bryancostanich

Joined Feb 10, 2018
13
I'm not sure what frequency it's at. It does look at be somewhat regular. It appears to be somewhere around 7ms intervals, which would be ~140hz. but there are some smaller spikes in there, too Is there a function on scopes to kind of guess at spike frequencies, or do you just look at it and compare the millisecond intervals and convert? This is it at 10ms divisions:

SDS00012.png

When you say "shield the leaves" i'm not sure what you mean, google isn't helping me much there. Do you mean put like putting the wires to the sensor through a metal tube thing?
 

spinnaker

Joined Oct 29, 2009
7,835
Hi folks! I'm using a TMP36 plugged into the ADC on a Netduino, and the signal is pretty noisy:

View attachment 145649

The spikes in there are my concern; they tend to make a bit of a mess of readings. I can oversample, of course, and that works fine, but I'd really like to clean them up a little bit with hardware.

In my (limited) understand and reading, I know that a capacitor resists changes in voltage, so I tried varying capacitors between the `Sout` and `GND`, including 0.1µF, 0.22µF, 1µF, 4.7µF, and 10µF, all with what looks like no effect. I also thought I could try to smooth the voltage _to_ the sensor by putting them between `Vin` and `GND`.

however, none of this has actually changed my signal.

Any ideas?

Are you certain it is not the TMP36 that is noisy?

Also I would eliminate the Netduino from the circuit for now. Begin at the beginning.


Also check your power supply.
 

wayneh

Joined Sep 9, 2010
17,167
When you say "shield the leaves" i'm not sure what you mean...
Sorry, an unfortunate typo. The "f" is right next to the "d".

One thing you might try if you can, is to run the whole thing on DC and avoid as many AC appliances as possible. Fluorescent shop lights are notorious 'transmitters'. If you can make it go away, you're half way to a solution.
 

Thread Starter

bryancostanich

Joined Feb 10, 2018
13
I think the sensor is just noisy. :S

I braided and shielded the cable with copper, and then hooked the sensor up to my bench top power supply and I still had that noise.

I also tried the 10kΩ resistor in series and it didn't smooth it, either. It did, of course, change the voltage level.
 

philba

Joined Aug 17, 2017
959
Are you using the R and C as a low pass filter? I'm pretty sure a cut-off frequency in the 1KHz range will take care of most of the noise if it's coming from the sensor. If it's coming from your netduino, not going to help.
 

philba

Joined Aug 17, 2017
959
Hmmm, it sounds like the noise is coming from the netduino but it should be easy to know. Try removing the netduino from the mix and check the sensor output.

I'm not familiar with the Netduino but, in general, Arduinos are not super well engineered for analog input. You might have to resort to oversampling.
 

Thread Starter

bryancostanich

Joined Feb 10, 2018
13
heh. nope! didn't even know it needed one. damn, has to be smashed right there with the temp sensor.

i'll try that out and report my findings.
 

ebp

Joined Feb 8, 2018
2,332
Sometimes it is extremely difficult to distinguish what is "real" with an oscilloscope. With a circuit like that in question, you do have the very large advantage of being able to disconnect the scope and look at the signal with the ADC.

In many cases where noise appears to exist, especially narrow spikes that nothing seems to eliminate, you need to take steps to identify "reality". The first thing to do is put your scope probe tip right at the same point to which you have the probe ground connected. It is not at all uncommon to find that you'll see the same magnitude of noise, which of course seems to make no sense whatever. If you see noise that way, the next step is to replace the probe ground lead with a probe tip grounding device. Remove the clip sleeve from the probe and put on the tip grounder. Usually these are made like springs with a little side arm. The spring bit goes over the exposed metal ground ring just behind the actual pointy tip of the probe. Now return to your circuit board and find a place where you can get both the tip grounder and the probe tip onto ground foils that are very close together. This often is not easy and you must avoid slips that can short things on the board. If the noise shows up, it is most probably not "real" as far as the signal i concerned. It is real, but the source is from something else, such as a switched mode power supply. If the noise goes away with the tip grounder, go back and look at your signal using it.

A significant problem with all circuitry is that there is only one point in the whole mess that you can call zero volts or ground. Every other point, even though it "should" be ground, isn't. Resistance and often more importantly, inductance, come into play. On low frequency digital circuits that are reasonably compact, it usually isn't a big deal. If there are fast transitions in currents or large magnitude ground currents, it can be a nightmare. And of course the scope is grounded to earth ground via its power cord. Even if it isn't actually galvanically connected to ground, the capacitance of the scope chassis to "everywhere" makes a path for high frequency.

The capacitance at the tip of the probe and the inductance of the usual probe ground lead form a resonant circuit. Sometimes this resonance can make a small amount of actual noise appear much larger or stretch a very narrow spike into a ring-down. The tip grounder greatly reduces the inductance. "Active" probes which have ultra-low tip capacitance (1-2 pF for moderate-performance probes) go at the issue the other way, allowing the use of ground lead with the usual inductance. Active probes are expensive (several hundred dollars is entry level) and usually very limited in allowable input. But they can be invaluable and sometimes absolutely necessary.

Hint to people laying out prototype and even production PCBs for fast or noisy circuitry: If you have a ground plane on the component side, put little dots on the solder mask layer, so you'll get little dots of exposed copper, all over the place around circuitry that you might want to probe with a tip grounder. It makes life a lot easier. If you put a bit of solder on the exposed copper dots and use a fine tipped awl to make a little dent in it, you get a place to put the tip grounder that is is much less slip-prone. Small vias with no solder mask are also good, especially on a multi-layer PCB where ground is an inner layer - but you have to have room to place them.
 
Top