Docsity

Computer Inter net of things, Lecture notes of Computer Applications

Toggle sidebar
bg1
1 Lighting Control via Website
1.1.1 Introduction (Existing System, Problem Statement and Proposed System)
1.2 System Requirements and Cost
No. Item Price Qty Subtotal
1 Nodemcu 20000 1 20000
2 Led 100 1 500
3 Jumper wire - 8 2500
4 Resistor 100 1 1000
Total 0
1.3 Design Consideration
1.3.1 Circuit Diagram
pf3
pf4
pf5

Partial preview of the text

Download Computer Inter net of things and more Lecture notes Computer Applications in PDF only on Docsity!

1 Lighting Control via Website 1.1.1 Introduction (Existing System, Problem Statement and Proposed System) 1.2 System Requirements and Cost No. Item Price Qty Subtotal 1 Nodemcu 20000 1 20000 2 Led 100 1 500 3 Jumper wire - 8 2500 4 Resistor 100 1 1000 Total 0 1.3 Design Consideration 1.3.1 Circuit Diagram

1.3.2 Calculation Voltage of Nodemcu = 3.3 V Voltage of LED = 2.1 V Current of LED = 20 mA Resistor = (Source Voltage- Load Voltage)/ Load Current = (3.3 V – 2.1 V) /20mA = 100 ohms (local market) 1.4 Implementation 1.4.1 Hardware Configuratio

  1. D7 of NodeMCU to LED's +ve.
  2. G of NodeMCU to LED's -ve. 1.4.2 Coding In code, change ssid to your ssid name and password to your SSID's password #include <ESP8266WiFi.h> const char* ssid = "ss"; const char* password = "123456"; int ledPin = 13; // GPIO13---D7 of NodeMCU WiFiServer server(80); void setup() { Serial.begin(115200); delay(10); pinMode(ledPin, OUTPUT);

digitalWrite(ledPin, HIGH); value = HIGH; } if (request.indexOf("/LED=OFF") != -1) { digitalWrite(ledPin, LOW); value = LOW; } // Set ledPin according to the request //digitalWrite(ledPin, value); // Return the response client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(""); // do not forget this one client.println(""); client.println(""); client.print("Led is now: "); if(value == HIGH) { client.print("On"); } else { client.print("Off"); } client.println("

"); client.println("<a href="/LED=ON"">"); client.println("<a href="/LED=OFF"">
"); client.println(""); delay(1); Serial.println("Client disonnected"); Serial.println(""); }

1.4.3 Uploading the Code

[Reference: https://www.instructables.com/Internet-Controlled-LED-Using- NodeMCU/]