- Order number: MIKROE-3415
- Manufacturer product ID: MIKROE-3415
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 2 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.
DO NOT TOUCH THE BOARD WHILE HIGH VOLTAGE IS APPLIED!
Note: The Click board™ is to be used by trained personnel only while the high voltage is applied. A special care should be taken when working with hazardous voltage levels.
How does it work?
Thermostat 2 Click board™ is designed without the main IC; it allows an externally connected thermal sensor to be used, instead. It can be interfaced with the DS1820 compatible sensor which uses 1-Wire® communication. The Click board™ is equipped with a 3-pin female socket, which can be used to install the DS1820 compatible sensor in TO-92 casing, onboard. There is also a 3-pole screw terminal, that can be used if the sensor needs to be installed on a remote location, i.e. onto a heating component. The screw-terminal shares its lines with the socket.
The 1-Wire® communication with the host MCU is performed over the PWM pin of the mikroBUS™. Depending on the temperature information obtained over the 1-Wire® interface, the host MCU can take the necessary action: it can either open or close contacts of the relay.
The Click board™ uses the G6D series PCB power relay, from Omron. This quality relay can withstand an amazingly large number of mechanical cycles, with no load connected. However, when there is a significant load connected at its output, micro-electric arcs cause the contacts to wear over time. With the maximum load current of 5A, it can sustain up to 70,000 cycles. Its contacts are made of silver alloy, yielding exceptional ON resistance of only 100m? (max).
The relay is activated by a magnetic field, generated in a built-in coil on the low-voltage side. The coil 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 NPN transistor had to be added. Its base is controlled by the host MCU, allowing the coil to drain enough current from the 5V mikroBUS™ power rail. The base of the transistor is routed to the CS pin of the Click board™. The transistor packs two biasing resistors in the same casing, so it can be directly used on the MCU pin, without external biasing resistors. 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.
Contacts at the output may be connected to a higher voltage and larger current may run through. To prevent high voltage transients in this case, a flyback diode is not a viable option. Therefore, Thermostat 2 click uses a varistor (VDR). This component rapidly drops its resistance as the voltage rises above its rated clamping voltage. The excessive voltage transient will pass through the VDR since it will become a current path with the least resistance. During the normal operation, while the voltage stays below the rated clamping voltage, VDR has a very high resistance, so the current runs through the electrical circuit, instead.
The operating voltage of the Click board™ can be selected by the VCC SEL jumper. This jumper allows selecting either 3.3V or 5V from the mikroBUS™. The selected voltage will be applied to the VCC pin of the connected DS1820 sensor.
Specifications
Type | Relay |
Applications | Thermostat 2 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 | G6D series PCB power relay, by Omron. |
Key Features | Ability to use DS1820 or compatible temperature sensor, both onboard and connected over a terminal, overvoltage and backEMF protection, LED indication… |
Interface | GPIO,1-Wire |
Input Voltage | 3.3V,5V |
Compatibility | mikroBUS |
Click board size | M (42.9 x 25.4 mm) |
Pinout Diagrams
This table shows how the pinout on Thermostat 2 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard Settings And Inndicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | - | Power LED indicator |
LD2 | ACTIVE | - | Relay status LED, lights up when the relay is CLOSED |
CN1 | - | - | External sensor connector |
TB1 | - | - | Relay output connector |
TS1 | - | - | Onboard 3-pin sensor connector |
JP1 | VCC SEL | Left | Power supply voltage selection: left position 3.3V, right position 5V |
Software Support
We provide a library for the Thermostat 2 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 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 controlvoid thermostat2_oneWireReset()
- One Wire Resetvoid thermostat2_oneWireWrite(uint8_t dataIn)
- One Wire Writeuint8_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)
The full application code, and ready to use projects can be found on our LibStock page.
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 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.