Introduction: Arduino Room Status

Picture of Arduino Room Status

Today as the first day of the 21 year of my life! I wanted to show you how to connect Arduino to sensors, fetch data and show 'em on 16x2 LCD - as an example you can get your room's
temperature and light density and view them on lcd.

Step 1: What You Need?

Picture of What You Need?

1. Smile :-)

2. Arduino Board (here I used UNO but feel free to choose your own)

3. LM35 Temperature Sensor

4. LDR

5. 2.2 K ohm Resistor (x1)

6. 10 K ohm Potentiometer

7. 16x2 Line LCD Display

7. Bread Board

--------------------------------- Softwares ----------------------------------------------

1. Arduino IDE

Step 2: Wiring

Picture of Wiring

The circuit:
LCD RS pin to digital pin 12

LCD Enable pin to digital pin 11

LCD D4 pin to digital pin 5

LCD D5 pin to digital pin 4

LCD D6 pin to digital pin 3

LCD D7 pin to digital pin 2

LCD R/W pin to ground

LCD VSS pin to ground

LCD VCC pin to 5V

10K Potentiometer: One of the ends to +5 Volts and the other to the Ground (GND), Connect LCD VO middle pin of the potentiometer.

LM35: Connect Arduino 5 Volt to Pin 1 (Based on the Picture), Connect Pin 2 to A1 (Analog In) Arduino Board, Connect Pin 3 to GND.

Connect LDR and 2.2k Resistor in series. Connect LDR pin to 5 Volt, Common Pin (between LDR and 2.2k Resistor) to Arduino A0 Pin and Connect 2.2k Resistor float pin to GND.

Step 3: Arduino Code

Picture of Arduino Code

Copy the code below to new arduino document. Select your Board and Port, then see the results.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

lcd.begin(16, 2);

}

void loop() {

double a = analogRead(A0);

a = (a / 1023)*100;

String str;

str=String(a);

lcd.setCursor(0, 0);

lcd.print(" "); //SIMPLE WAY TO CLEAR LCD

lcd.setCursor(0, 0);

lcd.print("LUX: " + str + "%");

a = analogRead(A1);

str=String(a);

lcd.setCursor(0, 1);

lcd.print(" ");

lcd.setCursor(0, 1);

lcd.print("TEMP: " + str);

delay(1000);

}

Step 4: Ready, Set, Done

Picture of Ready, Set, Done

Now you're all set. Give it a go. Here you can use other analog sensors too. Make your own and publish it.

Wish you good luck.

Comments