There are some reports that the ADC of the RP2040 is not the best if you search online. Also, the highly critical ADC voltage supply seems lacking.
One more suggestion - try replacing the āThermistorā at the rPi Pico board with a resistor of a known value.
I just tried a random 47k resistor and got a reading of around 43C with a nice, stable temperature line.
If you get this, then you know the ADC on the rPi Pico is okay and then you can put the wire to your toolhead back in and then try the resistor there. If you get the jaggy reading then you know itās your wiring else itās your thermistor.
I ordered a new thermistor, they should be in tomorrow, and Iāl give it a go
Looks like typical noise being aliased by the sample frequency of your ADC. Put a small capacitor between the input pin and ground. The thermistor wires running in parallel with a PWM heater wires is going to be noisy.
You may define what you understand as small
Small is relative and depends on the sample rate of the ADC. The goal is to create a guard filter with a frequency lower than half the sample rate.
Google āfilter capacitor calculatorā or see https://www.ti.com/lit/an/sbaa338a/sbaa338a.pdf
If I understand cardoc right, he is probably talking about this https://www.digikey.de/en/articles/the-basics-of-anti-aliasing-low-pass-filters?srsltid=AfmBOorHR9uHtRAWW3v6rAVc4y2lF6mMTl56yMoS3m1oiHeSY3Jl4XSx
using a simple anti aliasing filter made of a capacitor.
The keyword is Nyquist frequency.
Above has nothing to do with the problem.
For your RP2040 of course, sample rate 500 kS/s @ 48 MHz.
I strongly doubt a RP2040 is sampling at 500,000 samples per second.
For a temperature sensor Iād choose a cap for the 2 to 5 Hz range.
On common boards you will typically see around 0.1 μF.
or https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf 4.9.2. SAR ADC
Hey guys,
Thereās a lot of speculation going on here based on essentially no data.
How about waiting to see what @EleriLove comes back after testing with a new thermistor and, maybe, the other experiments I suggested?
AFAIK, Klipper takes 8 samples at a 1 ms rate in the MCU and sends them summed to the host in 300 ms intervals for further processing. So the effective sample rate is quite small and completely unrelated to the theoretical max rate of the MCUās ADC input.
So anything from 10 nF to 100 nF should work pretty well.
Well, a cap in such circuit does make sense for various reasons and generally never hurts.
The problem is, thereās already a capacitor in the circuit.
Before suggesting the thermistor circuit above, I looked at the Raspberry Pi Pico schematic and noted that there was already a capacitor in the ADC_VREF circuit (which is why I chose it over the base 3.3V):
So, again, letās wait until we have some solid data from @EleriLove before making suggestions on what should be done.
You are correct that wait and see is the best plan in this case.
However Iāll point out that using a GPIO as a ADC on any microcontroller SHOULD have a filter at the input. Put the sensor near a high current PWM circuit it becomes even more important.
Sigh. You canāt make a blanket statement like that without understanding the circuitry involved or have a clear understanding of what you are trying to accomplish.
Again, we donāt have enough information for anybody to be making any suggestions or recommendations.
I feel badly for @EleriLove as now, when he comes back, he with receive a flood of responses without a clear idea of whatās happening or what is the appropriate corrective action.
āLooks like typical noise being aliased by the sample frequency of your ADC. Put a small capacitor between the input pin and ground. The thermistor wires running in parallel with a PWM heater wires is going to be noisy.ā
okay it seems like thereās a lot of people in here now ha ha,
lets start with this one here.
a capacitor used in this way will cause a higher voltage. making a sensor less accurate, avoiding this would be VERY VERY nice in this situation.
furthermore the cables in this run are⦠about a foot in a half long already? this is very likely already measuring up to 0.1 uF of capacitance already. I donāt have tools here to measure this at the moment. but Iāve seen enough experimentation of similar ācableā capacitors before, even at low voltages such as these. the air gap is too low to not induct a capacitance, and more than long enough to make a capacitance of this distance.
not to mention the capacitor already on the adcVref line to begin with as demonstrated deftly by this quote.
though it doesnāt look like the capacitor is well defined in the image above we can⦠probably assume itās about 4 uF (sorry I donāt know the alt code for miro or pico) ⦠and now I learn that my keyboard for some reason doesnāt work with alt codes⦠yeyā¦. worthless keyboard.
I will be getting my new thermistor, a creality 100k thermistor which I wonāt have to manually calibrate myself later. unfortunately I will have to peel off the custom silicon jacket⦠again⦠sighā¦
thank the stars that the RTV silicon gasket maker is so cheap.
oh I forgot to mention that I plan on measuring the capacitance that I actually need by making a 555 timer signal in about the right specifications and do a capacitor testing suite to it with my o-scope, I donāt know much about filter caps. but I think I know how to make a test circuit to learn enough, or at least test enough. to know enough!
No. The capacitor doesnāt influence the measurement.
yes it does, capacitors which charged will have an impact on voltage rails. at these ratings it is incredibly small more than likely, but it does elevate a voltage. thatās how it filters frequencies, it brings downs up, and ups down.
and you choose a value that balances the ups and downs. the high speed ups and downs are what make your graphed signal fuzzy
The filter WILL cause a small shift in the time domain but if it is the proper size the effect is trivial