• Tags
  • Documentation
  • Order
  • Register
  • Login
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.
  • undefined
    Aitor
    last edited by 18 Jul 2024, 09:09

    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,

    undefined 1 Reply Last reply 18 Jul 2024, 09:15 Reply Quote 0
    • undefined Aitor marked this topic as a question 18 Jul 2024, 09:09
    • undefined
      chrishamm administrators @Aitor
      last edited by 18 Jul 2024, 09:15

      @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

      undefined 1 Reply Last reply 18 Jul 2024, 10:11 Reply Quote 0
      • undefined
        Aitor @chrishamm
        last edited by 18 Jul 2024, 10:11

        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,

        undefined undefined 2 Replies Last reply 18 Jul 2024, 10:28 Reply Quote 0
        • undefined
          chrishamm administrators @Aitor
          last edited by 18 Jul 2024, 10:28

          @Aitor What board do you have there?

          Duet software engineer

          undefined 1 Reply Last reply 18 Jul 2024, 10:46 Reply Quote 0
          • undefined
            Aitor @chrishamm
            last edited by 18 Jul 2024, 10:46

            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,

            undefined 1 Reply Last reply 18 Jul 2024, 10:55 Reply Quote 0
            • undefined
              chrishamm administrators @Aitor
              last edited by 18 Jul 2024, 10:55

              @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

              undefined 1 Reply Last reply 18 Jul 2024, 11:38 Reply Quote 0
              • undefined
                Aitor @chrishamm
                last edited by Aitor 18 Jul 2024, 11:38

                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,

                undefined 1 Reply Last reply 18 Jul 2024, 12:44 Reply Quote 0
                • undefined
                  chrishamm administrators @Aitor
                  last edited by 18 Jul 2024, 12:44

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

                  Duet software engineer

                  undefined 1 Reply Last reply 18 Jul 2024, 13:41 Reply Quote 0
                  • undefined
                    Aitor @chrishamm
                    last edited by 18 Jul 2024, 13:41

                    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,

                    undefined 1 Reply Last reply 18 Jul 2024, 15:18 Reply Quote 0
                    • undefined
                      droftarts administrators @Aitor
                      last edited by 18 Jul 2024, 15:18

                      @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
                      • undefined
                        dc42 administrators @Aitor
                        last edited by dc42 18 Jul 2024, 21:30

                        @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

                        undefined 1 Reply Last reply 24 Jul 2024, 10:54 Reply Quote 1
                        • undefined
                          Aitor @dc42
                          last edited by 24 Jul 2024, 10:54

                          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,

                          undefined 1 Reply Last reply 24 Jul 2024, 19:35 Reply Quote 0
                          • undefined
                            dc42 administrators @Aitor
                            last edited by 24 Jul 2024, 19:35

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