M4 r5 iot
Q.1 Write a
program to interface LCD with Arduino board and display “ o level nielit"
on it.
Q.2
Arduino
program to Design a night lamp using a
photodiode and a LED and find out the
time delay associated with turning the lamp on and off.
Q.3
Arduino
program to interface gas sensor to detect the gas
cont int
gaspin=A0;
void
setup(){
Serial.begin(9600);}
void
loop(){
int
gassvalue=analogRead(gaspin);
serial.println(gassvalue);
delay(500);}
viva
iiot used
for
iot
components
microcontroller
used in arduino uno
what is the
work of setup()
O
level Iot m4 r 5 practical
Q1 Write an Arduino program to read temperature from a DHT11 sensor and
display it on the Serial Monitor every 2 seconds.
#include<DHT.h>
DHT dht(2,DHT11);
void setup()
Serial.begin(9600);
dht.begin();}
void loop(){
float t =dt.readTemperature();
if (!isnan(t))
serial.println("temp:",+string(t)+"c");
delay(2000);
}
Q 2 Arduino program to create automatic street
light control
by using LDR sensor
int
ldrpin=A0;
int
lightpin=8;
void
setup(){
pinMode(lightpin,OUTPUT);
pinMode(ldrpin,INTPUT);
}
int
ladrvalue=analogRead(ldrpin);
if(ladrvalue<500);
digitalWrite(lightpin,HIGH);
else
digitalWrite(lightpin,LOW);
}
Q
3 Write a program to interface a temperature
sensor (LM35)
and water Nozzle with the Arduino.
int tempin=A0
int nozzlepin=8;
void setup(){
pinMode(nozzelpin,OUTPUT);
}
int
raw=analogRead(tempin);
float tempc=
raw*0.488
if (tempc> 30)
digitalWrite(nozzelpin,HIGH);
else
digitalWrite(nozzelpin,LOW);
delay(1000);}
viva
name any
three sensors
name comman
communicatin protocol in iot
what is
real time operating system(RTOS)
what is
cloud computing in iot
M4 r5 iot practical
write
arduino program how to use a Piezo element to detect vibration.
Write a
program to interface AC with arduino board using Wi-Fi signals to on of the
delay of 1 second
Write a
program to interface security password with arduino board to so green light for
correct password and red light for incorrect password
Viva m4
How many
analog pin Arduino uno
Name any
four Arduino project component
Name the
sensor that use in street light project
What is
motivation
what is Self-motivation?
Q 1 Write a program to interface a button and an
RGB LED with the Arduino. On each button press, the RGB LED should change its
color in the
# define button=7
#define red=11
#define green=9
#define blue =10
Int colourstate=0;
Int lastbuttonstate=HIGHT;
Void setup()
{
pinMode(button,INPUT);
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}
Void loop()
{
Int buttonstate=digitalRead(button);
If(buttonstate==LOW&& lastbuttonstate==HIGH)
Colourstate=( colourstate+1)%3;
setColor(colourstate)
delay(200);
}
Lastbuttonstate= buttonstate
}
Void setcolor(int state)
{
digitalWrite(red,LOW)
digitalWrite(green,LOW)
digitalWrite(blue,LOW)
if(state==0)
{
digitalWrite(red,HIGH)
}
else if (state==1)
{ digitalWrite(green,HIGH)
}
else if(state==2)
{ digitalWrite(blue,HIGH)
}
}
Q 2 Write a program to interface LEDs at pins
10,11,12,13 and buttons at pins 7,8. When first time button at pin 7(increment
button) is pressed first LED at pin 10 is switched on, when second time button
is pressed the next LED at 11 is switched on. Similarly, when the button at pin
8 (decrement button) is pressed the LEDs are switched off sequentially.
int count=0;
void setup()
{
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
pinMode(8,INPUT);
pinMode(7,INPUT);
}
void loop()
{
Int p1,p2 ;
p1=digitalRead(8)
p2=digitalRead(7)
if(p1==HIGH &&
count<4)
{
count++;
}
If(p2==HIGT &&
count>0)
{
Count--;
}
If(count==0)
{
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
}
else if(count==1)
{ digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
}
else if(count==2)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(10,LOW);
}
else if(count==3)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
}
else if(count==4)
{
digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
}
}
Write a program to print “Hello World!” to the
LCD (Liquid Crystal Display) and shows the time in seconds since the Arduino was reset.
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
void setup()
{
lcd.begin(16,2);
lcd.print(“hello word”);
}
void loop()
{
lcd.setCursor(0,1);
lcd.print(“time in
millis sec”,milils())
delay(1000)
}
Viva
IIOT full
form ??
Who is the
father of iot
2 example
of close loop control system ?
Name any
two sensors ?
Name any
two actuator ?
M4 R5 IOT
Design
a night lamp using a LDR and a LED using Arduino Uno and find out the time
delays associated in keeping ON the lamp
Or
A smart street light system that automatically turns the
led on when it gets dark.
int ldrpin=A0
int
ledpin=13;
int
threshold=400
void
setup()
{
pinMode(ledpin,OUTPUT)
pinMode(ldrpin,INPUT)
Serial.begin(9600)
}
void loop()
{
int
ldrstatus=analogRead(ldrpin);
Serial.println(ldrstatus);
If(ldrstatus<
threshold)
{
digitalWrite(ledpin,HIGH);
}
else
{
digitalWrite(ledpin,LOW);
}
delay(200);
}
Arduino
program to interface the sensor and led
Write
a program to interface a temperature sensor (LM35) and water Nozzle with the
Arduino.
int lm35pin=A0;
int relaypin=8
float temhigh=35.0
float temlow=32.0
void setup()
{
pinMode (relaypin,OUTPUT);
digitalWrite(relaypin,HIGH);
Serial.begin(9600);
Serial.println(“LM35 water nozzle control intialized”);
}
Void loop()
{
int rawADC=analogRead(lm33pin);
float voltage=( rawADC *500.0)/1024.0;
float tempC= voltage/10.0;
Serial.print(tempC);
if(tempC>= temhigh)
digitalWrite(relaypin,LOW);
Serial.println(“status : high temp detected water nozzle
on”)
}
else if(tempC<= temlow){
digitalWrite(relaypin,HIGH);
Serial.println(“status :normal temp detected water nozzle
oFF”)}
}
delay(1000);}
viva
name any
three iot application ?
what is
arduino ?
name any
four types of sensors ?
what is
motivation ?
what is
IOT?
1 .write arduino program how to use a Piezo
element to detect vibration.
Int piezo_pin=A0
Int led_pin = led_builtin
Int vibration_threshold =80
Void setup()
{
Serial.begin(9600);
pinMode(led_pin,OUTPUT);
digitalWrite(led_pin,LOW);
}
Void loop()
{
Int pezoreading= analogRead(piezo_pin);
If(pezoreading>= vibration_threshold)
digitalWrite(led_pin,HIGH);
serial.println(pezoreading)
delay(100);
}
delay(10)
}
2 .Smart
Pedestrian Traffic Light System
Int traffic_red=10;
Int traffic_yellow=9;
Int traffic_green=8;
Int Pedestrain_led=7;
Int button_pin=2;
Void setup()
{
pinMode(traffic_red,OUTPUT);
pinMode(traffic_yellow,OUTPUT);
pinMode(traffic_green,OUTPUT);
pinMode(Pedestrain_led,OUTPUT);
pinMode(button_pin,INPUT);
}
void loop()
{
Int buttonstete=digitalRead(button_pin);
If(buttonstate==HIGH)
{runCrossingSequence();}
}
void runCrossingSequence()
{
delay(1000);
digitalWrite(traffic_green,LOW);
digitalWrite(traffic_yellow,HIGH);
delay(2000);
digitalWrite(traffic_yellow,LOW);
digitalWrite(traffic_green,HIGH);
digitalWrite(Pedestrain_led,HIGH);
delay (5000);
for (int
i=0;i<3;i++)
{
digitalWrite(Pedestrain_led,LOW);
delay(250);
digitalWrite(Pedestrain_led,HIGH);
delay(250);
}
digitalWrite(Pedestrain_led,LOW);
digitalWrite(traffic_red,LOW);
digitalWrite(traffic_green,HIGH);
delay(2000);
}
Viva
What are the
types of control system ?
What is mechanical
control system ?
What sensor ?
What is
actuator ?
What is
microcontroller ?
0 Comments