Practical Embedded (AutoRecovered)
Practical Embedded (AutoRecovered)
CERTIFICATE
Head of Deparment
Principal
Sr. Name of Practical /Titel Date Signature
No
1. Aim:-Introduction to Ardunio 09/01/2025
2. Aim:-To study the working of 13/01/2025
light sensor using Ardunio
3. Aim:-To study the working of 20/01/2025
Tempetrature sensor using
Ardunio
4. Aim:-To study the working of 23/01/2025
Humidity sensor using Ardunio
5. Aim:-To studty working of 01/02/2025
Ultrasonic sensor using Ardunio
Arduino Software:
The Arduino platform comes with its integrated development
environment (IDE). The Arduino IDE is a software tool that allows you to
write, compile, and upload code to the Arduino board.Key features of the
IDE include:
- Programming Language: Arduino uses a simplified version of the C/C++
programming language. It provides a set of libraries and functions
tailored for easy interaction with the hardware.
- Code Library: Arduino has a vast library of pre-written code and
functions that simplify common tasks, making it accessible to
beginners.
- Serial Monitor: The IDE includes a serial monitor that allows you to
communicate with the Arduino board and view debugging information.
- Community Support: The Arduino community is large and active,
offering forums, tutorials, and extensive documentation to help users
Circuit Digragm:-
Code: The following C++ code is used in the given case
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
digitalWrite(LED_BUILTIN, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(LED_BUILTIN, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
PRACTICAL :- 2
Aim :- To study the working of light sensor using Ardunio
Code :
int sensorValue = 0;
void setup ()
{
pinMode(A0,INPUT);
pinMode(9,OUTPUT);
Serial.begin(9600);
}
void loop()
{
sensorValue = analogRead(A0);
Serial.println('sensorValue');
analogWrite(9,map(sensorValue,0,1023,255,0));
delay(100);
}
Output :-
PRACTICAL :- 3
Aim :- To study working of Temperature sensor using Ardunio
Code :
char degree = 176;
const int sensor = A1;
void setup() {
pinMode(sensor, INPUT);
Serial.begin(9600);
}
void loop() {
int tmp = analogRead(sensor);
float voltage = (tmp * 5.0) / 1024;
Serial.print("Celsius: ");
Serial.print(tmpCel);
Serial.println(degree);
delay(1000);
}
Output:-
PRACTICAL :-4
Code:-
const int analogIn = A1;
int humiditySensorOutput = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
humiditySensorOutput = analogRead(analogIn);
int humidityPercentage = map(humiditySensorOutput, 0,
1023, 10, 70);
Serial.print("Humidity: ");
Serial.print(humidityPercentage);
Serial.println("%");
delay(5000);
}
Output:-
PRACTICAL :- 5
Aim :- To study the working of Ultrasonic sensor using
Ardunio
Code :-
const int trigPin = 9;
const int echoPin = 1;
long duration;
int distance;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
delay(1000);
}
Output :
PRACTICAL :-6
Aim :- To control the motion of a Servo motor using Ardunio
Code :-
#include <Servo.h>
Servo servoBase;
void setup() {
servoBase.attach(A1);
}
void loop() {
for (int i = 0; i <= 180; i += 10) {
servoBase.write(i);
delay(2000);
}
}
Ouput :-
PRACTICAL :-7
Aim:- To detect the motion of an object using Infrared
motion sensor
Code :-
int sensorState = 0;
void setup()
{
pinMode(2, INPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
sensorState = digitalRead(2);
if (sensorState == HIGH) {
digitalWrite(LED_BUILTIN, HIGH);
} else {
digitalWrite(LED_BUILTIN, LOW);
}
delay(10);
}
Output :-
PRACTICAL :-8
Aim :- To detect smoke/fire using Gas sensor
Code :-
int LED = A1;
const int gas = 0;
int MQ2pin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
float sensorValue,MQ2pin;
sensorValue = analogRead(MQ2pin);
if(sensorValue>= 470){
digitalWrite(LED,LOW);
Serial.print(sensorValue);
Serial.println(" |SMOKE DETECTED");
}
else{
digitalWrite(LED,HIGH);
Serial.println("Sensor Value: ");
Serial.println(sensorValue);
}
delay(1000);
}
Output :-