Skip to content

Commit aefc6ac

Browse files
Merge branch 'Amrita-TIFAC-Cyber-Blockchain:main' into main
2 parents 8c7d743 + f856971 commit aefc6ac

File tree

39 files changed

+1983
-1213
lines changed

39 files changed

+1983
-1213
lines changed

.github/workflows/deploy.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy Flask Frontend to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Change if your default branch is different
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: 3.9
23+
24+
- name: Install Flask Dependencies
25+
run: |
26+
pip install -r Assets/Resources/maps/requirements.txt
27+
28+
- name: Prepare Frontend for Deployment
29+
run: |
30+
mkdir -p dist
31+
cp -r Assets/Resources/maps/templates/* dist/
32+
echo "HERE Maps Traffic API Deployment" > dist/index.html
33+
34+
- name: Deploy to GitHub Pages
35+
uses: JamesIves/github-pages-deploy-action@v4
36+
with:
37+
branch: gh-pages
38+
folder: dist

Assets/Boards.md

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,50 @@
33
<br/>
44
![](https://img.shields.io/badge/Lecture-2-orange) ![](https://img.shields.io/badge/Practical-3-orange) ![](https://img.shields.io/badge/Credits-3-orange) <br/>
55

6-
## Raspberry Pi
6+
## Boards and Hardware Kits
7+
8+
### Arduino
9+
_Source:_ [Different Types of Arduino Boards: Their Uses and Features](https://playwithcircuit.com/different-types-of-arduino-boards-their-uses-and-features/)
710

811
<p align="center">
9-
<img src="images/Raspberry_Pi.jpg" width="600" />
12+
<img src="images/Arduino.jpg" width="600" />
1013
</p>
1114

12-
### Pin Diagram
15+
### Raspberry Pi &^Pin Diagram
1316

1417
<p align="center">
15-
<img src="images/Pi_pin.png" width="500" />
18+
<img src="images/Raspberry_Pi.jpg" width="480" /> <img src="images/Pi_pin.png" width="400" />
1619
</p>
1720

18-
## Arduino
19-
_Source:_ [Different Types of Arduino Boards: Their Uses and Features](https://playwithcircuit.com/different-types-of-arduino-boards-their-uses-and-features/)
21+
### NodeMCU with Pin Diagram
2022

2123
<p align="center">
22-
<img src="images/Arduino.jpg" width="600" />
24+
<img src="images/NodeMCU_Pin.png" width="550" />
2325
</p>
26+
27+
### Comparison of NodeMCU, Raspberry Pi, and Arduino
28+
29+
| **Parameter** | **NodeMCU** | **Raspberry Pi** | **Arduino** |
30+
|-----------------------------|---------------------------------------|------------------------------------------|-----------------------------------------|
31+
| **Processor** | ESP8266 (Tensilica Xtensa LX106, 80 MHz) | ARM Cortex-A (Broadcom, varies by model) | ATmega328/ATmega2560 (8-bit AVR) |
32+
| **Clock Speed** | 80 MHz | 700 MHz – 1.8 GHz | 16 MHz |
33+
| **Memory (RAM)** | 128 KB | 512 MB – 8 GB | 2 KB – 8 KB |
34+
| **Storage** | 4 MB Flash | SD Card (expandable) | No built-in storage; requires EEPROM or external modules |
35+
| **Operating System** | None | Linux-based OS (e.g., Raspbian) | None |
36+
| **Connectivity** | Built-in Wi-Fi | Ethernet, Wi-Fi, Bluetooth (varies by model) | Requires external modules for Wi-Fi/Bluetooth |
37+
| **Power Consumption** | ~170 mA (at 3.3V) | ~300 mA to 3 A (depending on model) | ~50 mA (at 5V) |
38+
| **GPIO Pins** | 11 Digital + 1 Analog | 26–40 | ~14–54 |
39+
| **Programming Language** | Lua, C++ (Arduino IDE support) | Python, C++, Java, Scratch, etc. | C++ (Arduino IDE) |
40+
| **Ease of Programming** | Easy (Arduino IDE or NodeMCU Firmware) | Moderate (requires OS setup and libraries) | Easy (Arduino IDE) |
41+
| **Sensors and Peripherals** | Supports many I2C, SPI sensors | Supports USB devices, HDMI output, sensors | Supports I2C, SPI sensors |
42+
| **Processing Power** | Moderate (suitable for IoT tasks) | High (suitable for multitasking) | Low (suitable for simple tasks) |
43+
| **Real-Time Performance** | No real-time OS | No real-time OS | Real-time performance |
44+
| **Multitasking** | No | Yes (supports multiprocessing) | No |
45+
| **Expandability** | Limited | High (supports USB, external drives) | Limited |
46+
| **Power Supply** | 3.3V | 5V (via micro USB/Type-C) | 5V (via USB or barrel jack) |
47+
| **Debugging** | Limited | Advanced debugging tools | Limited |
48+
| **Applications** | IoT, Home Automation, Wi-Fi Projects | Robotics, multimedia, server applications | Basic robotics, sensor data collection |
49+
| **Usage Scenarios** | Ideal for Wi-Fi-enabled IoT Projects | Ideal for complex tasks needing high processing power | Ideal for beginner-level projects requiring simplicity |
50+
| **Community Support** | Moderate | High | Very High |
51+
| **Cost (INR)** | ₹300–₹800 | ₹3,000–₹10,000 | ₹600–₹2,000 |
52+
| Variants | NA | - Raspberry Pi 1 Model B <br/> - Raspberry Pi 2 Model B <br/> - Raspberry Pi 3 Model B <br/> - Raspberry Pi 3 Model B+ <br/> - Raspberry Pi 4 Model B <br/> - Raspberry Pi Zero W <br/> - Raspberry Pi Zero 2 W <br/> - Raspberry Pi Pico | - Arduino Uno R3 <br/> - Arduino Mega 2560 <br/> - Arduino Nano <br/> - Arduino Leonardo <br/> - Arduino Due <br/> - Arduino Nano Every <br/> - Arduino Pro Mini <br/> - Arduino MKR1000 <br/> - Arduino Portenta H7 |

Assets/Lectures/Challenges.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# 24CYS333 - Internet of Things
2+
![](https://img.shields.io/badge/Batch-22CYS-lightgreen) ![](https://img.shields.io/badge/UG-blue) ![](https://img.shields.io/badge/Subject-IoT-blue)
3+
<br/>
4+
5+
## Challenges in IoT
6+
![](https://img.shields.io/badge/Date-TBD-blue)
7+
8+
#### Design
9+
- Interoperability
10+
- Scalability
11+
- Reliability
12+
- Power consumption
13+
- Security and Privacy
14+
15+
#### Deployment
16+
- Connectivity
17+
- Cross platform capability
18+
- Data collection and processing
19+
- Lack of skill set
20+
- Integration
21+
- Network infrastructure
22+
- Device management
23+
- Data management
24+
- Cost
25+
26+
#### Security
27+
- Lack of encryption
28+
- Insufficient testing and updating
29+
- Brute forcing and the risk of default passwords
30+
- IoT Malware and ransomware
31+
- Inadequate device security
32+
- Lack of standardization
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 24CYS333 - Internet of Things
2+
![](https://img.shields.io/badge/Batch-22CYS-lightgreen) ![](https://img.shields.io/badge/UG-blue) ![](https://img.shields.io/badge/Subject-IoT-blue)
3+
<br/>
4+
5+
## Introduction to IoT
6+
![](https://img.shields.io/badge/Date-TBD-blue)
7+
8+
### Characteristics of Internet of Things (IoT)
9+
- Identity of Things
10+
- Connectivity
11+
- Intelligence
12+
- Dynamic
13+
- Scalability
14+
- Security
15+
- Network
16+
- Data
17+
- Self Configuring
18+
- Autonomous
19+
- Context Awareness

Assets/Lectures/Connectivity.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 24CYS333 - Internet of Things
2+
![](https://img.shields.io/badge/Batch-22CYS-lightgreen) ![](https://img.shields.io/badge/UG-blue) ![](https://img.shields.io/badge/Subject-IoT-blue)
3+
<br/>
4+
5+
## Connectivity in IoT
6+
![](https://img.shields.io/badge/Date-TBD-blue)
7+
8+
### Standards
9+
- IEEE 802.11: Wireless Local Area Network (WLAN) - Defines physical layer and media access control
10+
- IEEE 802.11n: Wi-Fi 4 (support for MIMO) [2009]
11+
- IEEE 802.11ac: Wi-Fi 5 [2013]
12+
- IEEE 802.11af: Super WiFi or White-Fi [2014]
13+
- IEEE 802.11ax: Wi-Fi 6 [2021]
14+
- IEEE 802.11be: Wi-Fi 7 [2024]
15+
- IEEE 802.15: Wireless Speciality Networks - Defines physical layer and media access control
16+
- IEEE 802.15.1: Bluetooth
17+
- IEEE 802.15.4: Low-rate Wireless Personal Area Networks (LR-WPANs)
18+
19+
###

Assets/MC/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
- [AnalogWrite](S124Dec11/AnalogWrite)
1111

1212
#### Exercises - Connectivity
13-
- [WiFi](S124Dec11/WiFi)
14-
- [ThingSpeak Cloud](S124Dec11/ThingSpeak)
15-
- [Bluetooth](S124Dec11/BT)
13+
- [WiFi](S124Dec11/WiFi.md)
14+
- [ThingSpeak Cloud](S124Dec11/ThingSpeak.md)
15+
- [Bluetooth](S124Dec11/BT.md)

Assets/MC/S124Dec11/WiFi.md

Lines changed: 70 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
## WiFi
66

77
```
8-
98
// Load Wi-Fi library
109
#include <WiFi.h>
1110
@@ -19,13 +18,13 @@ WiFiServer server(80);
1918
// Variable to store the HTTP request
2019
String header;
2120
22-
// Auxiliar variables to store the current output state
23-
String output26State = "off";
24-
String output27State = "off";
21+
// Variables to store the current output state
22+
String output33State = "off";
23+
String output04State = "off";
2524
2625
// Assign output variables to GPIO pins
27-
const int output26 = 33;
28-
const int output27 = 04;
26+
const int output33 = 33;
27+
const int output04 = 04;
2928
3029
// Current time
3130
unsigned long currentTime = millis();
@@ -40,12 +39,12 @@ void setup() {
4039
Serial.begin(115200);
4140
4241
// Initialize the output variables as outputs
43-
pinMode(output26, OUTPUT);
44-
pinMode(output27, OUTPUT);
42+
pinMode(output33, OUTPUT);
43+
pinMode(output04, OUTPUT);
4544
4645
// Set outputs to LOW
47-
digitalWrite(output26, LOW);
48-
digitalWrite(output27, LOW);
46+
digitalWrite(output33, LOW);
47+
digitalWrite(output04, LOW);
4948
5049
// Connect to Wi-Fi network with SSID and password
5150
Serial.print("Connecting to ");
@@ -58,7 +57,7 @@ void setup() {
5857
5958
// Print local IP address and start web server
6059
Serial.println("");
61-
Serial.println("WiFi connected.");
60+
Serial.println("WiFi Connected.");
6261
Serial.println("IP address: ");
6362
Serial.println(WiFi.localIP());
6463
server.begin();
@@ -90,22 +89,34 @@ void loop(){
9089
client.println();
9190
9291
// turns the GPIOs on and off
93-
if (header.indexOf("GET /26/on") >= 0) {
94-
Serial.println("GPIO 26 on");
95-
output26State = "on";
96-
digitalWrite(output26, HIGH);
97-
} else if (header.indexOf("GET /26/off") >= 0) {
98-
Serial.println("GPIO 26 off");
99-
output26State = "off";
100-
digitalWrite(output26, LOW);
101-
} else if (header.indexOf("GET /27/on") >= 0) {
102-
Serial.println("GPIO 27 on");
103-
output27State = "on";
104-
digitalWrite(output27, HIGH);
105-
} else if (header.indexOf("GET /27/off") >= 0) {
106-
Serial.println("GPIO 27 off");
107-
output27State = "off";
108-
digitalWrite(output27, LOW);
92+
if (header.indexOf("GET /33/on") >= 0) {
93+
Serial.println("GPIO 33 on");
94+
output33State = "on";
95+
digitalWrite(output33, HIGH);
96+
} else if (header.indexOf("GET /33/off") >= 0) {
97+
Serial.println("GPIO 33 off");
98+
output33State = "off";
99+
digitalWrite(output33, LOW);
100+
} else if (header.indexOf("GET /04/on") >= 0) {
101+
Serial.println("GPIO 04 on");
102+
output04State = "on";
103+
digitalWrite(output04, HIGH);
104+
} else if (header.indexOf("GET /04/off") >= 0) {
105+
Serial.println("GPIO 04 off");
106+
output04State = "off";
107+
digitalWrite(output04, LOW);
108+
} else if (header.indexOf("GET /both/on") >= 0) {
109+
Serial.println("GPIO 04 & 33 on");
110+
output33State = "on";
111+
output04State = "on";
112+
digitalWrite(output33, HIGH);
113+
digitalWrite(output04, HIGH);
114+
} else if (header.indexOf("GET /both/off") >= 0) {
115+
Serial.println("GPIO 04 & 33 off");
116+
output33State = "off";
117+
output04State = "off";
118+
digitalWrite(output33, LOW);
119+
digitalWrite(output04, LOW);
109120
}
110121
111122
// Display the HTML web page
@@ -114,32 +125,42 @@ void loop(){
114125
client.println("<link rel=\"icon\" href=\"data:,\">");
115126
// CSS to style the on/off buttons
116127
// Feel free to change the background-color and font-size attributes to fit your preferences
117-
client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
128+
client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;} footer { position: fixed; left: 0; bottom: 0; width: 100%; background-color: green; color: white; text-align: center; }");
118129
client.println(".button { background-color: #4CAF50; border: none; color: white; padding: 16px 40px;");
119130
client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
120131
client.println(".button2 {background-color: #555555;}</style></head>");
121132
122133
// Web Page Heading
123-
client.println("<body><h1>ESP32 Web Server</h1>");
134+
client.println("<body><h1>Ramaguru's Web Server</h1>");
135+
136+
// Display current state, and ON/OFF buttons for GPIO 04
137+
client.println("<p>GPIO 04 - State " + output04State + "</p>");
138+
// If the output04State is off, it displays the ON button
139+
if (output04State=="off") {
140+
client.println("<p><a href=\"/04/on\"><button class=\"button\">ON</button></a></p>");
141+
} else {
142+
client.println("<p><a href=\"/04/off\"><button class=\"button button2\">OFF</button></a></p>");
143+
}
124144
125-
// Display current state, and ON/OFF buttons for GPIO 26
126-
client.println("<p>GPIO 26 - State " + output26State + "</p>");
127-
// If the output26State is off, it displays the ON button
128-
if (output26State=="off") {
129-
client.println("<p><a href=\"/26/on\"><button class=\"button\">ON</button></a></p>");
145+
// Display current state, and ON/OFF buttons for GPIO 33
146+
client.println("<p>GPIO 33 - State " + output33State + "</p>");
147+
// If the output33State is off, it displays the ON button
148+
if (output33State=="off") {
149+
client.println("<p><a href=\"/33/on\"><button class=\"button\">ON</button></a></p>");
130150
} else {
131-
client.println("<p><a href=\"/26/off\"><button class=\"button button2\">OFF</button></a></p>");
151+
client.println("<p><a href=\"/33/off\"><button class=\"button button2\">OFF</button></a></p>");
132152
}
133153
154+
134155
// Display current state, and ON/OFF buttons for GPIO 27
135-
client.println("<p>GPIO 27 - State " + output27State + "</p>");
136-
// If the output27State is off, it displays the ON button
137-
if (output27State=="off") {
138-
client.println("<p><a href=\"/27/on\"><button class=\"button\">ON</button></a></p>");
156+
client.println("<p>GPIO - State </p>");
157+
// If the output04State is off, it displays the ON button
158+
if (output04State=="off" || output04State=="off") {
159+
client.println("<p><a href=\"/both/on\"><button class=\"button\">ON</button></a></p>");
139160
} else {
140-
client.println("<p><a href=\"/27/off\"><button class=\"button button2\">OFF</button></a></p>");
161+
client.println("<p><a href=\"/both/off\"><button class=\"button button2\">OFF</button></a></p>");
141162
}
142-
client.println("</body></html>");
163+
client.println("</body><footer>Demo with &#9829; for 24CYS333 - Internet of Things Course</footer></html>");
143164
144165
// The HTTP response ends with another blank line
145166
client.println();
@@ -155,10 +176,16 @@ void loop(){
155176
}
156177
// Clear the header variable
157178
header = "";
179+
158180
// Close the connection
159181
client.stop();
160-
Serial.println("Client disconnected.");
182+
Serial.println("Client Disconnected.");
161183
Serial.println("");
162184
}
163185
}
164-
```
186+
```
187+
188+
### Screenshot
189+
<p align="center">
190+
<img src="../../images/client_ui.png" alt = "client ui" width="600" />
191+
</p>

0 commit comments

Comments
 (0)