Back to Arduino Step By Step Course

Lesson 28: DHT11 Temperature Sensor with TM1637 Display | Arduino Step by Step Course

If you don't like to see ads while video is being played you can purchase this course for $200 from Udemy or purchase YouTube premium Here

Please download required files for this code

Part 3: Temperature Sensor

In this lesson we learn how to use DHT11 to measure temperature and display it on TM1637 LED display.


  /*
 * Robojax Arduino Step By Step Course 
  * Lesson 28 DHT11 with TM1637
 * This is the Arduino code for TM1637 4 digits display.
 *  * 
   Please watch video instruction here https://youtu.be/C-1iaCPzNtU
 This code is available at http://robojax.com/course1/?vid=lecture11
 
with over 100 lectures Free On  YouTube Watch it here http://robojax.com/L/?id=338
Get the code for the course: http://robojax.com/L/?id=339 


 * Date: Dec 06, 2017, in Ajax, Ontario, Canada
 
 * Original code from https://github.com/avishorp/TM1637
 * Modified for Robojax video on Dec 06, 2017

 */
#include <dht11.h>

dht11 DHT11; // create object of DHT11
#define dhtpin 2 // set the pin to connect to DHT11

 // start of settings of TM1637 LED display
#include <Arduino.h>
#include <TM1637Display.h>

// Module connection pins (Digital Pins)
#define CLK 2
#define DIO 3

TM1637Display display(CLK, DIO);
uint8_t blank[] = { 0x0, 0x0, 0x0, 0x0 };// blank value for all digits
 
// The amount of time (in milliseconds) between tests
#define TEST_DELAY   2000
// start of settings of TM1637 LED display



void setup()
{
	//Robojax Step By Step Arduono Course YouTube Watch it here http://robojax.com/L/?id=338
 Serial.begin(9600);// setting up serial monitor
   display.setBrightness(0x0f); 
   
}

void loop()
{
	//Robojax Step By Step Arduono Course YouTube Watch it here http://robojax.com/L/?id=338
DHT11.read(dhtpin);// initialize the reading
  int humidity = DHT11.humidity;// get humidity
//code for Robojax.com video
   Serial.print(getTemp('C'));
   Serial.print("C ");
   Serial.print(getTemp('F'));
   Serial.print("F ");
   Serial.print(getTemp('K'));
   Serial.print("K ");
   Serial.print(" humidity:");
   Serial.print (humidity);
   Serial.print("% ");
   Serial.println();
 delay(500);  


  display.setSegments(blank);
  display.showNumberDec(23, false, 2,1);
  delay(TEST_DELAY);
  
  display.setSegments(data);
  display.showNumberDec(153, false, 3, 1);
  delay(TEST_DELAY);

  display.setSegments(data);
  for(int i=0; i<=500; i++)
  {
    display.showNumberDec(i);
  }

}

   

The least I expect from you is to thumb up the video and subscribe to my channel. I appriciate that. .I have spent months making these lectures and writing code. You don't lose anything by subscribging to my channel. Your subscription is stamp of approval to my videos and more people can find them and in it turn it helps me. Thank you

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal

**** AFFILIATE PROGRAM **** We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.