IIOT Prints
IIOT Prints
IIOT Prints
2024-25]
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
Serial.begin(9600);
void loop() {
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.println(" C");
digitalWrite(BUZZER_PIN, HIGH);
} else {
digitalWrite(BUZZER_PIN, LOW);
delay(500);
Circuit Diagram –
Conclusion –
3. Breadboard Layout:
Use the breadboard to make connections more organized and ensure stable connections.
Insert the PIR sensor, LED, and resistor into the breadboard and make connections according
to the wiring instructions above.
1. Build the Circuit: Assemble the circuit on a breadboard following the wiring instructions.
2. Upload and Run the Code: Upload the provided code to the Arduino using the Arduino IDE
and start the program.
When motion is detected within the PIR sensor’s field of view, the LED should light up, and
the serial monitor should display "Motion detected!"
When no motion is detected, the LED will turn off, and the serial monitor will display "No
motion detected."
Source Code –
const int ledPin = 13; // LED output pin (built-in on many Arduino boards)
void setup() {
void loop() {
Serial.println("Motion detected!");
} else {
Serial.println("No motion");
Circuit Diagram –
Conclusion –
This experiment demonstrates the integration of a PIR sensor with an Arduino to create a basic
motion detection system. The use of a PIR sensor, LED, resistor, and Arduino provides a
comprehensive understanding of digital input-output operations and practical circuit design.
Write the Arduino code to read temperature data from the TMP sensor.
Develop logic to control the relay based on temperature readings and optimization criteria.
Implement algorithms to monitor energy usage and adjust device operation accordingly.
Use serial communication to output data for real-time monitoring and analysis.
Calibrate the temperature sensor and verify that the relay controls the light bulb and motor
accurately.
Analyze the data collected during tests to evaluate the performance of the optimization
algorithms.
Adjust the algorithms as needed to improve energy efficiency and system response.
5. Documentation:
Prepare a report on the energy monitoring and optimization performance, including any
observed improvements in efficiency.
Source Code –
float x,y,z,temp;
void setup()
// pinMode(8, INPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(A5, INPUT);
pinMode(A4, INPUT);
Serial.begin(9600);
void loop()
// x= digitalRead(8);
y= analogRead(A5);
z= analogRead(A4);
Serial.println(x);
Serial.println(y);
Serial.println(z);
temp = temp * 5;
//if ( (x>0) )
//{
if ((y<550)&&(temp>30))
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
else if((y<550)&&(temp<30))
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
else if((y>550)&&(temp>30))
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
else if((y>550)&&(temp<30))
digitalWrite(5, LOW);
digitalWrite(6, LOW);
/*}
else
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}*/
Circuit Diagram -
Conclusion - This experiment provides a practical demonstration of IIoT applications for smart
home energy management. By using Arduino and various components, the system enables real-
time monitoring and optimization of energy consumption.
Component Testing: Test each component individually to ensure proper operation. Check
sensor readings, authentication processes, and alert mechanisms.
Calibration: Adjust the potentiometer to calibrate sensor sensitivity levels. Verify that data
encryption and integrity verification are functioning correctly.
4. Security Analysis:
Document Findings: Prepare a report detailing the security measures, implementation process,
test results, and any observed issues.
Source Code –
#include <LiquidCrystal.h>
int V_GasSen = 0;
int V_TempSens = 0;
void setup() {
void loop() {
V_GasSen = analogRead(A0);
lcd.clear();
lcd.setCursor(0, 0);
} else {
Department of10
Artificial Intelligence and Data Science ,SVCET,RAJURI
Computer Laboratory II B.E.AI&DS-SEM VII [A.Y.2024-25]
lcd.clear();
lcd.setCursor(0, 0);
} else {
Circuit Diagram –
Department of11
Artificial Intelligence and Data Science ,SVCET,RAJURI
Now go to my scenarios. This is where the FORM KEY will be used. Following
my template, past this into the scenarios field to add:
This will give you a DEsVICE ID remember this, in fact. write it down or copy
and paste it into a notepad doc. This will be used in the Arduino code.
Congrats, you are done with that and now its time to code the Arduino.
Code:
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <dht11.h>
#undef int
#undef abs
#undef float
#undef round
dht11 DHT11;
#define DHT11PIN 3
///////////////////////////////
///////////////////////////////
byte mac[] = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; //Replace with your
Ethernet shield MAC
///////////////////////////////
// DONE EDITING //
///////////////////////////////
int k=0;
int temp_av = 0;
EthernetClient client;
void setup()
Serial.begin(9600);
Ethernet.begin(mac, ip);
delay(1000);
Serial.println("connecting...");
void loop(){
temp_av=temp_av+temp;
delay(1000);
int avtemp=temp_av/(del);
temp_av=0;
if (client.connect(server, 80))
k=0;
Serial.println("connected");
sprintf(postmsg,"GET /pushingbox?devid=%c&status=%d
HTTP/1.1",devid,avtemp); // NOTE** In this line of code you can see where the
temperature value is inserted into the wed address. It follows 'status=' Change that
value to whatever you want to post.
client.println("Host: api.pushingbox.com");
client.println("Connection: close");
client.println();
Serial.println(postmsg);
Serial.println("Host: api.pushingbox.com");
Serial.println("Connection: close");
Serial.println();
delay(1000);
client.stop();
delay(1000);
if (!client.connected())
Serial.println();
Serial.println("disconnecting.");
client.stop();
k==1;
return;
Conclusion :------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------