How to retrieve live temperature data in a plugin?

I'm a uni student trying to make an electrochemical 3D printer, which includes trying to modify OctoPrint for electrochemical 3D printing. This kind of printer will not be changing or measuring temperature, but rather depositing atoms on a plate by providing a current flow to ions.

The approach that seems the simplest is feeding OctoPrint the current reading and pretending that it's temperature. Therefore I want to be able to plot 'temperature'. I'm trying to make a plotly graph similar to the PlotlyTempGraph plugin. Thanks to that plugin and ChatGPT I have custom plot with data from an old CSV, but I need to know how to be refreshing that graph and inputting 'temperature' data. Unlike PlotlyTempGraph, I only need to be plotting a single variable, and don't need any settings parameters.

I've read through PlotlyTempGraph's viewmodel but still don't understand the basics of how it retrieves and then plots temperature data. So I would love to know how exactly I can get live temperature data, and any best practices for doing so. I also don't quite understand how PlotlyTempGraph is refreshing the graph when temp data is received.

Thank you so much! I've been stuck on this for a while.

ps: I want the electrochemical data to be reported at a higher speed than temp data is traditionally reported, so if this is a problem I would love to know!

You could just use that plugin and create your own single file plugin to provide it the data to plot as an additional temperature data point. How are you getting your current reading? I might be able to help with creating one. There are several examples in the rc branch of the plugin, linked below as a starting point.

Hi jneilliii. Thank you so much for your reply and sorry this is late. I really appreciate all your work on the plugin.

I'm getting my current reading by pretending that it is temperature (e.g just Serial printing " T:" + hotEndTempStr + " /0.0 B:" + bedTempStr + " /0.0 T0:" + hotEndTempStr + " /0.0 @:0 B@:0":wink: where hotEndTempStr is actually just current.

I want your perspective on if it's appropriate to create a single file plugin. I am trying to create three graphs in total. One is temporal current (current against time), one is a cyclic voltammetry graph (current against voltage) and the final one (which is more optional) is a 3D representation of the object (this is important because one 'mode' of the printer is scanning instead of printing). The sheer number and difference in these graphs makes me think it's important to understand how I can feed in current and voltage via the terminal feedback.

well, any additional data that you report on that line with additional identifiers should automatically get picked up by my plugin and graph it. not sure how you'll handle 3d object representation though in a 2d graph.

Apologies for such a late reply. I understand it shouldn't be too hard to make a graph of current against time using your plugin (plus my own single file plugin). Do you think I could make a 'current against voltage' graph using your plugin? Thanks so much.

Time is always a necessity. You could be sneaky and make one of them a "target temp"and that would group the two.