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

    Generic voltage sensor

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    4
    10
    229
    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.
    • drivetrainsystemsundefined
      drivetrainsystems
      last edited by drivetrainsystems

      I hope this isn't a question with an obvious answer, because I can't seem to find one.

      I have an optical sensor that varies it's output between 0-10 volts.
      What is the best way to configure a Mini5+ to read that sensor?
      What is the best way to then get that reading?

      @dc42 this sounds like something you may know off the top of your head 🙂

      drivetrainsystemsundefined 1 Reply Last reply Reply Quote 0
      • drivetrainsystemsundefined
        drivetrainsystems @drivetrainsystems
        last edited by

        I have found

        M308 S0 P"io6in" Y"linear-analog" A"DNAreader" F0

        maybe effectively sets up the sensor, and

        M308 S0

        reads the sensors value.
        I'm wondering though, how can I configure the sensor to be sensitive to the voltage range of the optical reader: 0-10v?

        dc42undefined o_lampeundefined infiniteloopundefined drivetrainsystemsundefined 4 Replies Last reply Reply Quote 0
        • dc42undefined
          dc42 administrators @drivetrainsystems
          last edited by

          @drivetrainsystems use a voltage divider (2 resistors) to reduce the voltage to the range 0 to 3.3V.

          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
          • o_lampeundefined
            o_lampe @drivetrainsystems
            last edited by

            @drivetrainsystems
            Also use B and C values :

            Additional parameters for linear analog sensors
            
                Fn F0 = unfiltered (fast response), F1 = filtered (slower response, but noise reduced and ADC oversampling used to increase resolution). F1 is only available when using a port intended for thermistors, not when using a general input port.
                Bnnn The temperature or other value when the ADC output is zero
                Cnnn The temperature or other value when the ADC output is full scale
            
            1 Reply Last reply Reply Quote 0
            • infiniteloopundefined
              infiniteloop @drivetrainsystems
              last edited by

              @drivetrainsystems See this thread - reading-sensor-pressure-from-analog-output for details. You can skip the posts involving the "Bi-directional Level Shifter" which returns a digital signal.

              1 Reply Last reply Reply Quote 0
              • drivetrainsystemsundefined
                drivetrainsystems @drivetrainsystems
                last edited by drivetrainsystems

                @dc42 do understand correctly that the value reported by M308 S0 in my above example (applying your voltage divider) will be a reflection of the voltage detected between the outer pins of io6in?

                For instance, if I configure the reply value range for 0-100, and my sensor generates 5v (dropped to ~1.65v), will M308 S0 report a value of 50? (hope my details are sensible, I'm not quite yet grasping all the particulars of the process)

                dc42undefined drivetrainsystemsundefined 2 Replies Last reply Reply Quote 0
                • dc42undefined
                  dc42 administrators @drivetrainsystems
                  last edited by

                  @drivetrainsystems that's correct, except that there is a 27Kohm pullup resistor to +3.3V on each IO_IN input which will affect the reading a little. It's not hard to calculate how much.

                  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
                  • drivetrainsystemsundefined
                    drivetrainsystems @drivetrainsystems
                    last edited by

                    @dc42 unfortunately my electronics skills are limited. I can put the calc in front of my electronics guy, unless you know what to do off the top of your head? iIf so, I can put your formula into the software ASAP,

                    dc42undefined drivetrainsystemsundefined 2 Replies Last reply Reply Quote 0
                    • dc42undefined
                      dc42 administrators @drivetrainsystems
                      last edited by

                      @drivetrainsystems I've put a spreadsheet that you can copy to calculate it at https://docs.google.com/spreadsheets/d/1RHeHdqUFcPJ-TeWF9t5B-z-C7YzHEIGwSDQcROe8kqE/edit?usp=sharing.

                      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
                      • drivetrainsystemsundefined
                        drivetrainsystems @drivetrainsystems
                        last edited by

                        @dc42 thanks!

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