TOP Contributors

  1. MIKROE (2652 codes)
  2. Alcides Ramos (351 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 (136632 times)
  2. FAT32 Library (69837 times)
  3. Network Ethernet Library (55891 times)
  4. USB Device Library (46226 times)
  5. Network WiFi Library (41863 times)
  6. FT800 Library (41084 times)
  7. GSM click (28944 times)
  8. PID Library (26402 times)
  9. mikroSDK (26317 times)
  10. microSD click (25328 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 2 click

Rating:

5

Author: MIKROE

Last Updated: 2019-03-26

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Temperature & humidity

Downloaded: 3688 times

Not followed.

License: MIT license  

Thermostat 2 Click is a general-purpose thermostat Click board designed to be used with any temperature sensor based on the DS1820 sensor design: 3-pin package with 1-Wire® communication interface.

No Abuse Reported

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

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

Do you want to report abuse regarding "Thermostat 2 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 2 click

Thermostat 2 click

Native view of the Thermostat 2 click board.

View full image
Thermostat 2 click

Thermostat 2 click

Front and back view of the Thermostat 2 click board.

View full image

Library Description

The library contains the One Wire functions for full communication from MCU to one of the DS18k20 sensors. The user also has a relay management function available.

Key functions:

  • void thermostat2_relay(uint8_t state) - Relay control
  • void thermostat2_oneWireReset() - One Wire Reset
  • void thermostat2_oneWireWrite(uint8_t dataIn) - One Wire Write
  • uint8_t thermostat2_oneWireRead() - One Wire Read

Examples description

The application is composed of the three sections :

  • System Initialization - Sets CS pin as OUTPUT for control of the relay
  • Application Initialization - Initialization driver init and sets relay state on OFF
  • Application Task - Waits for valid user input and executes functions based on set of valid commands

Commands : '+' - Relay ON '-' - Relay OFF 't' - Reads and display Temperature

void applicationTask()
{
    float Temperature;
    char demoText[50];
    
    uint8_t dataReady_;
    char receivedData_;

    dataReady_ = UART_Rdy_Ptr( );

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

        switch (receivedData_)
        {
            case '+' :
            {
                mikrobus_logWrite(" Relay ON!!! ", _LOG_LINE);
                thermostat2_relay(_THERMOSTAT2_RELAY_STATE_ON);
                break;
            }
            case '-' :
            {
                mikrobus_logWrite(" Relay OFF!!! ", _LOG_LINE);
                thermostat2_relay(_THERMOSTAT2_RELAY_STATE_OFF);
                break;
            }
            case 't' :
            {
                Temperature = thermostat2_getTemperature();
                FloatToStr(Temperature, demoText);
                mikrobus_logWrite("Temperature : ", _LOG_TEXT);
                mikrobus_logWrite(demoText, _LOG_TEXT);
                mikrobus_logWrite(" C ", _LOG_LINE);
                break;
            }
        }
    }
}

Additional Functions :

  • void thermostat2_getTemperature( ) - Reads Temperature (DS18S20)

Other mikroE Libraries used in the example:

  • One_Wire
  • UART
  • 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

TMR Angle click

0

TMR Angle Click is a Click board perfectly suited for developing applications that range from steering angle applications with the highest functional safety requirements to motors for wipers, pumps and actuators and electric motors in general.

[Learn More]

AudioMUX click

5

AudioMUX click is a sound processing Click board with digital controls, based on the TDA7468D IC.

[Learn More]

DC MOTOR click

0

This application change the speed and direction of DC Motor

[Learn More]