All Projects → winlinvip → Simpledht

winlinvip / Simpledht

Licence: mit
Simple, Stable and Fast Arduino Temp & Humidity Sensors for DHT11 and DHT22. http://learn.adafruit.com/dht

Projects that are alternatives of or similar to Simpledht

Dmxusb
DMXUSB emulates an ENTTEC-compatible DMXKing USB to DMX serial device with one, two, or n universes.
Stars: ✭ 66 (-40.54%)
Mutual labels:  arduino, arduino-library
Button2
Arduino Library to simplify working with buttons. It allows you to use callback functions to track single, double, triple and long clicks. It also takes care of debouncing.
Stars: ✭ 109 (-1.8%)
Mutual labels:  arduino, arduino-library
Micronmea
A compact Arduino library to parse NMEA sentences.
Stars: ✭ 66 (-40.54%)
Mutual labels:  arduino, arduino-library
Tm16xx
Arduino TM16xx library for LED & KEY and LED Matrix modules based on TM1638, TM1637, TM1640 and similar chips. Simply use print() on 7-segment and use Adafruit GFX on matrix.
Stars: ✭ 61 (-45.05%)
Mutual labels:  arduino, arduino-library
Tft espi
Arduino and PlatformIO IDE compatible TFT library optimised for the STM32, ESP8266 and ESP32 that supports different driver chips
Stars: ✭ 1,215 (+994.59%)
Mutual labels:  arduino, arduino-library
Ws2812fx
WS2812 FX Library for Arduino and ESP8266
Stars: ✭ 1,113 (+902.7%)
Mutual labels:  arduino, arduino-library
Liquidcrystal pcf8574
A library for driving LiquidCrystal displays (LCD) by using the I2C bus and an PCF8574 I2C adapter.
Stars: ✭ 67 (-39.64%)
Mutual labels:  arduino, arduino-library
Sslclient
🔒Add SSL/TLS functionality to any Arduino library
Stars: ✭ 45 (-59.46%)
Mutual labels:  arduino, arduino-library
Ultrasonic
Minimalist library for Ultrasonic Module HC-SR04, PING))) and Seeed SEN136B5B to Arduino
Stars: ✭ 77 (-30.63%)
Mutual labels:  arduino, arduino-library
Aunit
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test. Used with AUniter or EpoxyDuino for continuous builds.
Stars: ✭ 73 (-34.23%)
Mutual labels:  arduino, arduino-library
Segacontroller
Arduino library to read Sega Genesis (Mega Drive) and Master System (Mark III) controllers.
Stars: ✭ 55 (-50.45%)
Mutual labels:  arduino, arduino-library
Beelan Lorawan
A LoRaWAN library for compatible arduino board
Stars: ✭ 87 (-21.62%)
Mutual labels:  arduino, arduino-library
Gem
Good Enough Menu for Arduino
Stars: ✭ 54 (-51.35%)
Mutual labels:  arduino, arduino-library
Dmxserial2
An Arduino library for sending and receiving DMX RDM packets.
Stars: ✭ 65 (-41.44%)
Mutual labels:  arduino, arduino-library
Cayennelpp
Library for Arduino compatible with Cayenne Low Power Payload
Stars: ✭ 51 (-54.05%)
Mutual labels:  arduino, arduino-library
Nintendoextensionctrl
Arduino library for communicating with Nintendo extension controllers
Stars: ✭ 67 (-39.64%)
Mutual labels:  arduino, arduino-library
Sigmadsp
A versatile Arduino library for interfacing with the ADAU1701 audio DSP
Stars: ✭ 30 (-72.97%)
Mutual labels:  arduino, arduino-library
Fram mb85rc i2c
Arduino library for I2C FRAM - Fujitsu MB85RC & Cypress FM24, CY15B
Stars: ✭ 41 (-63.06%)
Mutual labels:  arduino, arduino-library
Ramp
Arduino Interpolation Library
Stars: ✭ 72 (-35.14%)
Mutual labels:  arduino, arduino-library
Fpm
Arduino library for the R30x/ZFMxx/FPMxx optical fingerprint sensors
Stars: ✭ 79 (-28.83%)
Mutual labels:  arduino, arduino-library

SimpleDHT

Description

An Arduino library for the DHT series of low-cost temperature/humidity sensors.

