TOP Contributors

  1. MIKROE (2648 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 (136486 times)
  2. FAT32 Library (69704 times)
  3. Network Ethernet Library (55813 times)
  4. USB Device Library (46148 times)
  5. Network WiFi Library (41791 times)
  6. FT800 Library (40971 times)
  7. GSM click (28918 times)
  8. PID Library (26377 times)
  9. mikroSDK (26259 times)
  10. microSD click (25289 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: 13269 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

UWB click

5

UWB Click is an Ultra-Wideband transceiver Click board that can be used in 2-way ranging or TDOA location systems to locate assets to a precision of 10 cm and supports data rates of up to 6.8 Mbps. This board features the DWM1000 module based on Decawave's DW1000 Ultra-Wideband (UWB) transceiver from Decawave Limited.

[Learn More]

TempHum 8 click

0

Temp&Hum 8 click is based on a sensor from the popular SHT family, designed to measure temperature and humidity.

[Learn More]

MCP73213 click

7

MCP73213 click carries the MCP73213 dual-cell Li-Ion/Li-Polymer battery charge management controller with Input overvoltage protection from Microchip. The click is designed to run on either 3.3V or 5V power supply. It communicates with the target microcontroller over SPI.

[Learn More]