element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Using the DHT11 temp and humidity sensor to measure and display the temp and humidity on an LCD screen, without using extrenal libraries.
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 8 replies
  • Subscribers 386 subscribers
  • Views 1722 views
  • Users 0 members are here
  • lcd
  • libraries
  • dht11
  • arduino
Related

Using the DHT11 temp and humidity sensor to measure and display the temp and humidity on an LCD screen, without using extrenal libraries.

Former Member
Former Member over 2 years ago

I am not supposed to use any external libraries for any of the components and the libraries used should be user generated/defined. So far i can only display the temp and humidity using downloaded/external libraries: 

#include "LiquidCrystal.h"
LiquidCrystal lcd(8,7,6,5,4,3);
int sensorPin = 0;

void setup()
{
Serial.begin(9600);
lcd.begin(16,2);
}

void loop()
{

int reading = analogRead(sensorPin);

// measure the 5v with a meter for an accurate value
//In particular if your Arduino is USB powered

float voltage = reading * 4.68;
voltage /= 1024.0;

// now print out the temperature

float temperatureC = (voltage - 0.5) * 100;
Serial.print(temperatureC);
Serial.println(" degrees C");

lcd.setCursor(0,0);
lcd.print("Temperature Value ");
lcd.setCursor(0,1);
lcd.print(" degrees C");
lcd.setCursor(11,1);
lcd.print(temperatureC);

delay(100);
}

Please help. Thanks!

  • Sign in to reply
  • Cancel
  • javagoza
    0 javagoza over 2 years ago

    DHT11 uses a single wire digital communication and you are using the DHT11 as an analog sensor but you have to use a digital input. One communication process is about 4ms. Data consists of decimal and integral parts. A complete data transmission is 40 bit, and the sensor sends higher data bit first.

    Data format: 8 bit integral RH data + 8 bit decimal RH data + 8 bit integral T data + 8 bit decimal T data + 8 bit checksum.

    If the data transmission is right, the checksum should be the last 8bit of: 8 bit integral RH data + 8 bit decimal RH data + 8 bit integral T data + 8 bit decimal T data

    Some years ago I made this post explaining how to read data from the DHT11 DHT11 Arduino Library and ThingSpeak - Hackster.io

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bidrohini
    0 bidrohini over 2 years ago

    If you are not allowed to use the DHT11.h library, you have to manually do whatever is done by the library. DHT11 uses one wire protocol. You will need OneWire.h

    docs.arduino.cc/.../one-wire

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • colporteur
    0 colporteur over 2 years ago

    Your points total suggests you are a new member. Welcome.

    Your requests describes a problem with little detail. I have some concern about the ethics of your request. 

    If the project excludes using external libraries than you will also need to find a solution to #include "LiquidCrystal.h"

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • beacon_dave
    0 beacon_dave over 2 years ago

    There is some info on creating a DHT11 library available here:

    https://link.springer.com/chapter/10.1007/978-1-4302-6838-3_4

    which may be of interest (skip to the end of the chapter.)

    It was written for an Intel Galileo MCU but may be useful if you want examples of the protocol timing in order to roll your own.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 2 years ago in reply to javagoza

    Thank you! I'll check it out.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 2 years ago in reply to bidrohini

    Thank you. I also shouldn't use the liquid crystal library.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 2 years ago in reply to colporteur

    Yes, that is true

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 2 years ago in reply to beacon_dave

    Thank you! Will have a look.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube