0% found this document useful (0 votes)
56 views8 pages

Cdio Project in EE 111

The document describes a student project to create a WiFi controlled lighting system using a NodeMCU ESP8266 12E development board. The system allows controlling four lights connected to relays using a smartphone app over WiFi. It uses the ESP8266 to create a web server and parse HTTP requests to turn the relays and lights on and off. An MIT App Inventor mobile app is developed to send HTTP commands via a WiFi connection to control the relays and automate home lighting. The project aims to learn how wireless lighting systems work and the advantages of wireless control systems.

Uploaded by

raymond balite
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views8 pages

Cdio Project in EE 111

The document describes a student project to create a WiFi controlled lighting system using a NodeMCU ESP8266 12E development board. The system allows controlling four lights connected to relays using a smartphone app over WiFi. It uses the ESP8266 to create a web server and parse HTTP requests to turn the relays and lights on and off. An MIT App Inventor mobile app is developed to send HTTP commands via a WiFi connection to control the relays and automate home lighting. The project aims to learn how wireless lighting systems work and the advantages of wireless control systems.

Uploaded by

raymond balite
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Republic of the Philippines

CARAGA STATE UNIVERSITY- Cabadbaran Campus


College of Engineering and Information Technology
T- Curato St., Cabadbaran City

CDIO PROJECT
In
EE 111

WIFI CONTROLLED LIGHTING


SYSTEM

Submitted by:
ALLAMEL M. CABONILAS
ANGELKHEM D. PICATE
DIANA ROSE D. NUÑEZ
WILMAR A. CASTILLO

Submitted to:
Engr. Blondie Sanchez
Introduction
Since Thomas Edison invented the light bulb, lighting has been an
important part of our lives and how we live in our homes. As lighting evolved, dimming was
introduced to create ambiance and inviting environments. Switching are also revolutionize to
keep up in today’s modern way living. Many significant changes has been happening us through
the help of wireless technology. The said technology can also be used to automate and control
for residential and commercial lighting system.
The term lighting control system refers to an intelligent networked of
devices related to lighting control. These devices may include relays, sensors, microprocessors,
control switches and WI-FI routers. Adjustments of the system occurs both device location and
computer locations via software programs or other interface devices.
In this project, we will make a home automation system where it
can automate your home lights (and appliances) using smart phone via Wi-Fi connection.
The knowledge gained in this project will benefit us in making other Wi-Fi based or IOT
based projects. We will be using an ESP based development board i.e. NodeMCU
ESP8266 12E, which is the cheapest and the most useful dev board for Internet of Things
Projects.

Statement of the Problem:


1. How does wireless lighting system works?
2. What are the necessary devices to be used in wireless control system?
3. Wh?

Objectives:
1. To be able automate home lighting system using wireless technology.
2. To be able to know how does wireless lighting system works.
3. To be able know the advantage of wireless system compare the conventional one.
Materials Needed:

 NodeMCU ESP8266 12E


 4 Channel Relay Module
 Jumper Wires
 9v Power Module
 Connecting wire/Switch Board
 Lighting bulbs
 9v Power Supply

Connection
App Making: Using MIT App Inventor

Layout:
Blocks:

Code Section:
1. //Visit www.roboshala.com for more details on NodeMCU and other projects.
2.
3. #include <ESP8266WiFi.h>
4.
5. const char* ssid = "CPH1613"; // SSID i.e. Service Set Identifier is the name of your WIFI
6. const char* password = "12345678"; // Your Wifi password, in case you have open network comment the whole
statement.
7.
8. int R1=D1; // GPIO13 or for NodeMCU you can directly write D7
9. int R2=D2;
10. int R3=D3;
11. int R4=D4;
12. WiFiServer server(80); // Creates a server that listens for incoming connections on the specified port, here in this case
port is 80.
13.
14. void setup(){
15. Serial.begin(115200);
16. delay(10);
17.
18. pinMode(R1, OUTPUT);
19. pinMode(R2, OUTPUT);
20. pinMode(R3, OUTPUT);
21. pinMode(R4, OUTPUT);
22.
23. digitalWrite(R1,HIGH);
24. digitalWrite(R2,HIGH);
25. digitalWrite(R3,HIGH);
26. digitalWrite(R4,HIGH);
27.
28.
29.
30. // Connect to WiFi network
31. Serial.println();
32. Serial.println();
33. Serial.print("Connecting to ");
34. Serial.println(ssid);
35.
36. WiFi.begin(ssid, password);
37.
38. while(WiFi.status() != WL_CONNECTED){
39. delay(500);
40. Serial.print(".");
41. }
42. Serial.println("");
43. Serial.println("WiFi connected");
44.
45. // Start the server
46. server.begin();
47. Serial.println("Server started");
48.
49. // Print the IP address
50. Serial.print("Use this URL to connect: ");
51. Serial.print("http://");
52. Serial.print(WiFi.localIP()); //Gets the WiFi shield's IP address and Print the IP address of serial monitor
53. Serial.println("/");
54.
55. }
56.
57. void loop(){
58. // Check if a client has connected
59. WiFiClient client = server.available();
60. if(!client){
61. return;
62. }
63.
64. // Wait until the client sends some data
65. Serial.println("new client");
66. while(!client.available()){
67. delay(1);
68. }
69.
70. // Read the first line of the request
71. String request = client.readStringUntil('\r');
72. Serial.println(request);
73. client.flush();
74.
75. // Match the request
76.
77.
78. if(request.indexOf("/Relay1On") != -1){
79. digitalWrite(R1,LOW);
80.
81. client.println("HTTP/1.1 200 OK");
82. client.println("Content-Type: text/html");
83. client.println("");
84. client.println("<!DOCTYPE HTML>");
85. client.println("<html>");
86. client.println("Relay 1 is ON");
87. client.println("</html>");
88. client.stop();
89. delay(1);
90. }
91. if(request.indexOf("/Relay1Off") != -1){
92. digitalWrite(R1, HIGH);
93.
94. client.println("HTTP/1.1 200 OK");
95. client.println("Content-Type: text/html");
96. client.println("");
97. client.println("<!DOCTYPE HTML>");
98. client.println("<html>");
99. client.println("Relay 1 is OFF");
100. client.println("</html>");
101. client.stop();
102. delay(1);
103. }
104.
105.
106. if(request.indexOf("/Relay2On") != -1){
107. digitalWrite(R2,LOW);
108.
109. client.println("HTTP/1.1 200 OK");
110. client.println("Content-Type: text/html");
111. client.println("");
112. client.println("<!DOCTYPE HTML>");
113. client.println("<html>");
114. client.println("Relay 2 is ON");
115. client.println("</html>");
116. client.stop();
117. delay(1);
118.
119. }
120. if(request.indexOf("/Relay2Off") != -1){
121. digitalWrite(R2, HIGH);
122.
123. client.println("HTTP/1.1 200 OK");
124. client.println("Content-Type: text/html");
125. client.println("");
126. client.println("<!DOCTYPE HTML>");
127. client.println("<html>");
128. client.println("Relay 2 is OFF");
129. client.println("</html>");
130. client.stop();
131. delay(1);
132. }
133.
134.
135. if(request.indexOf("/Relay3On") != -1){
136. digitalWrite(R3,LOW);
137.
138. client.println("HTTP/1.1 200 OK");
139. client.println("Content-Type: text/html");
140. client.println("");
141. client.println("<!DOCTYPE HTML>");
142. client.println("<html>");
143. client.println("Relay 3 is ON");
144. client.println("</html>");
145. client.stop();
146. delay(1);
147. }
148. if(request.indexOf("/Relay3Off") != -1){
149. digitalWrite(R3, HIGH);
150.
151. client.println("HTTP/1.1 200 OK");
152. client.println("Content-Type: text/html");
153. client.println("");
154. client.println("<!DOCTYPE HTML>");
155. client.println("<html>");
156. client.println("Relay 3 is OFF");
157. client.println("</html>");
158. client.stop();
159. delay(1);
160. }
161.
162. if(request.indexOf("/Relay4On") != -1){
163. digitalWrite(R4,LOW);
164.
165. client.println("HTTP/1.1 200 OK");
166. client.println("Content-Type: text/html");
167. client.println("");
168. client.println("<!DOCTYPE HTML>");
169. client.println("<html>");
170. client.println("Relay 4 is ON");
171. client.println("</html>");
172. client.stop();
173. delay(1);
174. }
175. if(request.indexOf("/Relay4Off") != -1){
176. digitalWrite(R4, HIGH);
177.
178. client.println("HTTP/1.1 200 OK");
179. client.println("Content-Type: text/html");
180. client.println("");
181. client.println("<!DOCTYPE HTML>");
182. client.println("<html>");
183. client.println("Relay 4 is OFF");
184. client.println("</html>");
185. client.stop();
186. delay(1);
187. }
188.
189. }

You might also like