TOP Contributors

  1. MIKROE (2652 codes)
  2. Alcides Ramos (351 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 (136604 times)
  2. FAT32 Library (69806 times)
  3. Network Ethernet Library (55881 times)
  4. USB Device Library (46211 times)
  5. Network WiFi Library (41857 times)
  6. FT800 Library (41067 times)
  7. GSM click (28941 times)
  8. PID Library (26400 times)
  9. mikroSDK (26306 times)
  10. microSD click (25322 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: 13291 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

DMA Memory to Memory Demo

0

The application demonstrates DMA SDK functionality.

[Learn More]

ISM RX click

0

ISM RX Click is a compact add-on board that contains a complete wireless RF digital data receiver. This board features the MAX1471, a low-power CMOS RF dual-channel receiver configurable through SPI serial interface from Maxim Integrated.

[Learn More]

DC MOTOR 10

5

DC Motor 10 Click is a brushed DC motor driver with the current limiting and current sensing. It is based on the TLE 6208-6 G, an Hex-Half-Bridge / Double Six-Driver IC, optimized for motor driving applications.

[Learn More]