Adding current sensor and readout to DWC
-
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.
-
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...
-
@JBisc said in Adding current sensor and readout to DWC:
results in
Error: M308: Pin 'spi.cs0' does not support mode analog readWhy? 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 includeain
as part of thePinCapability
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#L225edit / 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" },
-
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 includeain
as part of thePinCapability
property. E.g.:{ PortEPin(5), PinCapability::ainr, "io3.in" },
Very usefull information! Thanks
-
@dc42 If I configure it as a linear analog sensor, where does the data get displayed?
-
if you send "M308 SX" again than it returns you the value as message...
-
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.
-
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 ><.
-
@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!
-
@ChrisP I was hoping for similar, but rather I just wanted the numeric value displayed by the board voltages.
-
@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.
-
@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.