element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Test & Tools
  • Technologies
  • More
Test & Tools
Documents Programmable Electronic Load - Temperature Protection
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Test & Tools to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 23 Dec 2017 8:46 AM Date Created
  • Last Updated Last Updated: 27 Dec 2017 12:30 PM
  • Views 1978 views
  • Likes 5 likes
  • Comments 13 comments
Related
Recommended

Programmable Electronic Load - Temperature Protection

This blog documents focuses on the temperature protection of the electronic load that Robert Peter Oakes, jc2048 and Jan Cumps are designing.

image

 

This post will be firmware heavy. It explains how the temperature of the power FET is measured and what happens when it exceeds the operational range..

 

The first exercise is to find the right Temperature vs Resistance table for the NTC I'm using.

In this article I use a Vishay NTCLE100E3103J. That's a different component than the one in the final design.

There are two reasons:

  • I have this one available for testing and it's through-hole. That makes prototyping easier
  • Our final design doesn't prescribe the NTC to be used. The characteristics can be programmed and saved in FLASH (if all works out).
    It's good to have two different components to validate that this flexibility works.

 

Temperature Sensor and How To Get Resistance vs Temperature

 

The component we're using for testing is a Vishay NTCLE100E3103NTCLE100E3103. If you want to follow along, click on the product link to get the datasheet.

It's a 10K thermistor with a negative temperature coefficient, 5% tolerance, Beta 3977 K.

The datasheet specifies the calculations that can be used to calculate resistance for a certain temperature. I can use them in the firmware - they apply for many NTCs of the same make.

In that case, the configuration would require a few parameters and temperature can be derived from that.

 

In this design I'm implementing something simpler, based on lookup values. Most datasheets contain a table that lays out resistance vs temperature.

Here is the one for the device I'm using in this blog (again: different than the final design (from the datasheet linked above, page 10).

image

We're not building a thermometer. We're not interested in how warm the FET exactly is (ok, maybe you are. In that case you can use a SCPI command to get the voltage at the NTC and derive the exact temperature image ).

What we want to know is if we're operating in the FET's comfort zone, if it's still safe to touch, if we're running hot, near critical and over-temperature.

Check here for the calculations used: https://en.wikipedia.org/wiki/Voltage_divider

Somewhat random, I've defined these as following:

 

StatusTemperature (C)
normal< 45°
warm< 75°
hot>= 75°
warning>= 100°
over temperature>= 125°

 

The firmware will not know the exact temperature. It only defines these 5 buckets. It's up to the user to define the resistance at the tipping points.

Also, because these levels are chosen based on no science or regulations - and because I want to keep the temperature of the FET and thermistor I'm using under 125°, these may not apply to you.

Feel free to propose different temperatures or a different approach.

 

Firmware

 

The NTC thermistor TH1 is connected to ADC C. Once the voltage measured on the NTC drops below a certain point (because the max temperature is reached), the over-temperature protection should kick in.

That tipping voltage is stored in our calibration data. Check Programmable Electronic Load - Calibration Steps for the instructions to set that point.

 

typedef struct CalibrationData {
    uint32_t version;
    float temperature_threshold;  // todo convert to the ADC 16 bit value in stead of float
} CalibrationData;

 

As a convenience for the person that performs the configuration, the firmware calculates that voltage based on the resistance of the NTC at the over-temperature point.

So you don't have to enter a voltage during calibration. Instead, you look up the resistance of the NTC at switch-off point in the NTC's data sheet (say 125°C) and enter that value, in Ohm.

The firmware will use the voltage divider formulas to derive the voltage at that tipping point (and also back to resistance in the case the user queries the set point).

 

The calibration API has two functions to get and set that resistance at tipping point, and some helpers.

 

/**
 * this function expects the resistance of the NTC thermistor at the point where the electronic load is overheated.
 * It then calculates, based on the fact that the voltage is 5V and that the NTC is the lower part of a voltage divider
 * where the other resistor is 10K, the voltage that appears on ADC C if the maximum temperature is reached
 */
