TOP Contributors

  1. MIKROE (2650 codes)
  2. Alcides Ramos (350 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 (136549 times)
  2. FAT32 Library (69743 times)
  3. Network Ethernet Library (55847 times)
  4. USB Device Library (46184 times)
  5. Network WiFi Library (41803 times)
  6. FT800 Library (40993 times)
  7. GSM click (28926 times)
  8. PID Library (26385 times)
  9. mikroSDK (26288 times)
  10. microSD click (25301 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

SHT1x click

Rating:

0

Author: MIKROE

Last Updated: 2019-06-06

Package Version: 1.0.0.1

mikroSDK Library: 1.0.0.0

Category: Temperature & humidity

Downloaded: 13277 times

Followed by: 2 users

License: MIT license  

This code demonstrates how to use SHT1x click board in mikroBUS form factor. SHT11 sensor uses I2C communication and measures temperature and relative humidity.

No Abuse Reported

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

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

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

SHT1x click

SHT1x click

Front and back view of SHT1x click board designed in mikroBUS form factor. mikroBUS is specially designed pinout standard with SPI, I2C, Analog, UART, Interrupt, PWM, Reset and Power supply pins.

View full image

Library Description

The library covers all the necessary functions to control SHT1x click board. SHT1x click board
communicates with the target board through the SDA and SCL lines. This library offers functions
for seting and clearing and checking the state of SDA and SCL lines. It also has functions that 
perform calculations of temperature and humidity based on counted ticks.

Key functions:

  • float sht1x_calcTemp( uint16_t t ) - Function is used to calculate temperature.
  • float sht1x_calcHumi( uint16_t h, uint16_t t ) - Function is used to calculate humidity. 

Examples description

The application is composed of the three sections :

  • System Initialization - Initializes GPIO and LOG structures, sets SDA and SCL pins as input and output.
  • Application Initialization - Initialization driver enables GPIO and also starts write log.
  • Application Task - (code snippet) This example demonstrates the use of SHT1x Click board by measuring temperature and humidity, and displays the results on USART terminal.
void applicationTask()
{
sht1x_readResults( &temperature, &humidity );
    mikrobus_logWrite( " Temperature: ", _LOG_TEXT );
    FloatToStr( temperature, logText );
    ltrim( logText );
    mikrobus_logWrite( logText, _LOG_TEXT );
    mikrobus_logWrite( degCel, _LOG_LINE );
    mikrobus_logWrite( " Humidity: ", _LOG_TEXT );
    FloatToStr( humidity, logText );
    ltrim( logText );
    mikrobus_logWrite( logText, _LOG_TEXT );
    mikrobus_logWrite( "%", _LOG_LINE );
    mikrobus_logWrite( "----------------------", _LOG_LINE );
    Delay_ms( 1000 );
}

Additional Functions :

  • void sht1x_transStart() - Generates a transmission start.
  • uint8_t sht1x_readByte( uint8_t ack ) - Reads a byte form the Sensibus and gives an acknowledge in case of "ack=1".
  • uint8_t sht1x_writeByte( uint8_t value ) - Writes a byte on the Sensibus and checks the acknowledge.
  • uint8_t sht1x_measure( uint16_t *pVal, uint8_t mode ) - Makes a measurement (humidity/temperature) with checksum | pVal returns 2 bytes | mode: 1=humidity 0=temperature | return value: 0=ok, 1=write error, 2=timeout.
  • void sht1x_readResults( float *fT, float *fRH ) - Reads temperature and humidity.
  • uint8_t sht1x_rdStatReg( uint8_t *pVal ) - Reads the status register with checksum (8-bit).
  • uint8_t sht1x_wrStatReg( uint8_t value ) - Writes the status register with checksum (8-bit) | input: status register value | return value: 0=ok, 1=write error.
  • void sht1x_connectionReset() - Communication reset: DATA-line=1 and at least 9 SCK cycles followed by sht1x_transStart.
  • uint8_t sht1x_softReset() - Resets the sensor by a soft reset.

Other mikroE Libraries used in the example:

  • 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.

SHT1x click board schematics

SHT1x click board schematics

Board is set to use 3.3V power supply by default. Solder PWR SEL SMD jumper to 5V position if used with 5V systems.

View full image

ALSO FROM THIS AUTHOR

Oximeter 5 click

0

Oximeter 5 Click is a compact add-on board suitable for measuring blood oxygen saturation. This board features the MAX30102, integrated pulse oximetry, and heart-rate monitor module from Analog Devices. The MAX30102 includes internal LEDs, photodetectors, optical elements, and low-noise electronics with ambient light rejection. It operates on a single 1.8V power supply acquired from both mikroBUS™ power rails for the internal LEDs, communicating through a standard I2C compatible interface. The MAX30102 can be shut down through software with zero standby current, allowing the power rails to remain powered at all times.

[Learn More]

OOK RX click

5

OOK RX click is a wireless receiver that operates at the frequency of 433MHz (sub-GHz). This device allows realization of a simple, low-speed wireless ad hoc communication network between a receiver and compatible transmitter, such as OOK TX click.

[Learn More]

Compass 3 click

5

Compass 3 Click features MMC5883MA, a complete 3-axis magnetic sensor with on-chip signal processing and integrated I2C bus suitable for use in various applications.

[Learn More]