TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (358 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (137080 times)
  2. FAT32 Library (70222 times)
  3. Network Ethernet Library (56094 times)
  4. USB Device Library (46409 times)
  5. Network WiFi Library (42029 times)
  6. FT800 Library (41373 times)
  7. GSM click (29109 times)
  8. mikroSDK (26554 times)
  9. PID Library (26487 times)
  10. microSD click (25483 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Thermostat 3 click

Rating:

5

Author: MIKROE

Last Updated: 2019-08-28

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Temperature & humidity

Downloaded: 2642 times

Not followed.

License: MIT license  

Thermostat 3 Click is a general-purpose thermostat Click board designed to be used with any temperature sensor based on the MAX31855 sensor design.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Thermostat 3 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Thermostat 3 click" changes.

Do you want to report abuse regarding "Thermostat 3 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Thermostat 3 click

Thermostat 3 click

Native view of the Thermostat 3 click board.

View full image
Thermostat 3 click

Thermostat 3 click

Front and back view of the Thermostat 3 click board.

View full image

Library Description

The library initializes and defines the SPI bus driver and drivers that offer a choice for read data form SPI lines. With functions from the library it is possible to read Internal or Thermocouple temperature data in Celsius, Kelvin or Fahrenheit. The library provides full relay control and reads fault error status.

Key functions:

  • float thermostat3_getInternalTemperature(uint8_t TempIn) - Junction (Internal) Temperature
  • float thermostat3_getThermocoupleTemperature(uint8_t TempIn) - Thermocouple Temperature (K probe)
  • void thermostat3_relayControl(uint8_t relayPos) - Relay Control

Examples description

The application is composed of three sections :

  • System Initialization - Initialzes SPI module and all the necessary GPIO pins
  • Application Initialization - Initialization driver init
  • Application Task - Waits for valid user input and executes functions based on set of valid commands
  • Commands : 'e' - Display Thermocouple temperature 'i' - Display Internal temperature 'r' - Relay control (Relay ON / OFF) 'f' - Fault flag (Active ON / OFF) '+' - Change fault flage and display fault status(ERROR / OK)
void applicationTask()
{
    uint8_t dataReady_;
    char receivedData_;
    
    thermostat3_process();
    
    dataReady_ = UART_Rdy_Ptr();

    if (dataReady_ != 0)
    {
        receivedData_ = UART_Rd_Ptr();

        switch (receivedData_)
        {
            case 'i' :
            {
                InternalTemp = thermostat3_getInternalTemperature(_THERMOSTAT3_TEMP_IN_CELSIUS);

                FloatToStr(InternalTemp, demoText);
                mikrobus_logWrite("# Internal Temperature: ", _LOG_TEXT);
                mikrobus_logWrite(demoText, _LOG_LINE);
                break;
            }
            case 'e' :
            {
                ThermocoupleTemp = thermostat3_getThermocoupleTemperature(_THERMOSTAT3_TEMP_IN_CELSIUS);

                FloatToStr(ThermocoupleTemp, demoText);
                mikrobus_logWrite("# Thermocouple Temperature: ", _LOG_TEXT);
                mikrobus_logWrite(demoText, _LOG_LINE);
                break;
            }
            case 'r' :
            {
                if(_relayFlag == 1)
                {
                    _relayFlag = 0;
                    thermostat3_relayControl(_THERMOSTAT3_RELAY_OFF);
                    mikrobus_logWrite("# Relay OFF", _LOG_LINE);
                }
                else
                {
                    _relayFlag = 1;
                    thermostat3_relayControl(_THERMOSTAT3_RELAY_ON);
                    mikrobus_logWrite("# Relay ON", _LOG_LINE);
                }
                break;
            }
            case 'f' :
            {
                if(_faultFlag == 1)
                {
                    _faultFlag = 0;
                    mikrobus_logWrite("# Fault status -- OFF", _LOG_LINE);
                }
                else
                {
                    _faultFlag = 1;
                    mikrobus_logWrite("# Fault status -- ON", _LOG_LINE);
                }
                break;
            }
            case '+' :
            {
                if(_faultFlag == 1)
                {
                    _fError++;
                    if(_fError > 3)
                    {
                        _fError = 0;
                    }
                    _displayFault(_fError);
                    _faultStatus = thermostat3_getFaultData(0x01 << _fError);
                    
                    if (_faultStatus == 1 )
                    {
                        mikrobus_logWrite(" -- ERROR", _LOG_LINE);
                    }
                    else
                    {
                        mikrobus_logWrite(" -- OK", _LOG_LINE);
                    }
                }
                else
                {
                    mikrobus_logWrite(" Fault status is OFF, Please turn ON fault status!!!", _LOG_LINE);
                }
                break;
            }
        }
    }
}

Additional Functions :

  • void _displayFault( ) - Display fault

The full application code, and ready to use projects can be found on our LibStock page.

Other mikroE Libraries used in the example:

  • SPI Library
  • UART Library
  • Conversions

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.

ALSO FROM THIS AUTHOR

6DOF IMU 14 click

0

6DOF IMU 14 Click is a compact add-on board that contains a 6-axis MEMS motion tracking device combining a 3-axis gyroscope and a 3-axis accelerometer. This board features the ICM-42688-P, high precision 6-axis MEMS motion tracking device, from TDK InvenSense.

[Learn More]

BATT-MON 2 click

0

BATT-MON 2 Click is a compact add-on board representing a battery monitoring solution. This board features the MAX17262, an ultra-low power I2C-configurable fuel-gauge IC which implements the ModelGaugeā„¢ m5 algorithm from Analog Devices. The MAX17262 monitors a single-cell battery pack (best performance for batteries with 100mAhr to 6Ahr capacity), providing precision measurements of current, voltage, and temperature, and supporting internal current sensing for up to 3.1A pulse current. The battery pack's temperature is measured using an internal temperature sensor or external thermistor.

[Learn More]

LED Driver 8 click

0

LED Driver 8 Click is a compact add-on board optimized for dimming and blinking 32 mA RGBA LEDs. This board features the PCA9957HNMP, 24-channel SPI-compatible constant current LED driver from NXP Semiconductors.

[Learn More]