0% found this document useful (0 votes)
27 views21 pages

Project Report

Naan mudhalvan project report format

Uploaded by

sankari56007
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)
27 views21 pages

Project Report

Naan mudhalvan project report format

Uploaded by

sankari56007
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/ 21

UNIVERSITY COLLEGE OF ENGINEERING

TINDIVANAM
(A Constituent College of Anna University, Chennai)

B.E. Fifth Semester


For
NAAN MUDHALVAN LABAROTARY

Industrial IoT and Industry 4.0 – NM1063

DEPARTMENT OF ELECTRONIOCS AND COMMUNICATION


ENGINEERIG

LABORATORY RECORD NOTE BOOK


2024 – 2025
PROJECT NAME : SMART STREET LIGHT

Prepared by:
VELAN D – 422422106002
GUNASEELAN M – 422422106024
DHANUSH V – 422422106030
DHIVYA D – 422422106031
HARIHARAN T – 422422106034

Guided By:
Karthi S
Unity developer
Ingage Technologies Pvt. Ltd.
LIST OF CONTENT

1. Training Objective
2. Introduction
3. Project Description
4. Requirement Needed
5. Wokwi
6. ThingSpeak
7. Unity
8. AR Foundation
9. Power BI
10. Output
11. Conclusion
TRAINING OBJECTIVES: .

 Iden fy the requirements and use cases for


implementa on.
 Implementa on the concepts using different tools and
techniques (Wokwi,Thingspeak,PowerBI and Unity3D).
 Develop the projects and implementa on /execu on.

RODUCTION: .

Overview of the project:


Briefly explain the concept the smart streetlight system, its
importance, and the objec ve of the project.
Problem Statement:
Highlight the issue with conventional streetlighting
system (eg, energy inefficiency, high maintenance, lack of
real-time monitoring).

Solution Approach:

Describe how iot and smart systems can solve these


problems, mentioning the integration of various toolslike
wokwi, thingSpeak, unity and power BI

PROJECT DESCRIPTION: .
A smart street light project on Wokwi is a simulation of a
street light that can automatically adjust its light intensity
based on various factors, such as the time of day, weather, and
human presence
REQUIREMENT NEEDED: .
So ware Needed:
 Wokwi
 ThingSpeak
 Unity 3D
 Power BI

WOKWI: .
 Wokwi is an online pla orm for
simula ngelectronics,robo cs,and IOT
projects.
 It allows users to design,test,and collaborate on
projectsvirtually .
 No physical components or hardware needed.
 Supports various programming languages like
C++,Python,and Arduino.
 Ideal for students,professionals,and
hobbyists inelectronics and robo cs.

We used 6 components in wokwi:


 ESP32
 Relay Module
 Ultrasonic Sensor
 PIR Mo on Sensor
 LED and Connec ng wires
 Photoresistor Sensor
CONNECTION:
Connect the LDR to pin 34 (one side to 3.3V, the other
side topin 34 and GND via a resistor), the relay to pin 16, the PIR
sensor to pin 15, the ultrasonic sensor trigger to pin 4 and echo
to pin 5, and ensure the ESP32 is connected to power and GND
properly
CODE:

#include <WiFi.h>
#include
<ThingSpeak.h>
WiFiClient client;
long myChannelNumber = 2716650;
const char * myWriteAPIKey =
"AT41RU26NKF4LRDW";int statusCode;
char ssid[] = "Wokwi-
GUEST";char pass[] = "";

const int LDR_PIN = 34;


const int RELAY_PIN = 16;
const int PIR_PIN = 15;
int LIGHT=0;
const int LDR_THRESHOLD =
2000;const int PIR_THRESHOLD
= 1; int trigger=4;
int echo=5;
void setup()
{
Serial.begin(115200);
pinMode(RELAY_PIN, OUTPUT);
pinMode(PIR_PIN, INPUT);
pinMode(trigger,
OUTPUT);pinMode(echo,
INPUT);
WiFi.mode(WIFI_STA);
ThingSpeak.begin(client
);

}
int finding_distance(){
digitalWrite(trigger,
HIGH);delay(100);
digitalWrite(trigger,
LOW); float
a=pulseIn(echo,HIGH);
return(a*0.034/2);
}

void loop() {
if(WiFi.status() != WL_CONNECTED)
{
Serial.print("Attempting to
connect");while(WiFi.status() !=
WL_CONNECTED)
{
WiFi.begin(ssid,
pass);
Serial.print(".");
delay(5000);
}
Serial.println("\nConnected.");
}
int
distance=finding_distance();
delay(1000);
int ldrValue =
analogRead(LDR_PIN); int pirValue
= digitalRead(PIR_PIN);

Serial.print("LDR Value: ");


Serial.print(ldrValue);
Serial.print(" | PIR Value:
");Serial.print(pirValue);
Serial.print(" | Distance:");
Serial.println(distance);
if (pirValue == PIR_THRESHOLD || ldrValue
<LDR_THRESHOLD || distance<=100) {
digitalWrite(RELAY_PIN,
HIGH);LIGHT=1;
Serial.println("It's Dark.Turning on the
streetlight!");
} else {
digitalWrite(RELAY_PIN,
LOW);
LIGHT=0;
Serial.println("It's Bright.Turning off
thestreet light!");
}
ThingSpeak.setField(1,
pirValue);
ThingSpeak.setField(2,
ldrValue);
ThingSpeak.setField(3, LIGHT);
ThingSpeak.setField(4,distance)
; statusCode =
ThingSpeak.writeFields(myChannelNumber,myWriteAPIKe
y);

if(statusCode == 200) {
Serial.println("Channel update
successful.");
}
else {
Serial.println("Problem Writing data. HTTP
errorcode :" +String(statusCode));
}

delay(1000);
}

WOKWI PROJECT LINK


https://wokwi.com/projects/415184270121889793
CODE EXPLAINATION:
 Initial Setup
 The ESP32 connects to WiFi using the ssid and pass
provided.
 ThingSpeak.begin(client); initializes communication with
ThingSpeak for sending data.
 Main Loop:
 WiFi Connection Check: If the ESP32 is not connected to
WiFi, it attempts to reconnect.
 Distance Measurement: o The finding_distance() function
triggers the ultrasonic sensor, measures the time it takes
for the sound wave to return, and calculates the
distance.
 Sensor Reading:
 The LDR reads the ambient light level using
analogRead(LDR_PIN).
 The PIR sensor checks for motion with
digitalRead(PIR_PIN)

 Conditions for Turning on the Relay:


The relay is activated (digitalWrite(RELAY_PIN, HIGH)) if:
 The PIR sensor detects movement (pirValue ==
PIR_THRESHOLD).
 The LDR value is below the threshold (ldrValue <
LDR_THRESHOLD), indicating low light.
 The ultrasonic sensor measures a distance of <= 100 cm.
o If none of these conditions are met, the relay turns off
(digitalWrite(RELAY_PIN, LOW)).
 Sending Data to ThingSpeak:
 The code sets the sensor value to ThingSpeak fields
(ThingSpeak.setField()).
 It sends these values using
ThingSpeak.writeFields(), and the status code is
printed to the Serial Monitor to confirm success or
diagnose errors.
 Purpose:
 The LDR helps control the relay based on light
levels, allowing it to act as an automated lighting
system.
 The PIR sensor provides motion detection to turn
on the s light when movement is detected.
 The ultrasonic sensor can be used for proximity
detection, triggering the light when an object is
close enough (e.g., someone approaching).
THINGSPEAK: .
ThingSpeak is an open-source Internet of Things (IoT)
platform.
• It enables users to collect, analyze, and visualize sensor data.
• Developed by MathWorks, ThingSpeak supports various
hardware pla orms. Including Arduino, Raspberry Pi, and
ESP32/ESP8266.
• The pla orm offers real- me data visualiza on and analysis.
• ThingSpeak supports mul ple sensor types, including
temperature, humidity, and GPS.
• ThingSpeak integrates with MATLAB, Simulink, and other
programming languages.

• Ideal for IoT projects, prototyping, and data-driven decision-


making.
THINGSPEAK INTEGRATION:
We utilized ThingSpeak's IoT platform to
monitor andanalyze sensor data.

Three Fields Configuration


- Field 1: X-Axis (Horizontal Tilt)
- Field 2: Y-Axis (Ver cal Tilt)
- Field 3: Z-Axis (Forward/Backward Tilt)
How we Connected Wokwi to Thingspeak
:Step 1: Create a ThingSpeak Channel
1. Log in to ThingSpeak.
2. Create a new channel.
3. Add fields for your sensor data (e.g., X, Y, Z axes).

Step 2: Get ThingSpeak API Key and Channel ID

1. Go to your ThingSpeak channel.


2. Click "API Keys" tab.
3. Note the "Write API Key" and "Channel ID".

Step 3: Write Code to Send Data to ThingSpeak

1. In Wokwi, write code to read sensor data.


2. Use the ThingSpeak API to send data to your channel.

Step 4:
Add Libraries of Wi-Fi & Thingspeak.
Also Write Codes of Wi-Fi 7 Thingspeak

Step 5: Run Simulation and Send Data

1. Run your Wokwi simula on.


2. Verify data is sent to ThingSpeak.
UNITY: .
• Unity is a leading cross-pla orm game engine and
development environment.
• Supports 2D/3D game crea on, simula ons, and interac ve
experiences.
• Deploy on mul ple pla orms: PC, consoles, mobile, web,
and VR/AR.
• Popular among indie devs and AAA game studios, with a
vast asset store.
• Ideal for game development, architecture, product design,
and more.
Creating an Environment in Unity:

Step 1: Create a New Project


1. Open Unity Hub.
2. Click "New" to create a project.
3. Choose project name, template (e.g., 3D), and loca on.

Step 2: Set Up the Scene


1. Create a new scene (File > New Scene).
2. Add a 3D object (e.g., cube) to the scene (GameObject >
3D Object > Cube).

3. Customize the environment by adding textures, lights, and


iot her objects.
Step 3: Add Components
1. Add Components from Asset Store
2. Use Unity's built-in components (e.g., Rigidbody, Collider).

Retrieving Values from ThingSpeak in Unity:

Step 1: Add Canvas:

It used to screen the values to display. Step


2: Import Jason Dot Net &
Getdata.
Step 3: Modified the Program by Adding Fields.
Step 4: Added our Thingspeak Read a Channel Feed link to
unity program.

AR Foundation: .
AR conversion steps up to APK generation in Unity:
Step 1: Set up Unity for AR
1. Install Unity's AR Foundation package (Window > Package
Manager > AR Foundation).
Step 2: Configure AR Session

1. Create an AR Session (GameObject > 3D Object > AR


Session).

2. Set AR Session Origin (e.g., Camera).


3. Configure AR Session Set (e.g., plane detec on, light
es ma on).

Step 3: Add AR Features

1. Add AR Plane Detector (GameObject > 3D Object > AR


Plane Detector).

2. Add AR Object Scanner (GameObject > 3D Object > AR


Object Scanner).

3. Add AR Interac on (e.g., tap, pinch, rotate).

Step 4: Build and Export Android Project

1. Go to File > Build Se ngs > Android.


2. Set Target Device (e.g., Android 8.0 or later).
3. Set Package Name and Minimum API Level.
4. Build and export project.

Step 5: Generate APK

1. Open exported project in Android Studio.


2. Configure AndroidManifest.xml (e.g., permissions).
3. Build and generate APK (Build > Generate Signed
Bundle/APK).

Step 6: Test and Distribute

1. Install APK on Android device.


2. Test AR func onality.
3. Distribute APK through Google Play Store or other
channels.

POWER BI: .
• Power BI is a business analy cs service by Microso .
• It enables users to visualize and analyze data from various
sources.
• Create interac ve dashboards, reports, and data models.
• Enhance decision-making with real- me insights and trends.
• Transform data into ac onable business intelligence.
Steps to Extract data from Thingspeak for PowerBI:
Step 1: Get ThingSpeak Data
1. Log in to ThingSpeak.
2. Go to your channel.
3. Click "Data" tab.
4. Select "Feeds" or "All Feeds".

Step 2: Export Data as CSV

1. Click "Export" bu on.


2. Choose "CSV" format.
3. Select date range and fields.
4. Download the CSV file (e.g., feeds.csv).

Step 3: Prepare CSV for Power BI

1. Open feeds.csv in Excel or text editor.


2. Ensure data is in table format.
3. Remove unnecessary columns.

Step 4: Import CSV into Power BI

1. Open Power BI Desktop.


2. Click "Get Data" > "Text/CSV".
3. Select feeds.csv.
4. Click "Load".
Step 5: Transform and Model Data

1. Use Power Query Editor to transform data.


2. Convert data types (e.g., date, numeric)
3. Create data models.

Step 6: Visualize and Analyze

1. Create repor ts and dashboards.


2. Use visualiza ons (e.g., charts, tables).
3. Analyze data trends and insights

POWER BI OUTPUT:
CONCLUSION: .
This project demonstrates an intelligent system
using an ESP32 microcontroller to monitor environmental
factors andautomate control over a relay-based device, such
as a light.
The integration of an LDR for ambient light detection, a PIR
sensor for motion sensing, and an ultrasonic sensor for
proximity measurement ensures multi-faceted detection
capabilities. The system's connectivity to ThingSpeak
provides real-time data monitoring and logging, making it a
useful IoT-based application for smart home or automation
projects.

This project is an effective example of how IoT can enhance


convenience, efficiency, and data management in real-time
applications.

You might also like