If you need a temperature sensor and relay in one device, you should look no further than Thermostat click. It can be used to measure environmental temperature and to directly switch ON/OFF cooling and heating devices, performing all the functions of a thermostat.
Thermostat click carries the MAX7502 IC digital temperature sensor, that also provides an overtemperature alarm/interrupt/shutdown output, and an SN74LVC1G126 single bus buffer from Texas Instruments. MAX7502 IC can measure temperatures from -25°C to +100°C, within the accuracy of ±1.5°C.
The G6D PCB power relay can control up to 5A, 250V AC/30V DC loads.
The click runs on either 3.3V or 5V power supply and communicates with the target MCU over I2C interface.
The IC can measure temperatures from -25°C to +100°C, within the accuracy of ±1.5°C.
MAX7502 temperature sensor
MAX7502 temperature sensor measures temperature, converts the data into digital form using a sigma-delta ADC, and communicates the conversion results through an I2C-compatible 2-wire serial interface.
It accepts standard I2C commands to read the data, set the overtemperature alarm trip thresholds, and configure other characteristics.
Low power consumption
The MAX7502 temperature sensor typically uses only around 250 µA, and in shutdown mode around 3 µA. With such low power consumption, it is very suitable for home automation devices.
Enable/disable thermostat functionality
There is also the TE (thermostat enable) pin on the mikroBUS™ pin socket for enabling (high level) or disabling (low) of the thermostat functionality. This is accomplished via the SN74LVC1G126 single bus buffer with 3-state output IC, which serves as an electronic switch between temperature sensor IC output pin and the relay driver circuit.
This way the relay can be permanently disconnected from the sensor IC output. A feature like this can be useful when the sensor IC is only used as an measuring device, or if the thermostat needs to be temporarily disabled.
HVAC systems, heating systems, cooling systems, simple interrupt ON/OFF temp control, hysteresis controller, etc.
||Temperature & humidity
||HVAC systems, heating systems, cooling systems, simple interrupt ON/OFF temp control, hysteresis controller, etc.
||MAX7502 IC digital temperature sensor
||MAX7502 temperature sensor, SN74LVC1G126 single bus buffer, G6D PCB power relay, I2C interface, either 3.3V or 5V power supply,
|Click board size
||L (57.15 x 25.4 mm)
||3.3V or 5V
This table shows how the pinout on Thermostat click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
|Hardware Reset for MAX7502
||Serial Data Input/Output Line
||Serial Data Clock Input
Jumpers and settings
The table below gives information about the onboard jumpers.
||Power Supply Voltage Selection 3.3V/5V, left position 3.3V, right position 5V
LEDs, buttons and switches
The following table gives information about onboard LEDs, buttons and switches.
||Type (LED, BUTTON…)
||2-pole PCB terminal block 5.08mm
||For output device connection (heater/fan…)
Code examples for Thermostat click, written for MikroElektronika hardware and compilers are available on Libstock.
This code snipped for EasyMx PRO v7 for STM32F107VC MCU initializes the temperature sensor by writing into its registers and, then it reads the temperature in an endless loop. If the measured temperature gets below the hysteresis temperature, the output relay is ON.
The sensor is configured for heating, without fault queue bits, when OS output is active low, with comparator logic and in normal operation.
1 // Main program
2 void main()
5 // MAX7502 temperature controller IC
7 // MAX7502 Initialization
8 TEMP = 0; // Thermostat function disabled - Output Relay disconnected
9 TRES = 0; // Apply Reset procedure
11 TRES = 1; // Temperature controller is in default state and ready for work
13 // MAX7502 Configuration
14 Set_CONFIG(0); // Set parameters in configuration register
15 // refer to MAX7502 datasheet and click board schematic in order to
16 // set right parameters for intended application:
17 // e.g. set OS output pin polarity for using the chip sensor in
18 // processes of Heating (bit1=0) or Cooling (bit1=1)
19 // or set the output function of the same pin to be Comparator (bit2=0)
20 // or Interrupt logic (bit2=1) in order to use the sensor for hysterezis
21 // temp ON/OFF control (real process) or trivial ON/OFF control
22 // In this example the chip is configured for heating
23 Set_TEMP_REF(REF_TEMP); // Set referent temperature T = 22 C (Output relay is ON until the environment
24 // temperature has reach that value)
25 Set_TEMP_HYST(HYST_TEMP); // Output Relay is OFF until the temperature falls below HYST value
27 TEMP = 1; // Thermostat enabled - Output Relay connected to OS output pin of MAX7502
31 current_temp = REF_TEMP;
32 old_MSB = 0;
33 temp_MSB = 0;
34 temp_changed = false;
37 // Temperature read loop - temperature controlling process
38 while (1)
40 Temp_read(); // Read 9-bit temperature value from MAX7502's register space
41 delay_ms(200); // +-0.5 C fraction neglected in this example