And one more round of checks on the 'scope' graphs. LMT86 patched directly on the breadboard - no long wires / no cords / no op amps etc.
500k samples per sec LMT86 to STM32F401 ADC PA0
There are still some visible artefacts, but that the amplitudes are much smaller.
This basically confirms the 'radio waves' interference hypothesis
fake lm35dz temperature sensors
Re: fake lm35dz temperature sensors
Last edited by ag123 on Thu Sep 23, 2021 8:12 pm, edited 1 time in total.
Re: fake lm35dz temperature sensors
The trick here is to do the smoothing in Var' x N, where N is power of 2 (alpha = 1 / N).
So rounding errors don't accumulate.
So rounding errors don't accumulate.
Re: fake lm35dz temperature sensors
21 / 0.16 = 20+ or 4 to 5 effective digits.
I tend to there is something seriously wrong here. What do you get if you add a fixed vitale?
I tend to there is something seriously wrong here. What do you get if you add a fixed vitale?
Re: fake lm35dz temperature sensors
@dannyf
Thanks for the suggestion of using factor of 2 as N values, I'd try some values to test the averages.
Oops, I do not understand the statement
Thoughts are that in an ideal, no EMI environment, this measurement errors may literally be much smaller down to the LSB on the 12 bit ADC.
The fit isn't a normal distribution in a general case, but that if values outside +/- 0.5 deg C from median is rejected, the resulting samples have a good fit on the normal distribution. Which gives an apparent standard deviation of 0.16 deg C.
Thanks for the suggestion of using factor of 2 as N values, I'd try some values to test the averages.
Oops, I do not understand the statement
But I still think my analysis is somewhat flawed. It seemed, what I really measured is really the variance caused by radio wave interference i.e. EMI.21 / 0.16 = 20+ or 4 to 5 effective digits.
Thoughts are that in an ideal, no EMI environment, this measurement errors may literally be much smaller down to the LSB on the 12 bit ADC.
The fit isn't a normal distribution in a general case, but that if values outside +/- 0.5 deg C from median is rejected, the resulting samples have a good fit on the normal distribution. Which gives an apparent standard deviation of 0.16 deg C.
Re: fake lm35dz temperature sensors
Another thing I'd likely try is to place an RC low pass filter before the ADC input or before an Op-Amp as a buffer.
I managed to make a bode plot for an RC filter This is for
R = 500 ohms
C = 1.0uF
It gives me a -3 dB cut-off frequency of 318.3 Hz.
The data sheet for LMT86, stated that for 1 uF, the minimum R value needs to be 1 K ohm.
I'm not sure if that is a strict limit or that it is merely a suggestion. The trouble is, if 1 K ohm is used, the cut-off frequency falls to 159.15 Hz.
While a low cut-off value is good, the phase lag can be quite extreme. During rapid heating, say when I replace it with a thermistor eventually, actual hot end temperatures may exceed the filtered value and may be quite a bit higher than the value at the ADC. This may cause some troubles for PID controls, I'd guess.
I took a look at the impulse step response using R = 1K and C = 1 uF It seemed this is still feasible as the RC step response is about 10 milliseconds, i.e. if the capacitor is initially discharged it charges to the original Vin voltages in 10 ms. But in this calc, I may have neglected the temperature sensor limits, which is 50 uA max. So the response may be significantly longer.
If I work the internal resistance of LMT86, this way R = 2.2v / 50 uA ~ 44k ohms
putting R = 44k, C = 1.0 uF ^ the step response looks like this. This is significantly worse than if it is just R 1K and C 1uF
I managed to make a bode plot for an RC filter This is for
R = 500 ohms
C = 1.0uF
It gives me a -3 dB cut-off frequency of 318.3 Hz.
The data sheet for LMT86, stated that for 1 uF, the minimum R value needs to be 1 K ohm.
I'm not sure if that is a strict limit or that it is merely a suggestion. The trouble is, if 1 K ohm is used, the cut-off frequency falls to 159.15 Hz.
While a low cut-off value is good, the phase lag can be quite extreme. During rapid heating, say when I replace it with a thermistor eventually, actual hot end temperatures may exceed the filtered value and may be quite a bit higher than the value at the ADC. This may cause some troubles for PID controls, I'd guess.
I took a look at the impulse step response using R = 1K and C = 1 uF It seemed this is still feasible as the RC step response is about 10 milliseconds, i.e. if the capacitor is initially discharged it charges to the original Vin voltages in 10 ms. But in this calc, I may have neglected the temperature sensor limits, which is 50 uA max. So the response may be significantly longer.
If I work the internal resistance of LMT86, this way R = 2.2v / 50 uA ~ 44k ohms
putting R = 44k, C = 1.0 uF ^ the step response looks like this. This is significantly worse than if it is just R 1K and C 1uF
Re: fake lm35dz temperature sensors
I tried patching a 1 nF cap at the ADC input as an RC filter.
bode plot looks like this C = 1nF, R = 44 k ohms (LMT86) -3dB cutoff at 3.6 kHz
step response looks like this looks good.
bode plot looks like this C = 1nF, R = 44 k ohms (LMT86) -3dB cutoff at 3.6 kHz
step response looks like this looks good.
Last edited by ag123 on Fri Sep 24, 2021 1:33 pm, edited 2 times in total.
Re: fake lm35dz temperature sensors
Tests with the 1nF in place at the op amp input to GND, this is with the LMV358 op amp, long antenna style wires for the probe, the probe LMT86, an extra 220 uF from 3.3v to GND (bypass capacitor, to bypass all that radio waves on the power supply lines)
result looks like this
2000 samples LMT86 - LMV358 op amp - stm32f401 ADC pa0 count 2000.000000
mean 31.280675
std 0.384260
min 27.760000
25% 31.180000
median 31.260000
75% 31.400000
max 34.790000
Looks decent, but the outliers are pretty much still there. And it isn't a normal distribution, literally.
It is radio waves, after all, not thermal noise.
I'd guess to get any better precision, I'd need to use shielded cables to the probe to eliminate the RF EMI
I've been wondering for a while why low cost 3d printers which have thermistors with long antenna style wires don't seem affected.
Then i took a look at RAMPS
https://reprap.org/mediawiki/images/f/f ... ematic.png
And so it turns out, RAMPS & all the similar 3d printer circuits place a 10 uF ! capacitor at the thermistors. Now we know why all the 3d printers seemed to be printing away just fine. The implications are quite pronounced, PID control probably need to account for the delay and avoid heating up the hot end and heated bed too quickly.
The outliers are hazards literally for things like PID control etc. 'normal distribution' thermal noise is not an issue unlike straight out RF EMI, the voltages for RF received measures volts, not millivolts.
result looks like this
2000 samples LMT86 - LMV358 op amp - stm32f401 ADC pa0 count 2000.000000
mean 31.280675
std 0.384260
min 27.760000
25% 31.180000
median 31.260000
75% 31.400000
max 34.790000
Looks decent, but the outliers are pretty much still there. And it isn't a normal distribution, literally.
It is radio waves, after all, not thermal noise.
I'd guess to get any better precision, I'd need to use shielded cables to the probe to eliminate the RF EMI
I've been wondering for a while why low cost 3d printers which have thermistors with long antenna style wires don't seem affected.
Then i took a look at RAMPS
https://reprap.org/mediawiki/images/f/f ... ematic.png
And so it turns out, RAMPS & all the similar 3d printer circuits place a 10 uF ! capacitor at the thermistors. Now we know why all the 3d printers seemed to be printing away just fine. The implications are quite pronounced, PID control probably need to account for the delay and avoid heating up the hot end and heated bed too quickly.
The outliers are hazards literally for things like PID control etc. 'normal distribution' thermal noise is not an issue unlike straight out RF EMI, the voltages for RF received measures volts, not millivolts.
-
- Posts: 633
- Joined: Thu Dec 19, 2019 1:23 am
Re: fake lm35dz temperature sensors
'been involved with uC stuff since my retirement 12 years ago; and preaching to the flock about the noise in our modern world. Until someone like you take the time to really validate the issue, it is a hard-to-believe story.
Ray
Everyone needs a Faraday Cage:
Re: fake lm35dz temperature sensors
I tried this.
30-100 deg C in 8 secs ! Sample rate, 10 samples / s.
The surface temperature at the LMT86 is possibly much higher, because normally there is a temperature gradient, and at this extreme heating up, the surface temperature is probably double that. I thought I saw some blue smoke, but it is OK it is still working fine
So it looks like the heating up process is a little difficult to model. But the cooling process seems to follow Newton's law of cooling and is apparently an exponential curve. This probably means It is possible to fit a curve on it and reject values that are 'radio wave noises'.
But otherwise, this curve looks decent, this is done with the 1 nF RC filter in place, long antenna wires to the probe etc.
Edit,
Difficult, can't get a good fit Real data do not fall entirely on an exponential curve. Nature is full of surprises.
It seemed quite possible that at higher temperatures, heat transfers could be driven by other processes as well, e.g. thermal radiation
https://en.wikipedia.org/wiki/Stefan%E2 ... tzmann_law
newton's model seem to consider mainly conductive, convective heat transfers.
It is a complicated world really
this is a bit brutal but that, fortunately, this is a temperature sensor. So I blow off the candle flame once it touches 100 deg C. 30-100 deg C in 8 secs ! Sample rate, 10 samples / s.
The surface temperature at the LMT86 is possibly much higher, because normally there is a temperature gradient, and at this extreme heating up, the surface temperature is probably double that. I thought I saw some blue smoke, but it is OK it is still working fine
So it looks like the heating up process is a little difficult to model. But the cooling process seems to follow Newton's law of cooling and is apparently an exponential curve. This probably means It is possible to fit a curve on it and reject values that are 'radio wave noises'.
But otherwise, this curve looks decent, this is done with the 1 nF RC filter in place, long antenna wires to the probe etc.
Edit,
Difficult, can't get a good fit Real data do not fall entirely on an exponential curve. Nature is full of surprises.
It seemed quite possible that at higher temperatures, heat transfers could be driven by other processes as well, e.g. thermal radiation
https://en.wikipedia.org/wiki/Stefan%E2 ... tzmann_law
newton's model seem to consider mainly conductive, convective heat transfers.
It is a complicated world really
Re: fake lm35dz temperature sensors
looked quite decent.mean 31.280675
std 0.384260
in real world application some type of filtering would needed. for example ignoring the extremes, a hardware or software lpf...
looks like the chip is actually not fake?