G codes for 3D printing

Moderators: TomKerekes, dynomotion

User avatar
TomKerekes
Posts: 2527
Joined: Mon Dec 04, 2017 1:49 am

Re: G codes for 3D printing

Post by TomKerekes » Sat Dec 15, 2018 8:13 pm

Hi Karl,

The function:

Code: Select all

// function to convert Temp C to ADC counts
float TempToADC(float T)
{
    return  ((-0.000837 * T + 0.170202) * T + 4.565045) * T + 78.452228;  // 3rd order polynomial
}
receives a temperature and returns what should be the equivalent ADC reading for the temperature.

It is up to you to put in the correct formula for your system. The default formula might act weird above certain Temperatures it was intended for and as Temperature is increased return lower ADC readings.

You might temporarily replace the formula with a simple linear formula like:

Code: Select all

// function to convert Temp C to ADC counts
float TempToADC(float T)
{
    return  T;
In this way you can command ADC counts directly.

Then use that to find what temperature corresponds to what ADC reading over your range of interest, create a table, fit a curve, then enter that formula.

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply