0% found this document useful (0 votes)
10 views6 pages

IOT Assign 4

The document outlines an experiment involving wireless communication using Node MCU, Raspberry Pi, and Arduino to create a web server for traffic signal control. It details the components required, the procedure for setting up the circuit and coding, and concludes with the successful implementation of remote LED control. This project demonstrates potential applications in traffic management and smart home systems.

Uploaded by

VEDANT RAWALE
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)
10 views6 pages

IOT Assign 4

The document outlines an experiment involving wireless communication using Node MCU, Raspberry Pi, and Arduino to create a web server for traffic signal control. It details the components required, the procedure for setting up the circuit and coding, and concludes with the successful implementation of remote LED control. This project demonstrates potential applications in traffic management and smart home systems.

Uploaded by

VEDANT RAWALE
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

Experiment No: 4

Node MCU /Arduino / Raspberry Pi wireless communication


Raspberry Pi as a web server for Traffic Signal Control.

Name of the Student: Vedant Digambar Rawale


Div. A(CSAI)
Roll No.56

Aim: Node MCU /Arduino / Raspberry Pi wireless communication Raspberry Pi as a web


server for Traffic Signal Control.

Components Required:

1) Node MCU – 1
2) Micro USB Cable – 1
3) PC/Laptop – 1
4) Connecting Wires
5) Bread Board – 1
6) Red Yellow Green LED – (each 1)
7) Resistor 200 Ohm – 3

Software Required:

Arduino IDE

Procedure:

Step 1: Connect Node MCU to PC / Laptop with the help of micro USB cable.

HOW TO CONNECT LED :

Make the circuit diagram on the bread board according to the connection diagram shown below.
Positive terminal of LED (RED) long leg of theLED is connected to the one point of the Resistor
200 Ohm and another point is connected to the D5 pin of the Node MCU, negative terminal of
LED (RED) [short leg of the LED] is connected to the ground pin.

1
Positive terminal of LED (YELLOW) long leg of the LED is connected to the one point of the
Resistor 200 Ohm and another point is connected to the D6 pin of the Node MCU, negative
terminal of LED (YELLOW) [short leg of the LED] is connected to the ground pin.

Positive terminal of LED (GREEN) long leg of the LED is connected to the one point of the
Resistor 200 Ohm and another point is connected to the D7 pin of the Node MCU, negative
terminal of LED (GREEN) [short leg of the LED]is connected to the ground pin.

Step 2: Open new Sketch, Go to file ----> New

Step 3: Write following code in new sketch

#include <ESP8266WiFi.h>

WiFiClient client;
WiFiServer server(80);
# define LED_Red D5
# define LED_Yellow D6
# define LED_Green D7
void setup() {
// put your setup code here, to run once:
[Link](9600);
[Link]("Galaxy M317509","tzoh1462");
while([Link]() !=WL_CONNECTED)
{delay(500);
[Link](".");
}
[Link]();
[Link]("NodeMCU is Connected");
[Link]([Link]());
[Link]();
pinMode(LED_Red, OUTPUT);
pinMode(LED_Yellow, OUTPUT);
pinMode(LED_Green, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
client=[Link]();
if(client==1)
{
String request =[Link]('\n');
[Link](request);
[Link]();
if(request =="GET /LED_Red HTTP/1.1")
{
digitalWrite(LED_Red, HIGH);
digitalWrite(LED_Yellow, LOW);
digitalWrite(LED_Green, LOW);
}

2
if(request =="GET /LED_Yellow HTTP/1.1")
{
digitalWrite(LED_Red, LOW);
digitalWrite(LED_Yellow, HIGH);
digitalWrite(LED_Green, LOW);
}
if(request =="GET /LED_Green HTTP/1.1")
{
digitalWrite(LED_Red, LOW);
digitalWrite(LED_Yellow, LOW);
digitalWrite(LED_Green, HIGH);
}
}
}

Step 5: Save the new sketch by appropriate name in a folder on your PC / Laptop

Step 6: Upload the sketch on Node MCU. Go to Sketch ----> Upload

Ensure everything is connected as described under the schematics section. After uploading the
code, you should see the IP address of your web server displayed in the serial monitor as shown
below.

Copy the IP address and paste it in a web browser on any device (Mobile or PC) connected to the
same network as the Node MCU. You should see the web page and be able to toggle the connected
appliances by clicking the buttons. Copy the IP which occur on serial monitor copy that and next

3
to that write down _ Red then RED led becomes glow. If you are writing Yellow than YELLOW
LED becomes glow similarly for Green.

Step 7: Observe the outputs.

4
5
Conclusion:

we have implemented a wireless communication system using Node MCU, Raspberry Pi, and
Arduino. We have created a web server that allows us to control LEDs on the Node MCU
remotely. This project has the potential to be used in a variety of applications, such as traffic
signal control and smart home automation.

You might also like