How does it work?
Thermostat 4 Click uses the output of the TMP392 as open-drain and with two 10k pull-up resistors on mikroBUS™ OA and OB pins connected to VCC voltage indicate when a threshold temperature is detected. The device powers on when the supply voltage goes beyond 1.5V, and starts sampling the input resistance to set the two trip points and hysteresis value after power-on. Resistance values for each temperature can be find in TMP392 datasheet Table 1 and Table 2. These values will remain the same until the device goes through a power cycle.
Trip point for channel A can be set manually using onboard trimmer while trip point for channel B is set using TPL0501 digital potentiometer with 256 wiper positions used as as a two-terminal rheostat. With end-to-end resistance of 100 kΩ internal registers of the TPL0501 can be accessed using a SPI interface. The position of the wiper (W) terminal is controlled by the value in the 8-bit Wiper Resistance (WR) register. When the WR register contains all zeroes (zero-scale), the wiper terminal is closest to its L terminal. As the value of the WR register increases from all zeroes to all ones (full-scale), the wiper moves from the position closest to the L terminal, to the position closest to the H terminal. At the same time, the resistance between W and L increases, whereas the resistance between W and H decreases.
The relay is activated by the host MCU. The voltage for the coil activation is 5V, while the current through the coil is 40mA. The MCU is not able to drive the coil directly, therefore an N-chanel FET had to be added. Its gate is controlled by the host MCU, allowing the coil to drain enough current from the 5V mikroBUS™ power rail. A red color LED, labeled as ACTIVE is used to indicate that the transistor is in an open state and that the current is running through the relay coil.
When the current through a coil (or any other inductor) is suddenly changed, the backEMF will be generated, opposing the changes of the current. This can sometimes lead to damage to the control circuit: in this case, the transistor will become inversely polarized. To prevent this from happening, a flyback diode is added across the coil. During the normal operation, this diode does not conduct any current. However, when the coil is switched OFF, the inverse polarization will cause the current to pass through this diode with minimum resistance. This prevents inverse (flyback) voltage from building up, so the transistor remains safe.
The Click board™ is equipped with all the necessary elements, required to provide a reliable operation: it has a varistor across the relay output contacts, preventing excessive voltage transients, it has a flyback diode for the backEMF generated within the relay coil, and a durable mechanical relay, that can withstand up to 20,000,000 mechanical cycles (no load connected). These features allow Thermostat 4 click to be used for a wide range of applications that have to be thermally controlled: various home appliances, air conditioners, cooling fans, small heaters, etc.
Specifications
Type
Temperature & humidity
Applications
Thermostat 4 Click can be used for a wide range of applications that have to be thermally controlled: various home appliances, air conditioners, cooling fans, small heaters, etc
On-board modules
TMP392
Key Features
Dual outputs for overtemperature detection, Trip test function enables in-system testing, Resistor tolerances contribute zero error
Interface
GPIO,SPI
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on Thermostat 4 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
PWR | LD1 | – | Power LED Indicator |
ACTIVE | LD2 | – | Relay active LED indicator |
VCC SEL | JP1 | Left | Logic level voltage selection: left position 3V3, right position 5V |
Software Support
We provide a library for the Thermostat 4 Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library contains basic functions for working with Thermostat 4 click.
Key functions:
void thermostat4_relay_ctrl( uint8_t state )
– Relay Controluint8_t thermostat4_hot_alert_state( void )
– Hot temperature ALERTuint8_t thermostat4_warm_alert_state( void )
– Warm temperature ALERT
Examples description
The application is composed of three sections :
- System Initialization – Initializes SPI module and all necessary GPIO pins
- Application Initialization – Initializes Driver init, Relay test and sets hysteresis on the WARM channel ( channel B ), after thet starts uploading new data.
- Application Task – Reads Alert on the WARM and HOT channel.
- note: The user has the option of adjusting the hysteresis for channel B via the SPI module while for channel A it is adjusted via the potentiometer.
void application_task ( ) { if ( thermostat4_hot_alert_state( ) == THERMOSTAT4_HOT_ALERT ) { mikrobus_logWrite( ">> H-O-T A-L-E-R-T <<", _LOG_LINE ); thermostat4_relay_ctrl( THERMOSTAT4_RELAY_ON ); } if ( thermostat4_warm_alert_state( ) == THERMOSTAT4_WARM_ALERT ) { mikrobus_logWrite( ">> W-A-R-M A-L-E-R-T <<", _LOG_LINE ); thermostat4_relay_ctrl( THERMOSTAT4_RELAY_ON ); } mikrobus_logWrite( ">> T-E-M-P-E-R-A-T-U-R-E O-K <<", _LOG_LINE ); thermostat4_relay_ctrl( THERMOSTAT4_RELAY_OFF ); Delay_ms( 200 ); }
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
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB 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.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.