bool calibrationSetTemperatureMaxResistance(uint32_t value) {
    if(_bCalibrationActive) {
        // formula: Vout = Vin*Rt/(R1+Rt)
        // https://en.wikipedia.org/wiki/Voltage_divider
        _CalibrationData.temperature_threshold = ((5.0*value)/(10000.0+value)); // todo convert to the ADC 16 bit value in stead of float
    }
    return _bCalibrationActive;
}

/**
 * this function returns the resistance of the NTC thyristor at the point where the electronic load is overheated.
 *
 */
uint32_t calibrationGetTemperatureMaxResistance() {
    uint32_t uRetVal = 0U;
    // formula: Rt = R1.(1/((Vin/Vout)-1))
    // https://en.wikipedia.org/wiki/Voltage_divider
    uRetVal = 10000.0 * (1.0/((5.0/_CalibrationData.temperature_threshold)-1.0)); // todo convert to the ADC 16 bit value in stead of float
    return uRetVal;
}

float calibrationGetTemperatureMaxFloat() { // todo: remove when we turned all overload functionality to uint
    return _CalibrationData.temperature_threshold;
}

 

The over-temperature watchdog is an RTOS task. It runs every second and checks if the value sampled by ADC C drops below the value in the calibration data.

If that's the case, it disables the input of the electronic load.

 

*
 *  ======== fnTaskTemperatureOverProtection ========
 *  Task for this function is created statically. See the project's .cfg file.
 */
Void fnTaskTemperatureOverProtection(UArg arg0, UArg arg1)
{
    float fSample;
    while (1)
    {
        if (calibrationGetTemperatureMaxResistance()) { // if enabled
            fSample = eLoadDevelopGetAdcVolt(2);
            if (fSample > 0.0) { // ignore if no samples been taken yet
                if ( fSample < calibrationGetTemperatureMaxFloat()) { // todo this should be a uint calculation
                    eloadInputEnable(false);
                }
            }
        }
        Task_sleep(arg0);
    }
}

 

Timings

 

A warning about the time between the FET heating up and the protection kicking in. There are a series of delays:

  • it takes a little time for the thermistor to get to the same temperature as the FET.
  • the ADC is sampled every second then cached, so the data may be 1 second old
  • the temperature overload watchdog runs every second. So worst case it takes 2 seconds before the firmware detects the over temperature.
  • switching off the output is done via an RTOS message and  i²c communication to an I/O chip. This also takes (at the moment unknown because not measured) time.

 

Change Over-temperature Protection, Temporary or Permanent

 

The instrument has SCPI functions to query and change the protection setting. Check here for the documentation: Programmable Electronic Load - Calibration Steps

To query the current setting, execute the following SCPI command:

 

CALibration:TEMPERATUREMAXResistance?

 

You'll get the value that's currently active.

 

To change or disable the over-temperature protection, there's another SCPI command.

Because this is a command that alters calibration settings, you first have to activate a calibration session.

 

CALibration:STArt 
CALibration:TEMPERATUREMAXResistance 0

 

The value 0 will deactivate over-protection. Any other value will make the watchdog trip as soon as the thermistor drops below the entered resistance.

With the example of the NTC data sheet table above, to make the device switch off at 125° C, you'd enter:

 

CALibration:TEMPERATUREMAXResistance 339

 

For the NTC that's suggested in this build, the command to switch off at 125° C is:

 

CALibration:TEMPERATUREMAXResistance 518

 

The settings are active immediately, but not stored in the permanent calibration memory.

If you power-cycle the instrument or reset it, the original calibration point is restored. (note: the *RST SCPI command does not restore calibration data)

 

If you want to make your changes permanent, run the following SCPI command to close the calibration session and write the value to Flash:

 

CALibration:END

 

As long as you haven't executed the CALibration:END command, every change is temporary and you can revert back to the previous calibration state.
Once you've executed it, the current calibration state will be the new active state, also after power-cycle or reset.

 

Initial Setting when you Program the Firmware the 1st Time

 

Initially, over-temperature protection is undefined. The calibration value is stored in Flash and the Code Composer Studio project is configured to not touch this memory area.

