I2C Analog Voltage Control
-
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,
-
-
@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. -
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,
-
@Aitor What board do you have there?
-
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,
-
@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. -
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).
If you can make the inquiry, I would be very grateful.
Regards,
-
@Aitor I'm sorry, but it looks like I2C support via M260 isn't yet implemented in the Duet 3 builds.
-
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,
-
-
@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.
-
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,
-
@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.