TOP Contributors

  1. MIKROE (2657 codes)
  2. Alcides Ramos (354 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 (136901 times)
  2. FAT32 Library (70034 times)
  3. Network Ethernet Library (56005 times)
  4. USB Device Library (46308 times)
  5. Network WiFi Library (41934 times)
  6. FT800 Library (41234 times)
  7. GSM click (29022 times)
  8. PID Library (26434 times)
  9. mikroSDK (26401 times)
  10. microSD click (25387 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: 13389 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

Air Velocity click

0

Air Velocity Click is a compact add-on board that measures direct airspeed. This board features the FS3000-1005, a surface-mount type air velocity module utilizing a MEMS thermopile-based sensor from Renesas. This I2C-configurable air velocity module features a digital output with a 12-bit resolution with a wide operational range of 0-7.2meter/second (0-16.2mph). The sensor comprises a “solid” thermal isolation technology and silicon-carbide coating to protect it from abrasive wear and water condensation.

[Learn More]

NO2 click

0

NO2 click is a very accurate nitrogen-dioxide gas sensor Click board™, equipped with the SPEC amperometric gas sensor which electrochemically reacts with the nitrogen-dioxide (NO2).

[Learn More]

MCP16331 click

0

MCP16331 click functions as a non-inverting buck-boost voltage regulator, a type of switching mode power supply topology that combines the principles of the Buck converter (step-down) and the Boost converter (step-up) in a single circuit.

[Learn More]