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

    Reading Sensor Pressure from Analog output

    Scheduled Pinned Locked Moved
    General Discussion
    5
    27
    988
    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.
    • dc42undefined
      dc42 administrators @developeralgo222
      last edited by dc42

      @developeralgo222 if you don't need isolation between the sensor and the Duet, just use 2 resistors as a voltage divider.

      A better solution would be to use sensors that provide a digital interface that the Duet can use, for example Modbus RTL via RS485. You cold put all 6 sensors on the same RS485 bus provided that the sensors provide a way to set then all to different slave addresses.

      We have a small number of prototype 2-channel ADC daughter boards designed for reading 0 to 10V signals.

      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

      developeralgo222undefined 1 Reply Last reply Reply Quote 0
      • developeralgo222undefined
        developeralgo222 @dc42
        last edited by developeralgo222

        @dc42

        Managed to mount 12 resistors ( that i had in hand creating 6 Voltage Dividers ( 1.8K & 3.3K ) per connection and it seems to work read the values fine now . Now my issue is how to Calibrate it correctly .

        Sensor Analog ( 1 ~ 5V) ===> Duet Analog ( 0 ~ 3V getting a Max of 3.24V) . Ideally probably i need to use 1.7K resistor so at get 3.3V or 1.6K resistor(assuming leakage or noise) to get 3.33V

        @ 0 kPa on the Sensor ===> Duet reads -22 kPa

        @ 40 kPa on Sensor ===> Duet reads -38 kPa

        @ 55 kPa on Sensor ==> Duet reads -53 kPa

        @ 65 kPa on Sensor ==> Duet reads -63 kPa

        and so on

        Not sure how to calibrate it correctly using U & V values for adjusted reading

        dc42undefined infiniteloopundefined 2 Replies Last reply Reply Quote 0
        • dc42undefined
          dc42 administrators @developeralgo222
          last edited by

          @developeralgo222 for a linear analog sensor you should leave U and V as zero. Adjust the B and C parameters to get the correct readings.

          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

          1 Reply Last reply Reply Quote 0
          • infiniteloopundefined
            infiniteloop @developeralgo222
            last edited by

            @developeralgo222

            Managed to mount 12 resistors ( that i had in hand creating 6 Voltage Dividers ( 1.8K & 3.3K ) per connection

            The nominal values of the two resistors are fine. Depending on the resistor’s specs, the effective values may come with enormous tolerances of up to 20%, so in order to get identical readings on all six channels, you should use resistors with a tolerance of 1% (”E96”) or better (”E192”). Alternatively, you can hand-pick resistors with the help of a multimeter.

            Now my issue is how to Calibrate it correctly .

            Which M308 command do you apply? Is it still this one from your OP:

            M308 S1  P"2.io0.in" Y"linear-analog"  A"VG1"  F0  B0.0  C-101  V0.00 U13.5
            

            If I understand the ”Analogue Section” from the data sheet you provided in the OP correctly, the output voltage at 0.0 kPa is somewhere between 0.6 and 1V (but not 0V). The resulting range should span about 0.5 to 3.2 V. Assuming that you want the Duet to report negative values, the Bnnn parameter (”The temperature or other value when the ADC output is zero”) should be positive (with U at 13.5, try 22), not 0.0. Similarly, Cnnn (”The temperature or other value when the ADC output is full scale”) should be a bit larger, as the output will rarely reach 3.3V.

            Think of Bnnn / Cnnn as defining an absolute scale (for 0.0 - 3.3 V), the effective readings being a subset (0.5 - 3.2 V) of that range.

            developeralgo222undefined 1 Reply Last reply Reply Quote 1
            • developeralgo222undefined
              developeralgo222 @infiniteloop
              last edited by developeralgo222

              @infiniteloop @dc42

              currently i only have

              M308 S1 P"2.io0.in" Y"linear-analog" A"VG1" F0 B0.0 C-101  V0.0 U0.0
              

              i am not using U & V as @dc42 mentioned above.

              If i understand what you explained above would this work for the subset range

              i will test it but would this work as my start of testing

              M308 S1 P"2.io0.in" Y"linear-analog" A"VG1" F0 B22  C-123  V0.0 U0.0
              

              OR

              M308 S1 P"2.io0.in" Y"linear-analog" A"VG1" F0 B22  C-101  V0.0 U0.0
              

              and also do i need to include U & V values in the M308 command if both the values are at 0.0 ? or i can leave them out and just use B & C values like this and no worry about including U & V on the command

              M308 S1 P"2.io0.in" Y"linear-analog" A"VG1" F0 B22  C-123 
              
              infiniteloopundefined 1 Reply Last reply Reply Quote 0
              • infiniteloopundefined
                infiniteloop @developeralgo222
                last edited by infiniteloop

                @developeralgo222

                i am not using U & V as @dc42 mentioned above.

                That’s good, @dc42’s post was short but precise.

                i will test it but would this work as my start of testing
                M308 S1 P"2.io0.in" Y"linear-analog" A"VG1" F0 B22 C-123 V0.0 U0.0

                Yes, that’s a good starting point. Don’t stick with the idea to define the minimum and/or maximum of absolute values in Bnnn / Cnnn. Instead, adjust these until the result reads 0 for 0 kPa and -101 for 101 kPa. So, if at 0 kPa, you get a value >0, lower B - or, if you read <0, enlarge B. Then, adjust C in the same way. However, you will notice that if you change C, the reading for 0 kPa will also change a bit. So, it's an iterative process with a lot of try and error.

                developeralgo222undefined 1 Reply Last reply Reply Quote 0
                • developeralgo222undefined
                  developeralgo222 @infiniteloop
                  last edited by

                  @infiniteloop Thanks guys for the help i will test it this weekend

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