the ADC / thermistor calculation for the Duet?
-
Can anyone share the ADC / thermistor calculation for the Duet.
Was thinking that, if it's a 10-bit ADC and 5v, that's 5/1024 = 5mV per ADC count.
But then heard there may be oversampling - not sure how that works - bringing further bits of accuracy?
Then have heard that a given thermistor might have a sensitivity of say 20mV per 10C when 5v is put across it. Depending on where it is in it's temperature curve. Which would imply (20mV per 10C) / (5mV per ADC count) = 2.5C per ADC count.
We apparently get an accuracy better than that, but would love to see the real calculation.
Anybody know?
-
All Duets use a 12-bit ADC and we use 2-bit oversampling. So 14 bits in total, although I would not like to rely on the oversampling, because oversampling only works properly if the noise is random and that is unlikely. The code is in https://github.com/Duet3D/RepRapFirmware/blob/master/src/Heating/Sensors/Thermistor.cpp.
-
@dc42 Amazing, fascinating, thanks!
Had been contemplating the thermistor / PT1000 showdown spreadsheet and was concerned that the 20mV/10C across the range for the PT1000 was a bit feeble. (Comparable to what you get out of the Semitec at the top of it's range 280C.)
https://docs.google.com/spreadsheets/d/1czX6OVMpSYs7m8Iaa06JMURGUfk2GiFJS2I-IoxfDAA/edit#gid=0
However 12-14 bit resolution would appear to be able to detect small temperature excursions (so that the PID can set to work correcting them) at the hotend with that.
-
@r123 we use 2K2 series resistors on Duet 3 (4K7 on Duet 2 WiFi/Ethernet). With a PT1000 hat gives a resolution of around 0.6C or better across the entire range assuming 12-bits or resolution are reliable. If we assume all 14 bits are reliable, it's 0.15C resolution.
100K thermistors have very good resolution in the centre of their range, but worse resolution at the extremes, in particular below 10C. High temperature 500K thermistors have extremely poor resolution at low temperatures, in fact it is sometimes hard to tell whether they are connected at all. They would be better used with a 10K or higher series resistor.
-
@dc42 So, if I understand correctly, for the Duet Wifi, the figures are approx. double i.e. 1.2C for 12bit resolution with the PT1000 and 0.3C for 14bit.
If, as you say, noise has a certain probability of being directional, that means that if I'm printing ABS at a nominal 260C I might, in fact, be at a 12 bit version of 260C, in other words somewhere in the range 258.8-261.2C.
The PID controller would kick in at the limit of that range (when the ADC increments/decrements) and tend to steer the hotend back into it, though presumably there will be some overshoot relating to the physical separation of thermistor, heater and meltzone.
Since the duet will in any case display 4 significant figures (260.3C), derived from the possiblity of 14 bit accuracy, what I observe in DWC will actually be an oscillation in the range 260 +/- 0.3C (if no overshoot occurs and is registered). Or perhaps eg. 260 - 1.2C +/-0.3C ?? Hmmm
-
@r123 on the Duet WiFi/Ethernet the PT1000 resolution better than that. Using the 12-bit ADC resolution, the 4K7 resistors gives 0.44C resolution at room temperature rising to 0.67C at 300C. Whereas the 2K2 series resistor on Duet 3 boards gives 0.30C at room temperature, 0.58C at 300C, and 0.7C at 400C. Oversampling (if it can be relied on) improves these figures by a factor of 4.
-
@dc42 said in the ADC / thermistor calculation for the Duet?:
0.44
That's excellent!
(And silly me, not thinking through properly voltage dividers. )
-
@r123 this is the spreadsheet I use to calculate the resolution. PT1000.ods
-
@dc42 now I feel like I'm observing the origins of the universe. (Well, the electrons are a little blurred.) Thank you.