Depending on what you've done before with the MSP432, this area may be filled with 0xFFFFFFFF values or something else (e.g. if you've ever ran the MSP432 DriverLib Flash Controller example, the area may contain 0xA5A5A5A5).

It's part of the initial setup to define the proper setting for over-temperature when initialising and configuring the instrument before first use.

  • ntc
  • rtos
  • over_temperature
  • thermistor
  • msp432
  • watchdog
  • ti_rtos
  • protection
  • adc
  • Share
  • History
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • Robert Peter Oakes
    Robert Peter Oakes over 7 years ago in reply to Jan Cumps +3
    Girl FIRST, DC Load a close second… go out now !!!
  • jc2048
    jc2048 over 7 years ago in reply to Jan Cumps +2
    I haven't used them before. Here's the product page - there's a temperature table in the datasheet linked on that page. http://www.semitec.co.jp/english/products/thermo/thermistor/jt/ I won't have any…
  • shabaz
    shabaz over 7 years ago in reply to Jan Cumps +2
    Hi Jan! Personally I would do this; store the temperature not as a float, but as an integer, multiplied by (say) 10. That way you still have the resolution of the float to the extent that you may want…
Parents
  • Jan Cumps
    Jan Cumps over 7 years ago

    Anyone volunteering to write a function that converts a floating point value into ADC raw 16 bit data?

     

    Function signature:

    uint16_t adcImplFloatToRaw(float fVal);

     

    As reference, functions to convert raw ADC to float can be found here: https://github.com/jancumps/msp432/blob/master/MSP432_SCPI_ElectronicLoad/adc_impl/adc_impl.c

     

    My current temperature overload check uses floating point comparisons. We can do better image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 7 years ago in reply to Jan Cumps

    Hi Jan!

     

    Personally I would do this; store the temperature not as a float, but as an integer, multiplied by (say) 10. That way you still have the resolution of the float to the extent that you may want it (i.e to 0.1 degrees C), and it is stored in an understandable non-ADC-specific format, and it is low-cost (resource-wise) to process (which is why I'm guessing you wanted to convert from float to raw).

    If you ever really did need it as a float, then you could cast to float and divide by 10 or 100 to get back the correct value. Some would not multiply by 10 and instead multiply by (say) 8 or 16, but you have lots of processing power in that MSP432.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • shabaz
    shabaz over 7 years ago in reply to Jan Cumps

    Hi Jan!

     

    Personally I would do this; store the temperature not as a float, but as an integer, multiplied by (say) 10. That way you still have the resolution of the float to the extent that you may want it (i.e to 0.1 degrees C), and it is stored in an understandable non-ADC-specific format, and it is low-cost (resource-wise) to process (which is why I'm guessing you wanted to convert from float to raw).

    If you ever really did need it as a float, then you could cast to float and divide by 10 or 100 to get back the correct value. Some would not multiply by 10 and instead multiply by (say) 8 or 16, but you have lots of processing power in that MSP432.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • Jan Cumps
    Jan Cumps over 7 years ago in reply to shabaz

    Shabaz,

     

    The firmware has some floating point calculations when displaying data, but not in the control loops (until I introduced floating point over-temperature check in a moment of laziness image ).

    Because the temperature protection has to kick in when an ADC (the one sampling a NTC thermistor) drops under a certain voltage, it would suffice to have that threshold as a unsigned 16 bit value.

    That way the control loop would just have to compare two 16 bit values, very efficient.
    I don't worry about performance because my current floating point comparison happens once every second, not an issue at all for the microcontroller.

    And to be ho(u)nest: I know how to build that function but I want to go out with my girlfriend instead image.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 7 years ago in reply to Jan Cumps

    Hehe yeah I figured you were just tired to implement the code to reverse it : ) You've done a lot of work, very impressive actually.

     

    Hope you're having a good Xmas break.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Robert Peter Oakes
    Robert Peter Oakes over 7 years ago in reply to shabaz

    Based on all these emails, he is not taking a xmas break…..

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Robert Peter Oakes
    Robert Peter Oakes over 7 years ago in reply to Jan Cumps

    Girl FIRST, DC Load a close second… go out now !!!

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube