Reading a thermocouple ?

More
11 Jun 2019 21:46 #136663 by tommylight
Replied by tommylight on topic Reading a thermocouple ?
That is a 100k thermocouple, so it's resistance is 100Kohm or 100000 Ohm, so the input of the mesa board will drop down the voltage as it also needs a bit for it to function, and the input resistance/impedance is never infinite.
That can easily be addressed with a potentiometer instead of the resistor, so you can adjust it's value to get 6V at the input.
Do you plan on reading negative temperatures with it?
If not, better leave it as is as you will have more headroom for positive values.

Please Log in or Create an account to join the conversation.

More
11 Jun 2019 21:51 #136667 by PCW
Replied by PCW on topic Reading a thermocouple ?
The 7I76 input impedance is 20K ohm. This is why you see the large voltage
drop.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
11 Jun 2019 23:50 #136677 by superman
Replied by superman on topic Reading a thermocouple ?
Thank you @tommylight and @PCW

Meanwhile i have recognized that the input impedance is 20k --> www.mesanet.com/pdf/parallel/7i76man.pdf --> Page 14.
Sorry for that, i should have read it more carefully.

Now, i have wired as following:
+12V --- 100k NTC@25deg --- (20k) MESA-Analog0

Knowing that, i have developed my own formula to calculate Temperature from Input-Voltage, based on Measuring the Temperature with NTCs
The question is: Where can i implement my calculation?
My aim is to measure the temperature of the extruder of my 3d-printer (max 220deg) and to display the temperature via PyVCP.
I am using this thermistor.

I have read that there exists a Py-Interface to LCNC. Maybe it is possible to do this kind of calculations with it. However, there is no easy-to-understand tutorial on how to realize this kind of stuff. Is it possible to post a short example/howTo or maybe show me some links, where i can find more informations about that.
So the aim is to read in the analog input with "ain" in python, do the calculations in python and finally return the result to PyVCP.

Thank you very much in advance.

Please Log in or Create an account to join the conversation.

More
12 Jun 2019 00:00 #136678 by andypugh
Replied by andypugh on topic Reading a thermocouple ?
I would always prefer a thermocouple to a thermistor for that sort of job.

But the answer to converting ADC counts to Degrees is likely to be the "lincurve" HAL component.
That can approximate any function between known limits.

Please Log in or Create an account to join the conversation.

More
12 Jun 2019 08:10 #136701 by superman
Replied by superman on topic Reading a thermocouple ?
@andypugh

Thank you very much, with lincurve i was able to solve the problem.

If someone is interested, following the interesting HAL-lines:
loadrt lincurve count=2 personality=2,2

addf lincurve.0 servo-thread

setp lincurve.0.x-val-00 2.24
setp lincurve.0.y-val-00 24.8
setp lincurve.0.x-val-01 11.8
setp lincurve.0.y-val-01 220

net extruder-sensor-raw lincurve.0.in <= hm2_5i25.0.7i76.0.0.analogin0
net extruder-sensor-interp lincurve.0.out =>    pyvcp.extruder-sensor

Nevertheless, does someone know how to solve it using a py-script? Or is the Py-Interface not intended to do this kind of calculations?

Thanks in advance!

Please Log in or Create an account to join the conversation.

More
12 Jun 2019 08:42 #136704 by andypugh
Replied by andypugh on topic Reading a thermocouple ?

superman wrote: Nevertheless, does someone know how to solve it using a py-script? Or is the Py-Interface not intended to do this kind of calculations?


You could certainly write a Python userspace component to compute the temperature and make it available on a HAL pin.
linuxcnc.org/docs/2.7/html/hal/halmodule.html
But such a component does not run on a fixed realtime schedule. This means that the OS could crash and the temperature would stop updating the temperature. And this could be very bad when the temperature is that of an extruder. (one possible outcome is a house fire)
Much better to keep everything in the more dependable realtime layer.
You could do it in a C realtime component:
linuxcnc.org/docs/2.7/html/hal/comp.html
But Lincurve already exists and was designed for this sort of thing.

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.102 seconds
Powered by Kunena Forum