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

    I2C Analog Voltage Control

    Scheduled Pinned Locked Moved Unsolved
    General Discussion
    4
    13
    377
    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.
    • Aitorundefined
      Aitor
      last edited by

      Good morning Duet team,

      I am looking to control an analog output from 0V to 5V for the voltage control of a high voltage source (10kV). I also need to read an output from the source, from 0V to 5V, which reports the voltage it is currently at.

      To achieve this, I was considering using DAC 4 CLICK, which gives me the voltage resolution I need.

      My first problem is that I am not clear if I can use I2C, as I have no experience with it. On one hand, I see that there is the M260 command that would allow me to perform this communication. I also see that on the Duet6HC, I have io2 with a specific jumper for this, but I can't get it to work, and I get this error: "Error: M261: I2C not available," which raises doubts about whether I am configuring it correctly or what I might be doing wrong.

      I haven't found much information on this either. I've even read that it wasn't implemented, but in the latest versions on GitHub, I see I2C mentioned several times.

      If it is not implemented, can you help me find an alternative?

      Best regards,

      chrishammundefined 1 Reply Last reply Reply Quote 0
      • Aitorundefined Aitor marked this topic as a question
      • chrishammundefined
        chrishamm administrators @Aitor
        last edited by

        @Aitor I suppose it would be probably easier to use a PWM to analog converter like that one: https://www.amazon.com/-/en/dp/B081RLHZQS But perhaps don't take the cheapest one because cheap converters tend to have a little offset and may not be 100% precise.

        I2C communication via M260 should be supported in the firmware but to be fair I've never used that. I know at least one other person uses it, though.

        Duet software engineer

        Aitorundefined 1 Reply Last reply Reply Quote 0
        • Aitorundefined
          Aitor @chrishamm
          last edited by

          Good morning @chrishamm,

          I have already considered this option, but the problem is the resolution; it would only be 0-255 and that is not enough in this case. If it is implemented, could you indicate where I can find more information or how I should configure it to enable it?

          Right now, I have it connected to io2, but I don't see how to indicate that this output is for I2C. I have found some things on the internet, but none of them work for me. These are some of the ones I have found:

          M950 I2C2 C"io2.out+io2.in" S100000
          M950 P0 C"io0.out" Q1000
          

          Honestly, before trying it, I knew it wasn't going to work because I don't see it in the documentation, but I had nothing to lose.

          Best regards,

          chrishammundefined dc42undefined 2 Replies Last reply Reply Quote 0
          • chrishammundefined
            chrishamm administrators @Aitor
            last edited by

            @Aitor What board do you have there?

            Duet software engineer

            Aitorundefined 1 Reply Last reply Reply Quote 0
            • Aitorundefined
              Aitor @chrishamm
              last edited by

              Good morning @chrishamm,

              Right now, I have a Duet6HC 1.02a installed.

              Why do you ask? I have practically any Duet3D product at my disposal, although I would need to check if other models meet the rest of the requirements.

              Best regards,

              chrishammundefined 1 Reply Last reply Reply Quote 0
              • chrishammundefined
                chrishamm administrators @Aitor
                last edited by

                @Aitor I was asking because I wanted to identify the pins you'd have to use then. On the 6HC 1.02 there is a jumper next to the SBC header to bypass the 10k resistor so that I2C could be used. io2.out is the data line, io2.in is clock.

                I don't think you can use M950 to configure I2C, M260 should suffice AFAIK.

                Duet software engineer

                Aitorundefined 1 Reply Last reply Reply Quote 0
                • Aitorundefined
                  Aitor @chrishamm
                  last edited by Aitor

                  Good morning @chrishamm,

                  Yes, right now I have it bridged with a jumper, and I haven't mentioned it, but I am on firmware version 3.5.2. However, no matter what I do, I always receive M260: I2C not available.

                  I am attaching some images, but I would say it is well connected (in my case 3.3 is not necessary).

                  WhatsApp Image 2024-07-18 at 1.31.40 PM.jpeg
                  WhatsApp Image 2024-07-18 at 1.31.41 PM.jpeg

                  If you can make the inquiry, I would be very grateful.

                  Regards,

                  chrishammundefined 1 Reply Last reply Reply Quote 0
                  • chrishammundefined
                    chrishamm administrators @Aitor
                    last edited by

                    @Aitor I'm sorry, but it looks like I2C support via M260 isn't yet implemented in the Duet 3 builds.

                    Duet software engineer

                    Aitorundefined 1 Reply Last reply Reply Quote 0
                    • Aitorundefined
                      Aitor @chrishamm
                      last edited by

                      Good morning @chrishamm,

                      Is it available in any other electronic devices, or is it just not available in the Duet3 family?

                      Would it be possible to implement it quickly in one of the builds?

                      Using SBC could be an alternative. I should also mention that I haven't used the printers in this mode and I don't know what it entails.

                      Best regards,

                      droftartsundefined 1 Reply Last reply Reply Quote 0
                      • droftartsundefined
                        droftarts administrators @Aitor
                        last edited by

                        @Aitor It's available on Duet 2 boards, which has a dedicated pin. I think the reason it's not on Duet 3 is because it's shared with io2. I'm not sure if you enable it, it blocks using io2 for anything else. I've asked @dc42 what our future plans are for Duet 3.

                        Ian

                        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

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

                          @Aitor said in I2C Analog Voltage Control:

                          I have already considered this option, but the problem is the resolution; it would only be 0-255 and that is not enough in this case.

                          The PWM resolution on Duets depends on the port used and the PWM frequency, but is generally much greater than that.

                          We have Modbus RTU support coming in RRF 3.6 so a device similar to that one that supports Modbus RTU input will soon be a other option.

                          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

                          Aitorundefined 1 Reply Last reply Reply Quote 1
                          • Aitorundefined
                            Aitor @dc42
                            last edited by

                            Good morning,

                            Sorry for the delay, I've been busy with other matters.

                            @dc42 When you say that the PWM resolution is higher, what do you mean? How could I assign positions greater than 0-255? If this is the case, I could use a 24V PWM to 5V analog converter, but I would need to be able to assign a larger range of positions.

                            @droftarts I still haven't been able to test with Duet2, but I will do so as soon as possible. However, right now I am looking for other alternatives to be able to maintain Duet3.

                            Best regards,

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

                              @Aitor in RRF the PWM can be defined by a floating point value in the range 0.0 to 1.0. See for example https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m42-switch-io-pin.

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