Temperature and humidity displayed on the LCD12864

Temperature and humidity displayed on the LCD12864

Adeept DHT11 is a composite digital thermal sensor that integrates temperature and humidity detection. It can convert the temperature and humidity analog values into digital values via corresponding sensitive components and built-in circuits, which can be directly read by computer or other data collecting devices.
In this experiment, by programming the Arduino, we read the temperature and humidity data collected by the DHT11 module by pin D2 of the Arduino board and display it on the LCD 12864.
– 1 * Adeept UNO R3 Board
– 1 * LCD 12864 Module
– 1 * DHT-11 Sensor Module
– 1 * Breadboard
– 1 * USB Cable
– 1 * 3-Pin Wires
– 2 * Male To Male Jumper Wires
– 8 * Male To Female Jumper Wires

Experimental Principle 

SPI12864 SPI communication timing diagram

The Adeept Fritzing image:

Pin definition:

The schematic diagram:

Experimental Procedures
Step 1: Build the circuit

Step 2: Program  AdeeptDHT11LCD12864.ino

Adeept_DHT11 Library Link:Adeept_DHT11

File name:   AdeeptDHT11LCD12864.ino
Website: www.adeept.com
E-mail: support@adeept.com
Author: Tom
Date: 2017/01/04 
#include "AdeeptLCD12864RSPI.h"
#include <dht11.h>
#define AR_SIZE( a ) sizeof( a ) / sizeof( a[0] )
dht11 DHT11;
#define DHT11PIN 2  //Set the digital 2 to the S pin

unsigned char show0[]="DHT11 sensor";         //Test the code
unsigned char show1[]="Humi:       %";     
unsigned char show2[]="Temp:       C";   
unsigned char show3[]=" www.adeept.com";          

void setup()
    LCDA.Initialise(); // The screen is initialized
 // LCDA.CLEAR();//Clear screen
    LCDA.DisplayString(0,1,show0,AR_SIZE(show0));//Display: DHT11 sensor
    LCDA.DisplayString(1,1,show1,AR_SIZE(show1));//Display: Humi:     %
    LCDA.DisplayString(2,1,show2,AR_SIZE(show2));//Display: Temp:     C
    LCDA.DisplayString(3,0,show3,AR_SIZE(show3));//Display: www.adeept.com

void loop()
    double temphumidity = 0;
    double tempTemperature = 0;
    char strhumidity[5];
    char strTemperature[5];
    double chk = DHT11.read(DHT11PIN);
    temphumidity = DHT11.humidity;
    dtostrf(temphumidity,5,2,strhumidity);//Converts a floating-point number to a string
    LCDA.DisplayString(1,4,(unsigned char *)strhumidity,6);//Display humidity data

    tempTemperature = DHT11.temperature;
    dtostrf(tempTemperature,5,2,strTemperature);//Converts a floating-point number to a string
    LCDA.DisplayString(2,4,(unsigned char *)strTemperature,6);//Display temperature data


Step 3: Compile and download the sketch to the UNO R3 board.


Leave a Reply