TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139262 times)
  2. FAT32 Library (71751 times)
  3. Network Ethernet Library (57124 times)
  4. USB Device Library (47430 times)
  5. Network WiFi Library (43090 times)
  6. FT800 Library (42404 times)
  7. GSM click (29835 times)
  8. mikroSDK (28079 times)
  9. PID Library (26885 times)
  10. microSD click (26198 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: 4117 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

Hall current 2 Click

5

Hall current 2 click is a very accurate current measurement Click board, which relies on the Hall effect. The maximum current which can be measured with the Hall current 2 ranges from -12A to +12A, with optimized precision.

[Learn More]

RTC 12 Click

0

RTC 12 Click is a compact add-on board that measures the passage of time. This board features the DS1343, a low-current SPI-configurable real-time clock (RTC) from Maxim Integrated. This timekeeping device provides an extremely low standby current permitting longer life from a backup supply source. Its clock/calendar feature provides seconds, minutes, hours, day, date, month, and year information.

[Learn More]

eINK 2.13 inch display

0

eINK click is an adapter Click boardâ„¢, used to interface a compatible eINK display with the host MCU.

[Learn More]