• Tags
  • Documentation
  • Order
  • Register
  • Login
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.1k
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.
  • undefined
    Psylenceo
    last edited by 19 Apr 2020, 00:58

    I'd like to add a current sensor to monitor how much of my power supply I'm using. What are my options to get the reading into the CPU and then displayed on the DWC?

    1 Reply Last reply Reply Quote 0
    • undefined
      dc42 administrators
      last edited by dc42 19 Apr 2020, 08:06

      You could use a ACS722 series current sensor (e.g. ACS722LLCTR-20AU is the 20A unidirectional version) powered from 3.3V and feeding an analog inputs to do the current sensing, and configure it as a "Linear analog sensor" in RRF.

      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

      undefined 1 Reply Last reply 19 Apr 2020, 13:18 Reply Quote 0
      • undefined
        JBisc
        last edited by JBisc 19 Apr 2020, 09:12

        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

        ? 1 Reply Last reply 19 Apr 2020, 09:20 Reply Quote 0
        • ?
          A Former User @JBisc
          last edited by A Former User 19 Apr 2020, 09:20

          @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" },
          
          undefined 1 Reply Last reply 19 Apr 2020, 09:29 Reply Quote 1
          • undefined
            JBisc @A Former User
            last edited by JBisc 19 Apr 2020, 09:29

            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
            • undefined
              Psylenceo @dc42
              last edited by 19 Apr 2020, 13:18

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

              undefined 1 Reply Last reply 19 Apr 2020, 14:44 Reply Quote 0
              • undefined
                JBisc @Psylenceo
                last edited by 19 Apr 2020, 14:44

                @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
                • undefined
                  dc42 administrators
                  last edited by 19 Apr 2020, 16:50

                  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

                  undefined 1 Reply Last reply 19 Apr 2020, 16:57 Reply Quote 2
                  • undefined
                    Psylenceo
                    last edited by 19 Apr 2020, 16:56

                    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
                    • undefined
                      ChrisP @dc42
                      last edited by 19 Apr 2020, 16:57

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

                      undefined undefined 2 Replies Last reply 19 Apr 2020, 16:58 Reply Quote 0
                      • undefined
                        Psylenceo @ChrisP
                        last edited by 19 Apr 2020, 16:58

                        @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
                        • undefined
                          dc42 administrators @ChrisP
                          last edited by dc42 20 Apr 2020, 10:04

                          @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

                          undefined 1 Reply Last reply 20 Apr 2020, 11:23 Reply Quote 0
                          • undefined
                            ChrisP @dc42
                            last edited by 20 Apr 2020, 11:23

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