send dht11 data from arduino to another arduino and print to lcd

hi guys . .

i've two arduinos, dht11, and lcd
the consept is to print dht11 data from arduino 1 to arduino 2 lcd . .

  • read dht11 ( done )
  • arduino 1 and arduino 2 connected ( done )
  • print on lcd arduino 2 ( problem )

tx --- rx
rx --- tx

arduino 1

#include <DHT.h>
#define DHTPIN 8
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
dht.begin();
Serial.begin(9600);
}

void loop() {
float kelembaban = dht.readHumidity();
float suhu = dht.readTemperature();
delay(400);
Serial.print(temperature);
Serial.print("*C");
Serial.print(" || ");
Serial.print(humidity);
Serial.println("%");

}
}

arduino 2

#include <LiquidCrystal.h>
LiquidCrystal lcd(6, 7, 2, 3, 4, 5);

int dat;

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

void loop()
{
if (Serial.available()){
dat = Serial.read();
Serial.write(dat);
}
lcd.setCursor(0, 0);
lcd.print("Suhu||Kelembapan");

lcd.setCursor(0, 1);
lcd.print(dat);

}

helps :confused:

Hi Fadli, - I have just posted three ways for communicating data (temperature from a Dallas DS18B20) from one Arduino via standard serial, or Soft serial, or I2C serial communication to a secons Arduino. Display is on a 128x32 OLED, but that is secondary matter. Please visit

Wiring diagrams and sketches in the article!
Succes, Floris

Hi Fadli, the examples on theSolaruniverse.wordpress.com site deal with sending one float variable from Arduino 1 to Arduino 2.

What you want is to send two float variables, i.e. suhu and kelembapan, from Arduino 1 to Arduino 2
As serial communication only sends ASCII characters you must 'code' the floats into a string of ASCIi characters, transmit the string and in the receiving Arduino split the string, decode the two substrings into floats and voila - you got what you want.

Now reality. I am a newbie myself, but with help from posts on this fantastic forum I managed to write two sketches that work with Arduino 1 with a DHT11 sensor on pin 10, and with Arduino 2 with a 16x2 LCD display - note the wiring: lcd(12, 11, 5, 4, 3, 2)

connect TX of Arduino 1 with RX of Arduino 2 via an interruptor switch
connect RX of Arduino 1 with TX of Arduino 2 via an interruptor switch
(set switch in 'disconnected' position during uploads of sketches - or else you will get gibberish on the LCD display)
Do not forget to connect GND of both Arduinos

good luck.

Fahli_Arduino_LCD_serial.ino (2.72 KB)

Fahli_Arduino_DHT11_serial.ino (1.83 KB)