Reading a thermocouple ?

More
7 years 4 months ago #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:
Code:
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
7 years 4 months ago #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.

More
6 years 8 months ago - 6 years 8 months ago #157576 by Hortensie
Replied by Hortensie on topic Reading a thermocouple ?
Hi, I tried to use max31855 component and defined following items in the hal
Code:
loadrt max31855 personality=1 addf max31855.0.bitbang-spi servo-thread setp hm2_5i25.0.7i76.0.0.output-06 true setp hm2_5i25.0.7i76.0.0.output-07 true net spi.clk.in hm2_5i25.0.7i76.0.0.output-06 max31855.0.clk.out net spi.cs.in hm2_5i25.0.7i76.0.0.output-07 max31855.0.cs.out net spi.data0.in hm2_5i25.0.7i76.0.0.input-01-not max31855.0.data.0.in net temp_celcius max31855.0.temp-celsius.0

Before max31855 / sensor connection I got following warning (seems ok?)


[img



However when I connect my hw/sensor to those pins I got overrun current warning at linux cnc


[img



spi.clk.in & spi.cs.in signal are changing continuously values from 0 to 1


[img



Any idea about root cause?
I got this Hardware piece - max31855

Connection as below, Mesa Field input is 12V

[img

Last edit: 6 years 8 months ago by Hortensie.

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

More
6 years 8 months ago #157620 by PCW
Replied by PCW on topic Reading a thermocouple ?
You are driving a 3.3V part with 12V signals. You have likely damaged your MAX31855.

If you want to interface to a 3.3V chip, I would suggest using the (unused)?) second I/O
port on the 5I25 (P2)

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

More
6 years 8 months ago #157652 by Hortensie
Replied by Hortensie on topic Reading a thermocouple ?
Oh well... Currently P2 is unused however I have 7i74 for long term projects to get more I/O or connet some Rs422 devices. Temporary i could use it . If i got IT right i need to set W3 up to disable 5v tolerance Mode on 5i25?? Anyway any other options like 3.3v to 12v Opto coupler or other mesa cards?

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

More
6 years 8 months ago #158636 by andypugh
Replied by andypugh on topic Reading a thermocouple ?

Hortensie wrote: Oh well... Currently P2 is unused


Do you have a parallel port? There is no reason you can't use that alongside a Mesa card for some extra 5V IO.

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

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