best way to do temperature pid with linuxcnc

More
09 Apr 2016 21:43 #73014 by sleepybishop
tested the sensor by bitbanging via gpio pins, it seems to work.

will dig into where and how the bspi approach is failing, but at least my original problem is solved.

thanks

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

More
10 Apr 2016 21:27 #73079 by andypugh

does it look reasonable?
github.com/sleepybishop/linuxcnc-mirror/...s/max31855_bspi.comp


I don't think you need any correction curves, that chip ought to output the actual temperature, it does the cold-junction compensation internally.


ive compiled and installed it, i tested hardcoding the 32 bit value from the sensor to a known 32 bit value and the expected temperature shows up on the new pin.

however i cant get it to work with actual sensor data, its always 0, even with the thermocouple disconnected which should trigger a fault and NAN as the pin value, which leads me to believe theres something really wrong somewhere.


If the pin updates then that would seen to indicate that the function is being called, but it appears that the bspi values are not being read by the hm2_bspi code.
I think the only way to debug this would be to add debug pins / prints to the bspi.c code to watch what is happening.

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

More
10 Apr 2016 23:58 #73083 by sleepybishop
thanks andy, ill do some debugging and try to get to the bottom of it, im sure i did something stupid somewhere. for now im happily plugging away with the bitbanged interface.

wrt to correction curves, the datasheet for the max31855 says
"Because all thermocouples exhibit some level of nonlinearity, apply appropriate correction to the device’s output data."

they outline the logic in their evaluation kit
forums.adafruit.com/download/file.php?id=25577

i think the max31856 has linearization built in.

thanks for for the help and guidance

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

More
11 Apr 2016 09:53 #73091 by andypugh

wrt to correction curves, the datasheet for the max31855 says
"Because all thermocouples exhibit some level of nonlinearity, apply appropriate correction to the device’s output data."


So it does.
docs-europe.electrocomponents.com/webdoc...0900766b813d54ca.pdf
I had missed that.

The question then becomes "how much is the error, and do I care?". For a filament extruder or similar you probably don't care about the _absolute_ temperature, and can optimise your machine around a slightly different temperature scale.

this graph shows the error in the output of the 31855 output against temperature.



I think this is a case where I would accept the error for my own use, but feel obliged to correct it in something I was planning to release to the wider world.
Attachments:

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

More
14 Apr 2016 18:42 #73320 by sleepybishop
i added support for multiple sensors and added pins to indicate fault condition

github.com/sleepybishop/linuxcnc-mirror/...rivers/max31855.comp

thanks for your help with this

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

More
14 Apr 2016 21:33 #73325 by andypugh
Would you be interested in submitting the component to LinuxCNC?

One odd thing is that there are a number of output pins called things like "temp_celsius.#.in". The "in" seems superfluous, a more normal name would probably be just "temp-celcius". I guess that adding temp-fahrenheit and temp-kelvin might be worthwhile too, it's hardly any computational burden.

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

More
15 Apr 2016 18:27 #73355 by sleepybishop
I forgot to add the personality specifier to the number of temperature pins, I also implemented Fahrenheit and kelvin pins

If you think it looks OK, I'll move it to a distinct branch and submit a pr.

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

More
15 Apr 2016 20:44 #73365 by andypugh
I think it looks OK, though the PR might generate more suggestions.

Maybe the docs section should point out that "personality" is the number of channels on that specific instance of the component?

Have you tested with more than one instance of more than one channel each?

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

More
15 Apr 2016 21:35 #73369 by sleepybishop
i tested multiple instances with one sensor each, (i only have two right now), but i was thinking of removing support for multiple instances entirely.

i updated the docs with relevant details about personality.

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

More
15 Apr 2016 22:19 #73375 by andypugh
I can see arguments either way. The CS and data clocking has to do all devices serially. If you had hundreds of them you might want to run several instances of several channels simultaneously to get the data at the required rate at the expense of more IO lines in total.

I can't see any compelling reason for option singleton = yes; That is for _obligate_ singletons where multiple instances would break things.

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

Time to create page: 0.103 seconds
Powered by Kunena Forum