Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    the ADC / thermistor calculation for the Duet?

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    2
    9
    684
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • r123undefined
      r123
      last edited by

      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?

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @r123
        last edited by dc42

        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.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        r123undefined 1 Reply Last reply Reply Quote 1
        • r123undefined
          r123 @dc42
          last edited by r123

          @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.

          dc42undefined 1 Reply Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators @r123
            last edited by

            @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.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            r123undefined 1 Reply Last reply Reply Quote 0
            • r123undefined
              r123 @dc42
              last edited by r123

              @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

              dc42undefined 1 Reply Last reply Reply Quote 0
              • dc42undefined
                dc42 administrators @r123
                last edited by dc42

                @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.

                Duet WiFi hardware designer and firmware engineer
                Please do not ask me for Duet support via PM or email, use the forum
                http://www.escher3d.com, https://miscsolutions.wordpress.com

                r123undefined 1 Reply Last reply Reply Quote 0
                • r123undefined
                  r123 @dc42
                  last edited by

                  @dc42 said in the ADC / thermistor calculation for the Duet?:

                  0.44

                  That's excellent!

                  (And silly me, not thinking through properly voltage dividers. )

                  dc42undefined 1 Reply Last reply Reply Quote 0
                  • dc42undefined
                    dc42 administrators @r123
                    last edited by

                    @r123 this is the spreadsheet I use to calculate the resolution. PT1000.ods

                    Duet WiFi hardware designer and firmware engineer
                    Please do not ask me for Duet support via PM or email, use the forum
                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                    r123undefined 1 Reply Last reply Reply Quote 0
                    • r123undefined
                      r123 @dc42
                      last edited by

                      @dc42 now I feel like I'm observing the origins of the universe. (Well, the electrons are a little blurred.) Thank you.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Unless otherwise noted, all forum content is licensed under CC-BY-SA