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

    Setting up a pressure sensor with Duet3

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    4
    7
    524
    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.
    • Garth_42undefined
      Garth_42
      last edited by

      Hello,

      I would like to integrate a pressure transducer with my Duet3. It is a linear sensor that outputs from 0.5V (=0 psi) to 5V (=150psi) depending on the pressure it senses.

      I believe that I would use a M308 S"sensor_number" P"pin_name" Y"linear-analog" Bnnn Cnnn command to set this up.

      B is the value you want displayed at the ADC value = min and C is the value displayed at ADC value = max.

      How would I know what the min and max ADC values are, and how that relates to the voltage output from the sensor? Where would I find out if the analog input pins are 5V tolerant or 3.3 V?

      I was planning on connecting to either a temp pin or some other analog-enabled pin on the board.

      Any help is appreciated.

      Best,
      Garth

      Garth_42undefined 1 Reply Last reply Reply Quote 1
      • Garth_42undefined
        Garth_42 @Garth_42
        last edited by

        @garth_42 Hi, is there something I can do to make my issue more clear? I am not sure what the B and C values should be in order to get a value aligned with the PSI values from the sensor in the GUI. Also, I looked at the hardware overview and it says inputs are 30V tolerant, does this mean the input pin on any GPIO or SPI pin?

        HebigTundefined 1 Reply Last reply Reply Quote 1
        • HebigTundefined
          HebigT @Garth_42
          last edited by HebigT

          @garth_42 According to this IO table, IO 3 thru 7 support analog input.

          https://docs.duet3d.com/Duet3D_hardware/Duet_3_family/Duet_3_Mainboard_6HC_Hardware_Overview#io-headers

          I asked a similar question regarding a Z-probe-type device:
          https://forum.duet3d.com/topic/29917/reading-analog-values-from-laser-range-finder-6hc/2

          My device also outputs 0-5v, so I will try one of those '5v to 3.3v logic level shifters.

          The way I read the documentation for M308, it seems to me you can set B and C to 0 and 150 PSI. Someone else should check me on this, but i think RRF takes the input voltage (0-3.3v after level-shifting from 0-5v) and 'maps' that analog value to the B to C (0-150PSI) range of values. So when you query that sensor, you should get an output between 0-150, provided you're actually using the full range of the sensor.

          Arduino has a funcction called map( ) that does this exactly.

          Garth_42undefined T3P3Tonyundefined 2 Replies Last reply Reply Quote 1
          • Garth_42undefined
            Garth_42 @HebigT
            last edited by

            @hebigt Thanks for the reply! This is great info, and the way that you are thinking it works makes logical sense to me, too, now that I have more information about it. Once I get around to making the connections, I will update if you haven't already posted about your setup working. I am surprised your post didn't come up in the searches I did on the forum.

            1 Reply Last reply Reply Quote 0
            • T3P3Tonyundefined
              T3P3Tony administrators @HebigT
              last edited by

              @hebigt do check that the logic level shifter is actually going to send a scaled input of the 0-5V to 0-3.3V. Many of them will have a threshold and everything below the threshold will be output at logic 0, with everything above the threshold being output as logic 1.

              You may be better off using a simple resistive divider circuit that scales 0V-5V to 0-3.3V. otherwise an amplifier circuit design to translate the analog signals linearly would be a good choice.

              www.duet3d.com

              HebigTundefined 1 Reply Last reply Reply Quote 1
              • HebigTundefined
                HebigT @T3P3Tony
                last edited by

                @t3p3tony Thank you for the tip! This is what I ordered, although I can't say for sure whether it scales the input like you described.

                757-03.jpg

                https://www.adafruit.com/product/757

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

                  @hebigt unfortunately that level shifter is for logic signals only. I suggest you use two resistors, as @T3P3Tony suggested. For example, 2K4 between the sensor output and the Duet input, and 3K3 between the Duet input and ground. These values assume that the sensor is capable of sourcing at least 1mA of current.

                  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 1
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA