2024-25 IoT Master Manual Copy
2024-25 IoT Master Manual Copy
R22- Regulation
Vadlamudi, Guntur-522213
List of Experiments:
1. Familiarization of Arduino Boards and NODE MCU.
2. Blinking Two LEDs Using Arduino Mega 2560 with Delays
3. Interfacing of LED, Switch Using Development Boards
4. 2-Way Traffic Lights
5. Interfacing of Ultrasonic Sensor Using Exemplary Devices.
6. Interfacing of LDR Using Exemplary Devices.
7. Interfacing of IR/PIR Sensor Using Exemplary Devices.
8. Interfacing of Servo/DC motor Using Exemplary Devices.
The Arduino UNO is a popular microcontroller board used for building digital
devices and interactive objects that can sense and control the physical world.
Program:
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
// turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW);
VFSTR (Deemed to be University) 3
// turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
void setup() {
// Set Pin 13 as an output
pinMode(13, OUTPUT);
}
Program-2:
void loop() {
// Turn the LED on
digitalWrite(13, HIGH);
delay(1000); // Wait for 1 second
// Turn the LED off
digitalWrite(13, LOW);
delay(1000); // Wait for 1 second
}
Observations: The LED connected to Pin 13 will blink on and off every 1000 milli seconds.
Aim: To control the built-in LED1 and LED2 using the Arduino Uno board on Pin 13
Required Components:
• Arduino Mega2560
• Bread Board
• 2- LEDs
• Arduino IDE Software
• Connecting Wires (Male-Male Jumper Wires)
Circuit Diagram:
Program:
// Define LED pins
const int ledPin1 = 8;
const int ledPin2 = 9;
void setup() {
// Initialize LED pins as outputs
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
// Turn LED1 on and LED2 off
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, LOW);
delay(1000); // Wait for 1 second
Observations:
• First, LED1 is turned on while LED2 is off. Both LEDs are controlled by setting the
respective pins HIGH or LOW.
• After a 1-second delay, LED1 is turned off and LED2 is turned on.
• Both LEDs are then turned off for 0.5 seconds, followed by turning both LEDs on for
another 0.5 seconds.
To program the ESP8266, you'll need a plugin for the Arduino IDE, but it is easier to just add the
URL in the Arduino IDE:
1. Open the Arduino IDE.
2. Go to File > Preferences.
3. Paste the URL http://arduino.esp8266.com/stable/package_esp8266com_index.json into
the Additional Board Manager URLs field. (You can add multiple URLs, separating them with
commas.)
4. Go to Tools > Board > Board Manager and search for 'esp8266'.
5. Select the newest version and click install/ Update
Digital I/O
Just like with a regular Arduino, you can set the function of a pin using pinMode(pin,
Mode); where pin is the GPIO number*, and mode can be either INPUT, which is the default,
OUTPUT, or INPUT_PULLUP to enable the built-in pull-up resistors for GPIO 0-15. To enable the
pull-down resistor for GPIO16, you have to use INPUT_PULLDOWN_16.To address a NodeMCU
pin, e.g. pin 5, use D5: for instance: pinMode(D5, OUTPUT). To set an output pin high (3.3V) or low
(0V), use digitalWrite(pin, value); where pin is the digital pin, and value either 1 or 0 (or HIGH and
LOW).
To read an input, use digitalRead(pin). To enable PWM on a certain pin, use analogWrite(pin,
value); where pin is the digital pin, and value a number between 0 and 1023. You can change the
range (bit depth) of the PWM output by using analogWriteRange(new_range). The frequency can be
changed by using analogWriteFreq(new_frequency);. new_frequency should be between 100 and
1000Hz.
Analog input
Serial communication
To use UART0 (TX = GPIO1, RX = GPIO3), you can use the Serial object, just like on an Arduino:
Serial.begin(baud). To use the alternative pins (TX = GPIO15, RX = GPIO13), use Serial.swap() after
Serial.begin. To use UART1 (TX = GPIO2), use the Serial1 object. All Arduino Stream functions,
like read, write, print, println,... are supported as well.
You can just use the default Arduino library syntax, like you normally would.
There are many different modules available, standalone modules like the ESP-## series
by AI Thinker, or complete development boards like the NodeMCU DevKit or the WeMos D1.
VFSTR (Deemed to be University) 8
Different boards may have different pins broken out, have different Wi-Fi antennas, or a different
amount of flash memory on board.
Digital I/O
Just like a normal Arduino, the ESP8266 has digital input/output pins (I/O or GPIO,
General Purpose Input/Output pins). As the name implies, they can be used as digital inputs to read a
digital voltage, or as digital outputs to output either 0V (sink current) or 3.3V (source current).
The ESP8266 is a 3.3V microcontroller, so its I/O operates at 3.3V as well. The pins are not 5V
tolerant, applying more than 3.6V on any pin will kill the chip.
The maximum current that can be drawn from a single GPIO pin is 12mA.
Usable pins
The ESP8266 has 17 GPIO pins (0-16), however, you can only use 11 of them, because 6 pins (GPIO
6 - 11) are used to connect the flash memory chip. This is the small 8-legged chip right next to the
ESP8266. If you try to use one of these pins, you might crash your program. GPIO 1 and 3 are used
as TX and RX of the hardware Serial port (UART), so in most cases, you can’t use them as normal
I/O while sending/receiving serial data. Internal pull-up/-down resistors
GPIO 0-15 all have a built-in pull-up resistor, just like in an Arduino. GPIO16 has a built-in pull-
down resistor.
PWM
Unlike most Atmel chips (Arduino), the ESP8266 doesn’t support hardware PWM, however, software
PWM is supported on all digital pins. The default PWM range is 10-bits @ 1kHz, but this can be
changed (up to >14-bit@1kHz).
Analog input
The ESP8266 has a single analog input, with an input range of 0 - 1.0V. If you supply 3.3V, for
example, you will damage the chip. Some boards like the NodeMCU have an on-board resistive
voltage divider, to get an easier 0 - 3.3V range. You could also just use a trimpot as a voltage
divider.The ADC (analog to digital converter) has a resolution of 10 bits.
Communication
Serial
I²C
The ESP doesn’t have a hardware TWI (Two Wire Interface), but it is implemented in software. This
means that you can use pretty much any two digital pins. By default, the I²C library uses pin 4 as SDA
VFSTR (Deemed to be University) 9
and pin 5 as SCL. (The data sheet specifies GPIO2 as SDA and GPIO14 as SCL.) The maximum
speed is approximately 450kHz.
SPI
The ESP8266 has one SPI connection available to the user, referred to as HSPI. It uses GPIO14 as
CLK, 12 as MISO, 13 as MOSI and 15 as Slave Select (SS). It can be used in both Slave and Master
mode (in software).
AIM: To Blink an LED when switch is pressed using ESP8266 Node MCU.
APPARATUS REQUIRED:
• PC with Arduino IDE
• ESP8266 Node MCU/
• LED
• Switch
• Bread board
• Resistor – 1KΩ
THEORY:
Floating state (Neither connected to 5V nor connected to 0V) is not a good state and is a confused
state. To avoid such there is a mechanism in arduino called pullup or pulldown. There is an inbuilt
resistance which is connected to +5V if there any ambiguious situation then that pin is considered as
high if Pullup resistor is connected. Similarly, Pull down forces to Gnd when there any ambiguous
situation. Arduino have inbuilt pullup resistance but not pull down resistance. One can make pull up
and pull-down resistances by connecting to VCC through 10KΩ resistor. In Arduino, pinMode
(BUTTON, INPUT_PULLUP) will make the pin connected to pull resistor.
PROCEDURE:
1. Connect the Node MCU to the PC using USB cable.
2. Open Arduino IDE, select com port at Tools → port. If the com port is not visible under ports
section. Check the USB connection. If it is proper then go to device manager and select the port.
3. Select the Board NodeMCU 1.0 at Tools → board and Enter the Program.
5. After ensuring the code is error free. Upload it and observe the output.
OUTPUT:
S.No SWITCH LED
1
Circuit Diagram:
2. Traffic Light
AIM :
To design a traffic light system with red, yellow and green LEDs using nodeMCU
APPARATUS:
S.No. Name of the component Quantity
1 Node MCU 1
2 Red LED 1
3 Green LED 1
4 Yellow LED 1
5 Data cable 1
6 Male – Female wires As per required
7 Personal computer 1
8 Mini Bread Board 1
THEORY:
Traffic lights, also known as traffic signals, traffic lamps, traffic semaphore, signal lights, stop
lights, red lights and traffic control signals in technical parlance, are signaling devices positioned
at road intersections, pedestrian crossings, and other locations to control flows of traffic.
Traffic lights alternate the right of way accorded to users by illuminating lamps or LEDs of
standard colours (red, yellow, and green) following a universal colour code. In the typical sequence
of colour phases:
• The green light allows traffic to proceed in the direction denoted, if it is safe to do so and there is
room on the other side of the intersection.
• The yellow light warns that the signal is about to change to red. Actions required by drivers on a
yellow light vary, with some jurisdictions requiring drivers to stop if it is safe to do so, and others
allowing drivers to go through the intersection if safe to do so.
• A flashing yellow indication is a warning signal. In the United Kingdom, a flashing yellow light
is used only at pelican crossings, in place of the combined red–yellow signal, and indicates that
drivers may pass if no pedestrians are on the crossing.
• The red signal prohibits any traffic from proceeding.
• A flashing red indication requires traffic to stop and then proceed when safe (equivalent to a stop
sign).
In some countries traffic signals will go into a flashing mode if the conflict monitor detects a
problem, such as a fault that tries to display green lights to conflicting traffic. The signal may display
flashing yellow to the main road and flashing red to the side road, or flashing red in all directions.
Flashing operation can also be used during times of day when traffic is light, such as late at night.
Interfacing Diagram:
PROCEDURE:
1. Connect the Node MCU to the PC using USB cable.
2. Open Arduino IDE, select com port at Tools → port. If the com port is not visible under ports
section. Check the USB connection. If it is proper then go to device manager and select the port.
3. Select the Board NodeMCU 1.0 at Tools → board and Enter the Program.
4. Save it with an appropriate name. Verify/compile to check errors.
5. After ensuring the code is error free. Upload it and observe the output.
PROGRAM :
RESULT:
Successfully designed a traffic light system with red, yellow and green leds using nodeMCU
Block Diagram
AIM: To Interface DHT sensor with NodeMCU to display temperature and humidity.
THEORY:
The DHT11 is a basic, ultra low-cost digital temperature and humidity sensor. It uses a
capacitive humidity sensor and a thermistor to measure the surrounding air, and spits out a digital
signal on the data pin (no analog input pins needed). Its fairly simple to use, but requires careful timing
to grab data. The DHT11 calculates relative humidity by measuring the electrical resistance between
two electrodes. The humidity sensing component of the DHT11 is a moisture holding substrate with
the electrodes applied to the surface.The change in resistance between the two
electrodes is proportional to the relative humidity.
DHT11 Specifications:
VFSTR (Deemed to be University) 18
• Operating Voltage: 3.5V to 5.5V
• Operating current: 0.3mA (measuring) 60uA (standby)
• Output: Serial data
• Temperature Range: 0°C to 50°C
• Humidity Range: 20% to 90%
• Resolution: Temperature and Humidity both are 16-bit
• Accuracy: ±1°C and ±1%
Circuit Diagram:
Program:
#include<dht.h>;
dht DHT;
#define DHT11_PIN D2
void setup()
{
Serial.begin(9600);
}
void loop()
{
int chk = DHT.read11(DHT11_PIN);
Serial.print(“Temperature=”);
Serial.println(DHT.temperature);
Serial.print(“Humidity=”);
Serial.println(DHT.humidity);
delay(1000);
}
OUTPUT:
Temperature: 30.00
Humidity: 74.00
Temperature: 31.00
Humidity: 73.00
VFSTR (Deemed to be University) 19
Temperature: 32.00
Humidity: 70.00
RESULT:
OUTPUT:
D1 D2 DIRECTION
HIGH LOW CLOCK WISE
LOW HIGH ANTI CLOCK WISE
RESULT:
Apparatus :
Theory :
Python :
Characteristics of Python :
It provides rich data types and easier to read syntax than any other programming languages
It is a platform independent scripted language with full access to operating system API's
Compared to other programming languages, it allows more run-time flexibility
It includes the basic text manipulation facilities of Perl and Awk
A module in Python may have one or more classes and free functions
Libraries in Pythons are cross-platform compatible with Linux, MacIntosh, and Windows
For building large applications, Python can be compiled to byte-code
Python supports functional and structured programming as well as OOP
It supports interactive mode that allows interacting Testing and debugging of snippets of code
In Python, since there is no compilation step, editing, debugging and testing is fast.
input.txt :
- 123456 ps
0 S ck 1
0 S ck_c 0
0 E rdqs 00
0 E rdqs_c 11
0 E edc 11
- 2345167 ps
0 S ck 0
0 S ck_c 1
0 E rdqs 11
0 E rdqs_c 00
0 E edc 10
-342567 ps
0 S ck 1
0 S ck_c 0
0 E rdqs 00
0 E rdqs_c 11
0 E edc 11
output.txt :
- 123456 ps
0 E edc 11
0 E rdqs 00
0 E rdqs_c 11
0 S ck 1
0 S ck_c 0
- 2345167 ps
0 E edc 10
0 E rdqs 11
0 E rdqs_c 00
0 S ck 0
0 S ck_c 1
-342567 ps
0 E edc 11
0 E rdqs 00
0 E rdqs_c 11
0 S ck 1
0 S ck_c 0
Code :
st=s
l1=[]
l1.append(line)
Result :
Specifications :
SoC – Broadcom BCM2837 64bit ARMv8 quad core Cortex A53 processor @ 1.2GHz with dual core
VideoCore IV GPU @ 400 MHz supporting OpenGL ES 2.0, hardware-accelerated OpenVG, and
1080p30 H.264 high-profile decode. Capable of 1Gpixel/s, 1.5Gtexel/s or 24GFLOPs with texture
filtering and DMA infrastructure
System Memory – 1GB LPDDR2
Storage – micro SD slot
Video & Audio Output – HDMI 1.4 and 4-pole stereo audio and composite video port
Connectivity – 10/100M Ethernet, WiFi 802.11 b/g/n up to 150Mbps and Bluetooth 4.1 LE
(BCM43438 module)
Output:
Apparatus :
Procedure :
Program :
Result :
OUTPUT:
Apparatus :
pi camera
Raspberry pi
Procedure :
1. To capture an image with name image.jpg from console the command is raspistill -o image.jpg.
2. Using module python-picamera, the images can be captured in python code. Hence before using it,
one needs to install that as sudo apt-get install python-picamera.
Python code :
import picamera
camera = picamera.PiCamera()
camera.capture(‘image.jpg’)
Result :
a) Circuit Diagram
Apparatus Required:
• Raspberry Pi 3 Model B
• PIR Sensor
• 5V Buzzer
• Connecting Wires
• Mini Breadboard
• Power Supply
• Computer
Theory:
PIR Sensor:
PIR Sensor has three pins namely VCC, DATA and GND. Also, the PIR Sensor has two
potentiometers: one for adjusting the sensitivity of the sensor (or rather the sensing distance of the
sensor) and the other for adjusting the time for which the Output stays high upon detecting any human
movement.
Working:
The working of the PIR Motion Sensor using Raspberry Pi is very simple. If the PIR Sensor detects
any human movement, it raises its Data Pin to HIGH. Raspberry Pi upon detecting a HIGH on the
corresponding input pin will activate the Buzzer.
Applications:
The applications of the PIR Sensor using Raspberry Pi have been mentioned below. Some of them
are Automatic Room Light, Motion Detection Intruder, Alert Automatic Door Opening and Home
Security System.
Procedure:
Motion Detected….
Motion Detected….
Motion Detected….
Program:
import RPi.GPIO as GPIO
import time
sensor = 16
buzzer = 18
GPIO.setmode(GPIO.BOARD)
GPIO.setup(sensor,GPIO.IN)
GPIO.setup(buzzer,GPIO.OUT)
GPIO.output(buzzer,False)
print "Initialzing PIR Sensor......"
time.sleep(12)
print "PIR Ready..."
print " "
try:
while True:
if GPIO.input(sensor):
GPIO.output(buzzer,True)
print "Motion Detected"
while GPIO.input(sensor):
time.sleep(0.2)
else:
GPIO.output(buzzer,False)
except KeyboardInterrupt:
GPIO.cleanup()
Result:
1. https://www.electronicshub.org/pir-motion-sensor-using-raspberry-pi/
2. https://www.youtube.com/watch?v=_ACe6z-Hp2E
2. Data logging
Aim :
To send data from client to server remotely and store in the database.
Apparatus:
Theory :
Django is a high-level Python Web framework that encourages rapid development and clean,
pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web
development, so you can focus on writing your app without needing to reinvent the wheel. It’s free
and open source.
mkdir -p ~/djangoproject
cd ~/djangoproject
4. Install Django on your Raspberry Pi, and Create the Project Files
OUTPUT :
1. Install django on Raspberry pi. Create a django project and create an app inside the project.
2. Run the server.
3. Connect the internet and run the code on Node MCU.
4. Check the database whether the data sending from nodemcu is reached to Raspberry pi and stored
inside the database.
Program :
On Raspberry pi :
models.py :
views.py :
app-urls.py :
project-urls.py
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
const char* ssid = "yourNetworkName";
const char* password = "yourNetworkPassword";
void setup () {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print("Connecting..");
}
}
void loop() {
if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status
HTTPClient http; //Declare an object of class HTTPClient
http.begin("http://jsonplaceholder.typicode.com/10/15"); //Specify request destination
int httpCode = http.GET(); //Send the request
if (httpCode > 0) { //Check the returning code
String payload = http.getString();//Get the request response payload
Serial.println(payload); //Print the response payload
}
http.end(); //Close connection
}
delay(30000); //Send a request every 30 seconds
}
RESULT:
APPARATUS REQUIRED :
• DHT11 - Temperature and Humidity Sensor Module
• Raspberry Pi
• Bread board
• Jumper wires
PROCEDURE:
Download the Adafruit DHT11 library. In the terminal, type the following command.
RESULT:
APPARATUS:
1. Raspberry pi Kit with python3.
2. Internet Provider
THEORY:
One of the application of raspberry-pi is to use SMTP (Simple mail transfer protocol) for
sending and receiving emails.
In this project, we are going to send an email via SMTP server using raspberry pi. SMTP works
by starting a session between the user and server, whereas MTA (Mail Transfer Agent) and MDA
(Mail Delivery Agent) provide domain searching and local delivery services
1. Local user or client-end utility known as the mail user agent (MUA)
2. Server known as mail submission agent (MSA)
3. Mail transfer agent (MTA)
4. Mail delivery agent (MDA)
Getting email alerts or set of data using raspberry pi python program is very useful application. All
we need is smtplib library in the python script. There are many version of python but pi is more
compatible with 3.2 and 2.7 version of it.
“Allow less secure apps” setting and “On” it using this link
https://myaccount.google.com/lesssecureapps?pli=1
PROGRAM:
import smtplib
import config
# list of email_id to send the mail
li = ["[email protected]", "[email protected]"]
for i in range(len(li)):
try:
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login(config.EMAIL_ADDRESS, config.PASSWORD)
message = "Hello there, how are you today?"
s.sendmail("config.EMAIL_ADDRESS", li[i], message)
s.quit()
except :
print("Email failed to send.")
‘’’message = 'Subject: {}\n\n{}'.format(subject, msg)
subject = "Test subject"
msg = "Hello there, how are you today?" ’’’
config.py :
EMAIL_ADDRESS = “xxxxxxx”
PASSWORD = “Xxxxxx”
RESULT:
APPARATUS:
THEORY:
PROCEDURE :
PROGRAM :
#include <ESP8266WiFi.h>
const char* host = "api.thingspeak.com"; // Your domain
String ApiKey = " **************"; // the API key that has to select is write API
String path = "/update?key=" + ApiKey + "&field1=";
const char* ssid = "SSIDNAME";
const char* pass = "Password";
int sensor = A0;
float tempc;
float svoltage;
void setup(void){
Serial.begin(115200);
Serial.println("");
OUTPUT:
WiFi.begin(ssid, pass);
// Wait for connectionwhile (WiFi.status() != WL_CONNECTED) {
delay(100);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
float xval = analogRead(sensor);
svoltage = (xval*3300.0)/1023;
tempc = svoltage/10;
Serial.println(tempc);
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
}
client.print(String("GET ") + path + String(tempc) + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: keep-alive\r\n\r\n");
delay(16000);
}
RESULT :
MODEL VIVA QUESTIONS:
1. How can write data to thingspeak cloud.
2. How to read data from Thingspeak cloud
3. Explain the differences between HTTP and MQTT
4. Give me some examples of HTTP cloud.
5. Give me some examples of MQTT cloud.
6. Give me some examples of both HTTP and MQTT cloud.
12. Networking in Python
Aim :
Transferring the data between the client and server
Theory :
In computing, a server is a computer program or a device that provides functionality for other
programs or devices, called "clients". This architecture is called the client-server model, and a single
overall computation is distributed across multiple processes or devices. Servers can provide various
functionalities, often called "services", such as sharing data or resources among multiple clients or
performing computation for a client. A single server can serve multiple clients, and a single client can
use multiple servers. A client process may run on the same device or may connect over a network to
a server on a different device.[1] Typical servers are database servers, file servers, mail servers, print
servers, web servers, game servers, and application servers.[2]
You run a simple socket server on a PC listening on port 2017 that just displays state
messages in a console. Try to set up your router so that the server is visible from anywhere on
the Internet. A client on the Raspberry Pi connects to the server and sen ds sensor information
(here just the state of a button) every second.
In this experiment, we exchange the roles of client and server and run the client on the
Raspberry Pi and the server on a PC connected through a WLAN or Ethernet router located
anywhere on the Internet.
To make your PC server accessible from the Internet, you must set up the router for
"IP forwarding" by specifying a single or a range of IP ports. (The setup is sometimes called
"Virtual Servers".) Any request from outside to the router's IP address with a port in the
specified range is then forwarded to your PC.
Client :
Connection established
Data sent successfully
Server :
There are two problems: Because your PC's IP address is given by your router's DHCP, it
is subject to change. Thus the IP forwarding to the specified IP may fail. To avoid this problem,
you can either set up your PC to use a fixed IP address or bind the IP address to the fixed Mac
address of your PC's WLAN or Ethernet adapter by an "address reservation" (if available on your
router).
The second problem arises because your router's IP address is delivered by your provider
using DHCP, and thus is also subject to change. Therefore your PC server cannot be accessed from
outside with a fixed, well-known IP address. This problem can be solved by using a Dynamic
Update Client (DUC), provided for free from noip.com. The DUC connects every 5 minutes (or
another interval you chose) to the no-IP server and announces your router's IP address. From the
TCP client, the link is established using the IP alias provided by No-IP and the connection request
is then forwarded by the no-IP server to your router that finally forwards it to the PC.
Procedure:
1. Open the python editor, enter the python code in python ide.
2. Make sure the python code, input.txt, and output.txt files are in the same folder.
3. Save it with an extension .py
4. Check the errors and execute
5. Made the hardware connections.
6. Execute the code by clicking on Run.
Source Code:
Client-Side:
Import socket
Import sys
#Send command
Client_socket.send(‘Message to the server’)
Print(‘Data sent successfully’)
Server Side:
Import socket
Import sys
#Create a TCP/IP socket
Socket=socket.socket(socket.AF_INET,socket.STOCK_STREAM)
#Receive command
Data=connection.recv(1024)
Print(data)
Sock.close()
Result:
Apparatus :
Theory:
Selenium is a great tool for Internet scraping or automated testing for websites.
Installations :
Procedure :
Program :
driver.get("https://web.whatsapp.com/")
wait = WebDriverWait(driver, 600)
OUTPUT:
input_box = wait.until(EC.presence_of_element_located((
By.XPATH, inp_xpath)))
for i in range(100):
input_box.send_keys(string + Keys.ENTER)
time.sleep(1)
Result :