0% found this document useful (0 votes)
26 views7 pages

iot 13,14

Uploaded by

adityaharbade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views7 pages

iot 13,14

Uploaded by

adityaharbade
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Assignment No.

13: Demonstration of reading analog voltage


Aim: To demonstrate reading analog voltage using Arduino Uno
Objectives:
1. To understand the details electrical parameter: analog voltage.
2. To develop & write reading analog voltage program using Arduino
Uno platform and demonstrate it.
3. To implement your ideas and programming coding skill using

Software and hardware required:


1. Arduino IDE
2. FCT make Arduino Circuit Board
Diagram:

Reading analog voltage with LCD


Procedure:

analog input voltage and LCD display.


1. Connect the Arduino Uno board to the PC through USB cable.
2. Start Arduino IDE from PC and open new Sketch and the program/code
for that and save as analog_volt.
3. Verify/Compile the program and Upload the code into Arduino Uno.
4. Make necessary connections according diagram.
5. Observe the output running on the board.
6. Repeat the procedure for other programs to implement your ideas and
programming coding skill.
Program:
/*
ReadAnalogVoltage
Reads an analog input on pin 0, converts it to voltage, and prints the
result to the Serial Monitor also on LCD.
Graphical representation is available using Serial Plotter (Tools >
Serial Plotter menu).
Attach the center pin of a potentiometer to pin A0, and the outside
pins to +5V and ground.

*/
#include<LiquidCrystal.h>
//pins of the LCD. (RS, E, D4, D5, D6, D7) LiquidCrystal
lcd(6, 7, 5, 4, 3, 2);

// the setup routine runs once when you press reset:


void setup() {
// initialize serial communication at 9600 bits per
second: Serial.begin(9600); lcd.begin(16,2); delay(500);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a
voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage); lcd.setCursor(0,0);
lcd.print("*Analog Volt**");
lcd.setCursor(0,1); lcd.print(voltage);
lcd.print("Volt"); delay(1000); //Delay of 1
second
}
Assignment No. 14: Demonstration of Temperature sensor.
Aim: To demonstrate Temperature sensor application using Arduino Uno
Objectives:
1. To understand the basics of Temperature sensor LM35 working. 2.
To develop & write Temperature sensor program using Arduino Uno
platform and demonstrate it.
3. To implement your ideas and programming coding skill using

Software and hardware required:


1. Arduino IDE
2. FCT make Arduino Circuit Board
Diagram:

Temperature Sensor with LCD and Indicators (LED & Buzzer )


Procedure:
LM35 .LED & LCD Arrays

1. Connect the Arduino Uno board to the PC through USB cable.


2. Start Arduino IDE from PC and open new Sketch and the program/code
for that and save as Temp_sensor.
3. Verify/Compile the program and Upload the code into Arduino Uno.
4. Make necessary connections according diagram.
5. Observe the output running on the board.
6. Repeat the procedure for other programs to implement your ideas and
programming coding skill.

Program:
#include<LiquidCrystal.h>
//pins of the LCD. (RS, E, D4, D5, D6, D7) LiquidCrystal
lcd(6, 7, 5, 4, 3, 2);
const int sensor=A0; // Assigning analog pin A1 to variable 'sensor'

float
int Red_LED = 9;
int Green_LED = 10;

void setup()
{
pinMode(Red_LED, OUTPUT);
pinMode(Green_LED, OUTPUT);
pinMode(BUZ, OUTPUT);
pinMode(sensor,INPUT); // Configuring pin A1 as input
Serial.begin(9600);
lcd.begin(16,2);
delay(500);
}
void loop()
{

tempc = (vout*500)/1023;
//vout=vout* 0.48828125;
lcd.setCursor(0,0);
tempc; //variable to store temperature in degree Celsius float

tempf; //variable to store temperature in Fahreinheit float vout;


//temporary variable to hold sensor reading int BUZ= 8; char sign

= 223; vout=analogRead(sensor);

lcd.print("***Tempeature***");
lcd.setCursor(0,1)
; lcd.print(tempc);
lcd.print(sign);
lcd.print("C ");
lcd.print(" ");
lcd.print((tempc*
1.8)+32);
lcd.print(sign);

lcd.print("F ");
delay(1000); //Delay of 1 second for ease of viewing in serial monitor

if (tempc > 32)


{
digitalWrite(Red_LED, HIGH);
digitalWrite(Green_LED, LOW);
digitalWrite(BUZ, HIGH);
}
else if (tempc < 32)
{
digitalWrite(Green_LED, HIGH);
digitalWrite(Red_LED, LOW);
digitalWrite(BUZ, LOW);
}
}

You might also like