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

    Adding current sensor and readout to DWC

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    5
    13
    1.2k
    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.
    • JBiscundefined
      JBisc
      last edited by JBisc

      I had a horrible night by trying to understand how it is possible to read a simple analog voltage value on the duet 3. My task is so simple: Just read an analog Voltage at pin X und return the Value as Json..... But after several hour of testing, I have to ask here:

      Is there any way to read/return the analog values? Why is there not a single example in the documentation?

      I am playing around with something like:

      M308 S8 P"spi.cs1" Y"linear-analog" A"MySensor" F0
      

      results in

      Error: M308: Pin 'spi.cs0' does not support mode analog read
      

      Why? I dont get it...

      Next scenario: Why can I not use one of the IO as analog read?

      M308 S8 P"io1.in" Y"linear-analog" A"MySensor" F0
      

      results in

      Error: M308: Pin 'io2.in' does not support mode analog read
      

      and this is just the config... how i will get the measured value returned is still unclear to me.

      @dc42 Any hint/example/link would be useful for me...

      My Setup: Duet 3 MB6HC Main Board with attached RPI

      A Former User? 1 Reply Last reply Reply Quote 0
      • A Former User?
        A Former User @JBisc
        last edited by A Former User

        @JBisc said in Adding current sensor and readout to DWC:

        results in
        Error: M308: Pin 'spi.cs0' does not support mode analog read

        Why? I dont get it...
        Next scenario: Why can I not use one of the IO as analog read?

        not all pins are created equal unfortunately. if using the duet3 board look up the pin here https://github.com/dc42/RepRapFirmware/blob/v3-dev/src/Duet3_V06/Pins_Duet3_V06.h#L209

        search for spi.cs0 until you find { PortAPin(5), PinCapability::rw, "spi.cs0,serial3.rx" }, any pin that works (edit: as an analog input) will include ainas part of the PinCapability property. E.g.: { PortEPin(5), PinCapability::ainr, "io3.in" },

        For the Duet2Wifi see https://github.com/dc42/RepRapFirmware/blob/v3-dev/src/DuetNG/Pins_DuetNG.h#L230
        For the Duet2Maestro see https://github.com/dc42/RepRapFirmware/blob/v3-dev/src/DuetM/Pins_DuetM.h#L225

        edit / tldr:
        use

        // IO connector inputs
        { PortEPin(5),	PinCapability::ainr,	"io3.in" },
        { PortDPin(30),	PinCapability::ainr,	"io4.in" },
        { PortAPin(19),	PinCapability::ainr,	"io5.in" },
        { PortAPin(18),	PinCapability::ainr,	"io6.in" },
        { PortAPin(17),	PinCapability::ainr,	"io7.in" },
        
        // Thermistor inputs
        { PortCPin(15), PinCapability::ainr,	"temp0" },
        { PortCPin(29),	PinCapability::ainr,	"temp1" },
        { PortCPin(30), PinCapability::ainr,	"temp2" },
        { PortCPin(31), PinCapability::ainr,	"temp3" },
        
        JBiscundefined 1 Reply Last reply Reply Quote 1
        • JBiscundefined
          JBisc @A Former User
          last edited by JBisc

          search for spi.cs0 until you find { PortAPin(5), PinCapability::rw, "spi.cs0,serial3.rx" }, any pin that works (edit: as an analog input) will include ainas part of the PinCapability property. E.g.: { PortEPin(5), PinCapability::ainr, "io3.in" },

          Very usefull information! Thanks

          My Setup: Duet 3 MB6HC Main Board with attached RPI

          1 Reply Last reply Reply Quote 0
          • Psylenceoundefined
            Psylenceo @dc42
            last edited by

            @dc42 If I configure it as a linear analog sensor, where does the data get displayed?

            JBiscundefined 1 Reply Last reply Reply Quote 0
            • JBiscundefined
              JBisc @Psylenceo
              last edited by

              @Psylenceo

              if you send "M308 SX" again than it returns you the value as message...

              My Setup: Duet 3 MB6HC Main Board with attached RPI

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

                There is a table showing the capabilities of the Duet 3 I/O pins at https://duet3d.dozuki.com/Wiki/Duet_3_Expansion_Hardware_Overview#Section_IO.

                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

                ChrisPundefined 1 Reply Last reply Reply Quote 2
                • Psylenceoundefined
                  Psylenceo
                  last edited by

                  Wow......I feel ridiculous. I've used that page so many times as a reference, yet I forgot to look at it to see about additional I/O options ><.

                  1 Reply Last reply Reply Quote 0
                  • ChrisPundefined
                    ChrisP @dc42
                    last edited by

                    @dc42 said in Adding current sensor and readout to DWC:

                    There is a table showing the capabilities of the Duet 3 I/O pins at https://duet3d.dozuki.com/Wiki/Duet_3_Expansion_Hardware_Overview#Section_IO.

                    Think that's the one for the expansion boards, here's the one for the main board: https://duet3d.dozuki.com/Wiki/Duet_3_Mainboard_6HC_Hardware_Overview#Section_IO

                    This is a pretty interesting topic - I was only thinking of trying something similar the other day! Is there any way to get this data plotted on the temperature chart, as an additional y-axis perhaps? That'd be sweet!

                    Psylenceoundefined dc42undefined 2 Replies Last reply Reply Quote 0
                    • Psylenceoundefined
                      Psylenceo @ChrisP
                      last edited by

                      @ChrisP I was hoping for similar, but rather I just wanted the numeric value displayed by the board voltages.

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

                        @ChrisP said in Adding current sensor and readout to DWC:

                        This is a pretty interesting topic - I was only thinking of trying something similar the other day! Is there any way to get this data plotted on the temperature chart, as an additional y-axis perhaps? That'd be sweet!

                        Yes, in RRF3 any sensor that you create using M308 can be displayed in the temperature chart. Press the Extra link just above the tool display in DWC to get to where you can enable them. But I don't think you can change the Y axis units from degC yet.

                        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

                        ChrisPundefined 1 Reply Last reply Reply Quote 0
                        • ChrisPundefined
                          ChrisP @dc42
                          last edited by

                          @dc42 said in Adding current sensor and readout to DWC:

                          @ChrisP said in Adding current sensor and readout to DWC:

                          This is a pretty interesting topic - I was only thinking of trying something similar the other day! Is there any way to get this data plotted on the temperature chart, as an additional y-axis perhaps? That'd be sweet!

                          Yes, in RRF3 any sensor that you create using M308 can be displayed in the temperature chart. Press the Extra link just above the tool display in DWC to get to where you can enable them. But I don't think you can change the Y axis units from degC yet.

                          Ah, great! I don't know why I didn't think of that - until the latest releases, this is what I've been doing anyway to show the extra bed sensors I have!
                          I guess a super low priority feature request is to have some means of adding additional y axes and assigning sensors to axes. As a temporary hack, if a scaling factor could be applied to a sensor value then while the label would still show degC, the data wouldn't be hidden at the bottom of the graph.
                          Neat, nevertheless.

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