SparkFunRHT03 (community library)

Summary

Name Value
Name SparkFunRHT03
Version 1.0.4
Installs 30274
License MIT
Author Jim Lindblom jim@sparkfun.com
URL https://github.com/sparkfun/sparkfun_rht03_particle_library
Repository https://github.com/sparkfun/sparkfun_rht03_particle_library.git
Download .tar.gz
All Versions 1.0.4, 1.0.3, 1.0.2

A simple library for RHT03 temperature and humidity sensor, which communicates over a 1-wire digital interface.

Example Build Testing

Device OS Version:

This table is generated from an automated build. Success only indicates that the code compiled successfully.

Library Read Me

This content is provided by the library maintainer and has not been validated or approved.

SparkFun RHT03 Particle Library

A firmware library for the SparkFun's RHT03 humidity and temperaure sensor.

RHT03

About

The RHT03 is a one-wire digital sensor that measures relative humidity from 0-100% and temperature from -40-80 deg C.

Repository Contents

  • /firmware - Source files for the library (.cpp, .h).
  • /firmware/examples - Example sketches for the library (.cpp). Run these from the Particle IDE.
  • spark.json - General library properties for the Particle library manager.

Example Usage

Create an RHT03 Object & Initialize

To begin, create an RHT03 class object. This'll often go in the global section of the code:

/////////////////////////// // RHT03 Object Creation // /////////////////////////// RHT03 rht; // This creates a RTH03 object, which we'll use to interact with the sensor

To initialize the sensor, call the begin([pin]) function, where [pin] is the Photon pin connected to the RHT03 data pin.

void setup() { ... rht.begin(D3); // Initialize an RHT03 sensor, with the data pin connected to D3. ... }

Update and Read Humidity and Temp Values

Temperature and humidity values are updated in one fell single-wire swoop. To get new values from the sensor, call update(). update() returns either 1 on success, or a negative value if it fails.

int updateRet = rht.update();

If the update succeeds, use the humidity(), tempC(), and tempF() functions to get relative humidity, celsius, and farenheit temperatures. All variables are returned as float's.

if (updateRet == 1) { float rh = rht.humidity(); float tf = rht.tempF(); float tc = rht.tempC(); }

License Information

This product is open source!

Please review the LICENSE.md file for license information.

If you have any questions or concerns on licensing, please contact techsupport@sparkfun.com.

Distributed as-is; no warranty is given.

  • Your friends at SparkFun.

Browse Library Files