Want to display the time and the temperature in LCD 1602

Hey Guys,

Looking for help with a project.

Basically, I want to display both the time and the temperature on an LCD 1602.

Modules that I'm using for this project:

  1. Arduino Uno
  2. Temperature and Humidity Sensor DHT11
  3. RTC Module DS1302
  4. LCD 1602

Kindly mention which pins I have to connect to and please make a code for this project.
(I cant really find any video where they are using these specific modules)

Thanks
Pranav

Hello pranavrarduino

Welcome to the worldbest Arduino forum ever.

This is a nice project to get started.

Keep it simple and stupid firstly.
Follow the example code that comes with the library or
run some tutorials for the hardware selected.
If you are happy with the results of the tutorials you can merge these to your project.

Have a nice day and enjoy coding in C++.

1 Like

Hey Paul,

I have tried all those tutorials but I'm not sure how to merge codes together.

Take a search engine of your choice and ask the WWW for ' merge arduino files ' to collect some data to be sorted out to get the needed information.

But I can't show the data from the temperature sensor and the rtc module.

You'll need to explain that.

#include <dht.h>
#include <DS1302.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(39,16,2); // 0x27 ou 39
DS1302 rtc(RST_PIN, IO_PIN, SCK_PIN);
dht DHT;

void setup(){

lcd.init(); //
lcd.backlight(); //

rtc.halt(false);
rtc.writeProtect(false);

}

void loop(){
DHT.read11(dht_dpin);
DHT.read11
lcd.setCursor(0, 1);
lcd.print((float)DHT.humidity,0);
lcd.print("%");
lcd.print((float)DHT.temperature, 0);
lcd.print((char)223);
lcd.println("C ");
lcd.setCursor(8, 1);
lcd.print(rtc.getTimeStr());

lcd.setCursor(12, 0);
lcd.print(rtc.getDOWStr(FORMAT_SHORT));

lcd.setCursor(1,0);
lcd.print(rtc.getDateStr(FORMAT_SHORT));

delay (1000);
}

Define a DHT pin

#include <dht.h>
dht DHT;
#define dht_dpin 5 // 5 for example

Define RST_PIN, IO_PIN and SCK_PIN

#define RSTpin 2
#define IOpin 3
#define SCLKpin 4
DS1302 rtc(2, 3, 4);

Hey xfpd,

Do you have any idea what this error code means?

#include <driver/gpio.h>
^~~~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: exit status 1

The line above this line gives the error... but it looks like you have incomplete or outdated IDE support files.

This project uses that hardware and has full source and wiring diagrams:

1 Like

Getting a display on a 1602 is not straighforward. You need to get the right library and the right settings for your particular unit.

You could help us by providing links to the source of each of your bits of hardware, so we know EXACTLY what you are using.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.