You can find DHT11 and DHT22 tutorials here.

Installation

First Method

image

  1. In the Arduino IDE, navigate to Sketch > Include Library > Manage Libraries
  2. Then the Library Manager will open and you will find a list of libraries that are already installed or ready for installation.
  3. Then search for SimpleDHT using the search bar.
  4. Click on the text area and then select the specific version and install it.

Second Method

  1. Navigate to the Releases page.
  2. Download the latest release.
  3. Extract the zip file
  4. In the Arduino IDE, navigate to Sketch > Include Library > Add .ZIP Library

Usage

To use this library:

  1. Open example: Arduino => File => Examples => SimpleDHT => DHT11Default
  2. Connect the DHT11 and upload the program to Arduino.
  3. Open the Serial Window of Arduino IDE, we got the result as follows.
=================================
Sample DHT11...
Sample OK: 19 *C, 31 H
=================================
Sample DHT11...
Sample OK: 19 *C, 31 H
=================================

Remark: For DHT11, no more than 1 Hz sampling rate (once every second). Remark: For DHT22, no more than 0.5 Hz sampling rate (once every 2 seconds).

Features

  • Simple

    Simple C++ code with lots of comments.

  • Stable

    Strictly follow the standard DHT protocol.

  • Fast

    Support 0.5HZ(DHT22) or 1HZ(DHT11) sampling rate.

  • Compatible

    SimpleDHT sensor library is compatible with multiple low-cost temperatures and humidity sensors like DHT11 and DHT22. A few examples are implemented just to demonstrate how to modify the code for different sensors.

  • MIT License

    DHT sensor library is open-source and uses one of the most permissive licenses so you can use it on any project.

    • Commercial use
    • Modification
    • Distribution
    • Private use

Functions

  • read()
  • setPinInputMode()
  • setPin()
  • getBitmask()
  • getPort()
  • levelTime()
  • bits2byte()
  • parse()
  • read2()
  • sample()

Sensors

Examples

This library including the following examples:

  1. DHT11Default: Use DHT11 to sample.
  2. DHT11WithRawBits: Use DHT11 to sample and get the 40bits RAW data.
  3. DHT11ErrCount: Use DHT11 to sample and stat the success rate.
  4. DHT22Default: Use DHT22 to sample.
  5. DHT22WithRawBits: Use DHT22 to sample and get the 40bits RAW data.
  6. DHT22Integer: Use DHT22 to sample and ignore the fractional data.
  7. DHT22ErrCount: Use DHT22 to sample and stat the success rate.
  8. TwoSensorsDefault: Use two DHT11 to sample.

One of the SimpleDHT examples is the following:

  • DHT22Integer

#include <SimpleDHT.h>

int pinDHT22 = 2;
SimpleDHT22 dht22(pinDHT22);

void setup() {
  Serial.begin(115200);
}

void loop() {

  Serial.println("=================================");
  Serial.println("Sample DHT22...");

  byte temperature = 0;
  byte humidity = 0;
  int err = SimpleDHTErrSuccess;
  if ((err = dht22.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
    Serial.print("Read DHT22 failed, err="); Serial.print(SimpleDHTErrCode(err));
    Serial.print(","); Serial.println(SimpleDHTErrDuration(err)); delay(2000);
    return;
  }

  Serial.print("Sample OK: ");
  Serial.print((int)temperature); Serial.print(" *C, ");
  Serial.print((int)humidity); Serial.println(" RH%");

  delay(2500);
}

Links

  1. adafruit/DHT-sensor-library
  2. Arduino #4469: Add SimpleDHT library.
  3. DHT11 datasheet and protocol.
  4. DHT22 datasheet and protoocl.

Winlin 2016.1

Contributing

If you want to contribute to this project:

  • Report bugs and errors
  • Ask for enhancements
  • Create issues and pull requests
  • Tell others about this library
  • Contribute new protocols

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Credits

The author and maintainer of this library is Winlin [email protected].

Based on previous work by:

  • t-w
  • O. Santos
  • P. H. Dabrowski
  • per1234
  • P. Rinn
  • G. M. Vacondio
  • D. Faust
  • C. Stroie
  • Samlof
  • Agha Saad Fraz

License

This library is licensed under MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].